Prerequisites
- A Tally account
- An API key
Request
To create a form with a dropdown, you’ll need to send a POST request with the form blocks, including the dropdown options. Each option is represented as a DROPDOWN_OPTION
block.
curl -X POST 'https://api.tally.so/forms' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"status": "PUBLISHED",
"blocks": [
{
"uuid": "6ef8675d-33cb-419b-a81e-93982e726f2e",
"type": "FORM_TITLE",
"groupUuid": "073c835f-7ad4-459c-866d-4108b6b7e2e1",
"groupType": "TEXT",
"payload": {
"title": "Dropdown example",
"html": "Dropdown example"
}
},
{
"uuid": "2515b4dd-54e3-4502-afe6-074ad5019b44",
"type": "TITLE",
"groupUuid": "22a0af81-0117-4931-806f-2b83e374275b",
"groupType": "QUESTION",
"payload": {
"html": "What'\''s your favorite color?"
}
},
{
"uuid": "338631d5-64b0-4a55-8219-17658e66196b",
"type": "DROPDOWN_OPTION",
"groupUuid": "aa64831b-8695-4887-afba-31c07034cd77",
"groupType": "DROPDOWN",
"payload": {
"index": 0,
"text": "Red"
}
},
{
"uuid": "4c8fe10a-b07e-407e-9347-f64d73a9ba9a",
"type": "DROPDOWN_OPTION",
"groupUuid": "aa64831b-8695-4887-afba-31c07034cd77",
"groupType": "DROPDOWN",
"payload": {
"index": 1,
"text": "Green"
}
},
{
"uuid": "3bddc101-571b-4f00-aa7a-30ee629441bc",
"type": "DROPDOWN_OPTION",
"groupUuid": "aa64831b-8695-4887-afba-31c07034cd77",
"groupType": "DROPDOWN",
"payload": {
"index": 2,
"text": "Blue"
}
}
]
}'
All dropdown options must share the same groupUuid
. This groups them together as options for the
same dropdown. The index
field determines the order of the options.
Response
The API will respond with a 200 status code and return the newly created form:
{
"id": "m2fK5R",
"name": "Dropdown example",
"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 will now be created with a dropdown containing the three color options.