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:
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:
- A title block with the text “What’s your name?”
- A required text input block
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.
Response
The API will respond with a 200 status code and with some form meta data:
{
"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.