Skip to main content
POST
Create a survey draft payload with AI

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 uses it when the prompt language is ambiguous or cannot be confidently matched to a supported app locale.

Available options:
de-DE,
en-US,
es-ES,
fr-FR,
hu-HU,
ja-JP,
nl-NL,
pt-BR,
pt-PT,
ro-RO,
ru-RU,
sv-SE,
tr-TR,
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