> ## Documentation Index
> Fetch the complete documentation index at: https://developers.tally.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding blocks to a form

> Add new blocks to an existing form using the Tally API

## Prerequisites

* A Tally account
* An API key
* An existing form

## Request

To add blocks to an existing form, send a PATCH request to the `/forms/:id` endpoint with the blocks you want it to contain:

```bash theme={null}
curl -X PATCH 'https://api.tally.so/forms/:id' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
  "name": "Test",
  "status": "PUBLISHED",
  "blocks": [
    {
      "uuid": "6ef8675d-33cb-419b-a81e-93982e726f2e",
      "type": "FORM_TITLE",
      "groupUuid": "073c835f-7ad4-459c-866d-4108b6b7e2e1",
      "groupType": "TEXT",
      "payload": {
        "html": "Test",
        "title": "Test"
      }
    },
    {
      "uuid": "48b4cdf3-2c9d-47d3-b8fb-b0ccabc5cd84",
      "type": "TITLE",
      "groupUuid": "93034250-5f05-4710-b8e0-5c9145c5b9ea",
      "groupType": "QUESTION",
      "payload": {
        "html": "What'\''s your name?"
      }
    },
    {
      "uuid": "884ff838-97f9-4ac9-8db1-31aa052df988",
      "type": "INPUT_TEXT",
      "groupUuid": "3287d15c-c2b2-4f84-a915-bc57380a4b51",
      "groupType": "INPUT_TEXT",
      "payload": {
        "isRequired": true,
        "placeholder": ""
      }
    }
  ]
}'
```

This example adds two blocks to the form:

1. A title block with the text "What's your name?"
2. A required text input block

<Warning>
  As you can see, the payload contains 3 blocks, while we only wanted to add 2. That is because you
  always need to include all blocks when updating a form.
</Warning>

## Response

The API will respond with a 200 status code and with some form meta data:

```json theme={null}
{
  "id": "m2fK5R",
  "name": "Test",
  "workspaceId": "kb3o5R",
  "organizationId": "atL65s",
  "status": "PUBLISHED",
  "hasDraftBlocks": false,
  "isClosed": false,
  "updatedAt": "2024-12-20T10:34:19.262Z",
  "createdAt": "2024-12-20T10:34:19.262Z"
}
```

Your form should now contain the updated blocks.

<Frame>
  <img src="https://mintcdn.com/tally/dNtl8XLd2Tzd_ywC/images/documentation/adding-blocks-to-a-form.jpg?fit=max&auto=format&n=dNtl8XLd2Tzd_ywC&q=85&s=a936ec018e405cc878a145aed374af12" alt="Adding blocks to a form" width="1440" height="900" data-path="images/documentation/adding-blocks-to-a-form.jpg" />
</Frame>
