> For the complete documentation index, see [llms.txt](https://docs.amitysolutions.com/ekoai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amitysolutions.com/ekoai/api-reference/advance-custom-api/form/create-form.md).

# Create Form

## Create Form

<mark style="color:blue;">POST</mark> `/v1/forms`

#### **Headers**

| Header         | Type     | Required | Description                                       |
| -------------- | -------- | -------- | ------------------------------------------------- |
| `accept`       | `string` | ✅        | Expected response format. Use `application/json`. |
| `content-type` | `string` | ✅        | Request body format. Use `application/json`.      |
| `X-API-Key`    | `string` | ✅        | API key for authentication.                       |
| `X-API-Token`  | `string` | ✅        | Token identifying the current user or session.    |

#### Body

| Field             | Type            | Required | Description                                                        |
| ----------------- | --------------- | -------- | ------------------------------------------------------------------ |
| `name`            | `string`        | ✅        | The title or name of the form.                                     |
| `subject`         | `string`        | ✅        | Subject line or short summary.                                     |
| `dueDate`         | `string (date)` | ❌        | Due date in `YYYY-MM-DD` format.                                   |
| `senderUserId`    | `string`        | ✅        | User ID (username) of the form sender.                             |
| `receiverUserIds` | `array[string]` | ✅        | List of recipient user IDs (usernames).                            |
| `data`            | `array[object]` | ✅        | Array describing the input fields within the form.                 |
| `status`          | `string`        | ✅        | Status of the form — e.g., `drafted`, `published`, or `completed`. |
| `responseType`    | `string`        | ❌        | type of stage: hierarchy                                           |
| `responseTiers`   | `array[object]` | ❌        | object of response tiers payload                                   |

#### **ResponseTiers Object**

| Field         | Type                                                                                               | Required | Description                                       |
| ------------- | -------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------- |
| title         | <p>text<br>allow: '' and null</p>                                                                  | ❌        | Stage title                                       |
| description   | <p>text<br>allow: '' and null</p>                                                                  | ❌        | Stage Description                                 |
| tier          | <p>number<br>min: 1<br>max: 100</p>                                                                | ❌        | <p> Order of stage<br>1 = first stage</p>         |
| responders    | array objects                                                                                      | ❌        | <p>{<br>userId: username<br>}</p>                 |
| status        | <p>text<br>\[<code>'submitted', 'drafted', 'approved', 'rejected', 'mixed', 'canceled'</code>]</p> | ❌        |                                                   |
| dueDate       | timestamp                                                                                          | ❌        |                                                   |
| duration      | <p>number<br>min: 0<br>max: timstamp</p>                                                           | ❌        |                                                   |
| minimumWeight | <p>number<br>min: 0</p>                                                                            | ❌        | minimum of approve weight before go to next stage |

### Create Form by single stage

{% code overflow="wrap" lineNumbers="true" fullWidth="true" expandable="true" %}

```json
curl --location '{{domain}}/v1/forms' \
--header 'accept: application/json' \
--header 'X-API-Key: x-api-key' \
--header 'X-API-Token: x-api-token' \
--header 'content-type: application/json' \
--data-raw '{
  "name": "Example Form",
  "subject": "Example",
  "dueDate": "2025-09-30",
  "senderUserId": "senderUserId",
  "receiverUserIds": ["receiverUserIds"],
  "data": [
    {
      "type": "textinput",
      "name": "Field 1 (text)",
      "value": "this is the best form",
      "meta": {},
      "editable": true
    },
    {
      "type": "radio",
      "name": "Field 2 (radio)",
      "meta": {
        "options": [{
          "label": "Yes",
          "value": "a1"
        }, {
          "label": "No",
          "value": "a2"
        }]
      },
      "editable": true
    },
    {
      "type": "action",
      "name": "Action Buttons",
      "meta": {
        "options": [{
          "label": "APPROVE no val",
          "type": "approved"
        },{
          "label": "REJECT",
          "type": "rejected",
          "value": "1"
          },{
          "label": "OTHER Action",
          "type": "other",
          "value": "2",
          "color": "#000000"
        }]
      }
    }
  ],
  "status": "submitted"
}'
```

{% endcode %}

### Create Form by sequence stage & Parallel

{% code overflow="wrap" lineNumbers="true" fullWidth="true" expandable="true" %}

```json
curl --location '{{domain}}/v1/forms' \
--header 'accept: application/json' \
--header 'X-API-Key: x-api-key' \
--header 'X-API-Token: x-api-token' \
--header 'content-type: application/json' \
--data-raw '{
    "name": "Example Form",
    "subject": "Example",
    "dueDate": "2025-09-30",
    "senderUserId": "senderUsername",
    "receiverUserIds": [
        "receiverUsername"
    ],
    "data": [
        {
            "type": "textinput",
            "name": "Field 1 (text)",
            "value": "this is the best form",
            "meta": {},
            "editable": true
        },
        {
            "type": "radio",
            "name": "Field 2 (radio)",
            "meta": {
                "options": [
                    {
                        "label": "Yes",
                        "value": "a1"
                    },
                    {
                        "label": "No",
                        "value": "a2"
                    }
                ]
            },
            "editable": true
        },
        {
            "type": "action",
            "name": "Action Buttons",
            "meta": {
                "options": [
                    {
                        "label": "APPROVE no val",
                        "type": "approved"
                    },
                    {
                        "label": "REJECT",
                        "type": "rejected",
                        "value": "1"
                    },
                    {
                        "label": "OTHER Action",
                        "type": "other",
                        "value": "2",
                        "color": "#000000"
                    }
                ]
            }
        }
    ],
    "status": "submitted",
    "responseType": "hierarchy",
    "responseTiers": [
        {
            "description": "tier1 description",
            "title": "tier1 title",
            "tier": 1,
            "allowedResponders": [
                {
                    "type": "user",
                    "entityId": "receiverUsername1",
                    "weight": 1
                },
                {
                    "type": "user",
                    "entityId": "receiverUsername2",
                    "weight": 1
                }
            ],
            "responders": [
                {
                    "userId": "receiverUsername1"
                },
                                {
                    "userId": "receiverUsername2"
                }
            ],
            "minimumWeight": 2
        },
        {
            "description": "tier2 description",
            "title": "tier2 title",
            "tier": 2,
            "allowedResponders": [
                {
                    "type": "user",
                    "entityId": "receiverUsername3",
                    "weight": 1
                }
            ],
            "responders": [
                {
                    "userId": "receiverUsername3"
                }
            ],
            "minimumWeight": 1
        }
    ]
}'
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.amitysolutions.com/ekoai/api-reference/advance-custom-api/form/create-form.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
