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."
}
'import requests
url = "https://app.formbricks.com/api/v3/surveys/generate"
payload = {
"workspaceId": "clxx1234567890123456789012",
"type": "link",
"language": "en-US",
"prompt": "Understand why new users stop during onboarding and what would help them finish setup."
}
headers = {
"cookie": "next-auth.session-token=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'next-auth.session-token=', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspaceId: 'clxx1234567890123456789012',
type: 'link',
language: 'en-US',
prompt: 'Understand why new users stop during onboarding and what would help them finish setup.'
})
};
fetch('https://app.formbricks.com/api/v3/surveys/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.formbricks.com/api/v3/surveys/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'workspaceId' => 'clxx1234567890123456789012',
'type' => 'link',
'language' => 'en-US',
'prompt' => 'Understand why new users stop during onboarding and what would help them finish setup.'
]),
CURLOPT_COOKIE => "next-auth.session-token=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.formbricks.com/api/v3/surveys/generate"
payload := strings.NewReader("{\n \"workspaceId\": \"clxx1234567890123456789012\",\n \"type\": \"link\",\n \"language\": \"en-US\",\n \"prompt\": \"Understand why new users stop during onboarding and what would help them finish setup.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "next-auth.session-token=")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.formbricks.com/api/v3/surveys/generate")
.header("cookie", "next-auth.session-token=")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": \"clxx1234567890123456789012\",\n \"type\": \"link\",\n \"language\": \"en-US\",\n \"prompt\": \"Understand why new users stop during onboarding and what would help them finish setup.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.formbricks.com/api/v3/surveys/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'next-auth.session-token='
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspaceId\": \"clxx1234567890123456789012\",\n \"type\": \"link\",\n \"language\": \"en-US\",\n \"prompt\": \"Understand why new users stop during onboarding and what would help them finish setup.\"\n}"
response = http.request(request)
puts response.read_body{
"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."
}
'import requests
url = "https://app.formbricks.com/api/v3/surveys/generate"
payload = {
"workspaceId": "clxx1234567890123456789012",
"type": "link",
"language": "en-US",
"prompt": "Understand why new users stop during onboarding and what would help them finish setup."
}
headers = {
"cookie": "next-auth.session-token=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'next-auth.session-token=', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspaceId: 'clxx1234567890123456789012',
type: 'link',
language: 'en-US',
prompt: 'Understand why new users stop during onboarding and what would help them finish setup.'
})
};
fetch('https://app.formbricks.com/api/v3/surveys/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.formbricks.com/api/v3/surveys/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'workspaceId' => 'clxx1234567890123456789012',
'type' => 'link',
'language' => 'en-US',
'prompt' => 'Understand why new users stop during onboarding and what would help them finish setup.'
]),
CURLOPT_COOKIE => "next-auth.session-token=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.formbricks.com/api/v3/surveys/generate"
payload := strings.NewReader("{\n \"workspaceId\": \"clxx1234567890123456789012\",\n \"type\": \"link\",\n \"language\": \"en-US\",\n \"prompt\": \"Understand why new users stop during onboarding and what would help them finish setup.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "next-auth.session-token=")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.formbricks.com/api/v3/surveys/generate")
.header("cookie", "next-auth.session-token=")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": \"clxx1234567890123456789012\",\n \"type\": \"link\",\n \"language\": \"en-US\",\n \"prompt\": \"Understand why new users stop during onboarding and what would help them finish setup.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.formbricks.com/api/v3/surveys/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'next-auth.session-token='
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspaceId\": \"clxx1234567890123456789012\",\n \"type\": \"link\",\n \"language\": \"en-US\",\n \"prompt\": \"Understand why new users stop during onboarding and what would help them finish setup.\"\n}"
response = http.request(request)
puts response.read_body{
"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
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
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.
Workspace where the AI-created survey draft would be created. Requires read/write access.
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.
4 - 1200Survey 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.
link, app 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.
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 "en-US"
Response
Survey create payload generated successfully. The survey has not been created yet.
Show child attributes
Show child attributes
Was this page helpful?