Skip to main content
POST

Authorizations

next-auth.session-token
string
cookie
required

NextAuth session JWT cookie. Development: often next-auth.session-token. Production (HTTPS): often __Secure-next-auth.session-token. Send the cookie your browser receives after sign-in.

Body

application/json

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.

workspaceId
string<cuid2>
required

Workspace where the AI-created survey draft would be created. Requires read/write access.

prompt
string
required

Natural-language survey goal and audience. Prompts with fewer than 24 characters or fewer than four whitespace-separated words return prompt feedback before any AI provider call.

Required string length: 4 - 1200
type
enum<string>
default:link

Survey type to generate. The AI generates the survey content (blocks/questions) for both types; for app it additionally seeds a default distribution (display once, no triggers, no targeting) that you finish configuring before publishing.

Available options:
link,
app
language
enum<string>

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.

Available options:
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
Example:

"en-US"

surveyLanguage
enum<string>

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.

Available options:
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
Example:

"en-US"

Response

Survey create payload generated successfully. The survey has not been created yet.

data
object
required