curl --request POST \
--url https://app.formbricks.com/api/v3/surveys/generate \
--header 'Content-Type: application/json' \
--cookie next-auth.session-token= \
--data '
{
"workspaceId": "clxx1234567890123456789012",
"type": "link",
"language": "en-US",
"prompt": "Understand why new users stop during onboarding and what would help them finish setup."
}
'{
"data": {
"language": "en-US",
"payload": {
"workspaceId": "clxx1234567890123456789012",
"type": "link",
"name": "Onboarding Completion Survey",
"status": "draft",
"defaultLanguage": "en-US",
"languages": [
{
"code": "en-US",
"default": true,
"enabled": true
}
],
"metadata": {
"title": {
"en-US": "Onboarding Completion Survey"
}
},
"welcomeCard": {
"enabled": false
},
"blocks": [
{
"id": "clbk1234567890123456789012",
"name": "Main",
"elements": [
{
"id": "q_1_example",
"type": "openText",
"headline": {
"en-US": "What made onboarding hard to complete?"
},
"required": false,
"isDraft": true,
"inputType": "text",
"longAnswer": false,
"charLimit": {
"enabled": false
}
}
]
}
],
"endings": [
{
"id": "clen1234567890123456789012",
"type": "endScreen",
"headline": {
"en-US": "Thanks for your feedback"
}
}
],
"hiddenFields": {
"enabled": false
},
"variables": []
},
"validation": {
"valid": true,
"invalid_params": [],
"languages": [
{
"code": "en-US",
"default": true,
"enabled": true
}
]
}
}
}Create a survey draft payload with AI
Creates a strict v3 POST /api/v3/surveys create payload from a creator prompt and returns
validation metadata. This endpoint is single-purpose: it does not persist the survey.
Clients should validate the returned payload with /api/v3/surveys/validate or use the
embedded validation metadata, then create the draft through POST /api/v3/surveys.
The generated payload always sets status: draft. Both type: link and type: app are
supported; for app, the payload includes a default distribution (display once, no triggers,
no targeting) that you finish configuring in the editor or via the create request.
Prompt privacy: prompt text is sent to the configured AI provider to create the payload, but this endpoint does not store prompts and server logs should use request ids and failure categories instead of raw prompt content.
curl --request POST \
--url https://app.formbricks.com/api/v3/surveys/generate \
--header 'Content-Type: application/json' \
--cookie next-auth.session-token= \
--data '
{
"workspaceId": "clxx1234567890123456789012",
"type": "link",
"language": "en-US",
"prompt": "Understand why new users stop during onboarding and what would help them finish setup."
}
'{
"data": {
"language": "en-US",
"payload": {
"workspaceId": "clxx1234567890123456789012",
"type": "link",
"name": "Onboarding Completion Survey",
"status": "draft",
"defaultLanguage": "en-US",
"languages": [
{
"code": "en-US",
"default": true,
"enabled": true
}
],
"metadata": {
"title": {
"en-US": "Onboarding Completion Survey"
}
},
"welcomeCard": {
"enabled": false
},
"blocks": [
{
"id": "clbk1234567890123456789012",
"name": "Main",
"elements": [
{
"id": "q_1_example",
"type": "openText",
"headline": {
"en-US": "What made onboarding hard to complete?"
},
"required": false,
"isDraft": true,
"inputType": "text",
"longAnswer": false,
"charLimit": {
"enabled": false
}
}
]
}
],
"endings": [
{
"id": "clen1234567890123456789012",
"type": "endScreen",
"headline": {
"en-US": "Thanks for your feedback"
}
}
],
"hiddenFields": {
"enabled": false
},
"variables": []
},
"validation": {
"valid": true,
"invalid_params": [],
"languages": [
{
"code": "en-US",
"default": true,
"enabled": true
}
]
}
}
}Authorizations
Body
AI survey creation request. prompt is used only to create a draft payload; it is not
persisted by this endpoint. The generated payload is validated and returned to the caller for
a separate create request.
Preferred survey language. Session clients should send the logged-in user's language.
The generator writes the draft in the language of the prompt, detected among the dashboard locales plus this language, and uses this one only when the prompt language is ambiguous or not one of those. To get a draft in any other supported survey language, name it here or in surveyLanguage.
ar-EG, bg-BG, cs-CZ, da-DK, de-DE, el-GR, en-US, es-ES, et-EE, fi-FI, fr-FR, hi-IN, hr-HR, hu-HU, id-ID, it-CH, it-IT, ja-JP, km-KH, ko-KR, lt-LT, lv-LV, ms-MY, nb-NO, ne-NP, nl-BE, nl-NL, no-NO, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, sk-SK, sl-SI, sv-SE, tr-TR, uk-UA, ur-PK, uz-UZ, vi-VN, zh-Hans-CN, zh-Hant-TW "en-US"
Required survey language. When set, the draft is written in this language whatever language the prompt is in, and it takes precedence over language.
A draft the model returns under any other language code is rejected as an invalid generated payload rather than relabelled. The code is what is checked: the generated text itself is not language-verified, so review the draft before creating the survey.
ar-EG, bg-BG, cs-CZ, da-DK, de-DE, el-GR, en-US, es-ES, et-EE, fi-FI, fr-FR, hi-IN, hr-HR, hu-HU, id-ID, it-CH, it-IT, ja-JP, km-KH, ko-KR, lt-LT, lv-LV, ms-MY, nb-NO, ne-NP, nl-BE, nl-NL, no-NO, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, sk-SK, sl-SI, sv-SE, tr-TR, uk-UA, ur-PK, uz-UZ, vi-VN, zh-Hans-CN, zh-Hant-TW "en-US"
Was this page helpful?