---
title: "Validate a survey document"
method: POST
path: "/api/v3/surveys/validate"
tags: ["V3 Surveys"]
---

# Validate a survey document

`POST /api/v3/surveys/validate`

Validates a future create or patch survey payload without writing data, creating languages,
or creating survey versions. Invalid survey documents return `200` with `data.valid=false`
so agents and MCP clients can repair payloads from structured `invalid_params`.

Use `400` only for malformed validation envelopes, unsupported operations, invalid `surveyId`,
or unsupported query parameters.

## Request body

- union
  - ValidateSurveyCreateRequest
    - `operation` 'create', required
    - `data` union, required — Intended create payload. Invalid documents are allowed so the endpoint can return repairable validation errors.
      - CreateSurveyRequest — Strict v3 survey creation document. This endpoint accepts survey structure only: name, metadata, languages, welcome card, blocks/elements/logic, endings, hidden fields, and variables. App surveys (`type: app`) additionally accept the `distribution` (display options + triggers) and `targeting` (contact segment filters) objects; these are rejected for `link` surveys. It rejects legacy `questions` and out-of-scope settings such as styling, follow-ups, recaptcha, single-use/email verification, slug, custom scripts, analytics fields, timestamps, and `createdBy`. Translatable fields use real locale-code maps. The map must include the canonical `defaultLanguage` key, such as `en-US`, so the server can persist the internal default translation. Locale keys must be canonical BCP 47 codes such as `de-DE`, `pt-PT`, or `zh-Hans-CN`. Non-default locale keys must be declared in `languages`; undeclared locale keys in metadata, welcome cards, blocks, or endings are rejected with `unsupported_locale`. `blocks[].id` and `variables[].id` may be omitted on create and will be generated by the server. Provide explicit cuid2 ids when other fields in the same request reference them. For normal sequential flow, omit `logicFallback`. It is only valid together with a non-empty `logic` array on the same block.
        - `workspaceId` string, cuid2, required — Workspace where the survey will be created. Requires read/write access.
        - `name` string, required
        - `type` 'link' | 'app' — Survey type. `link` surveys are distributed by URL; `app` surveys are shown in-app and configure their runtime behavior via the `distribution` and `targeting` objects. `type` is immutable after creation (it cannot be changed via PATCH).
        - `status` 'draft' | 'inProgress' | 'paused' | 'completed'
        - `metadata` SurveyMetadata — Arbitrary JSON survey context for customer- or operation-specific metadata. v3 preserves arbitrary metadata values as-is. If present, `title` and `description` are treated as translatable text maps and returned with real locale-code keys.
          - `title` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `description` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
        - `defaultLanguage` string — Canonical locale code accepted by v3 survey APIs, for example `en-US`, `de-DE`, or `zh-Hans-CN`.
        - `languages` CreateSurveyLanguage[] — Optional survey language configuration. Every non-default locale used by translatable maps must be declared here; omitted languages are not inferred from map keys.
          - `code` string, required — Canonical locale code accepted by v3 survey APIs, for example `en-US`, `de-DE`, or `zh-Hans-CN`.
          - `default` boolean — Optional marker for readability; only the `defaultLanguage` entry may set this to true.
          - `enabled` boolean — Whether this language is enabled for respondent-facing delivery.
        - `welcomeCard` SurveyWelcomeCard — Optional card shown before the first survey block.
          - `enabled` boolean, required
          - `headline` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `subheader` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `buttonLabel` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `fileUrl` string
          - `videoUrl` string
          - `timeToFinish` boolean
          - `showResponseCount` boolean
        - `blocks` CreateSurveyBlock[], required
          - `id` string, cuid2 — Optional stable block id. Generated when omitted.
          - `name` string, required
          - `elements` SurveyElement[], required
            - union — Survey element/question inside a block. Element ids are stable public identifiers used by logic, recall strings, response data, quotas, integrations, and analysis. `type` selects the allowed shape; unsupported fields are rejected instead of ignored.
              - …
          - `logic` SurveyBlockLogic[]
            - `id` string, cuid2, required
            - `conditions` SurveyConditionGroup, required
              - …
            - `actions` SurveyLogicAction[], required
              - …
          - `logicFallback` string, cuid2 — Block or ending id used when no logic condition matches. Only valid when this same block has at least one `logic` rule; omit it for normal sequential flow.
          - `buttonLabel` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `backButtonLabel` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
        - `endings` SurveyEnding[]
          - union — Ending reached after the last block or a jump action. `type` selects the allowed shape; unsupported fields are rejected instead of ignored.
            - SurveyEndScreenEnding — Visual end screen displayed after survey completion.
              - …
            - SurveyRedirectEnding — Redirects the respondent to a URL after survey completion. External redirects require the organization's external URL permission; otherwise write endpoints return `403 Forbidden`.
              - …
        - `hiddenFields` SurveyHiddenFields — Hidden fields, sometimes called embedded data in other survey products. Field ids are stable public identifiers and may be referenced by logic, recall, quotas, integrations, and response data. Use only letters, numbers, underscores, and hyphens; avoid spaces and reserved ids.
          - `enabled` boolean, required
          - `fieldIds` string[]
        - `variables` CreateSurveyVariable[]
          - union — Survey variable accepted by `POST /api/v3/surveys`. `id` may be omitted and will be generated by the server. Provide an explicit cuid2 id when logic in the same request needs to reference this variable.
            - CreateSurveyNumberVariable
              - …
            - CreateSurveyTextVariable
              - …
        - `distribution` SurveyDistribution — App-survey runtime/display settings. Only valid for `type: app`; rejected for link surveys. **Replacement semantics (destructive):** when `distribution` is provided on PATCH it fully replaces the stored object — any sub-field you omit is reset to its default, NOT preserved. In particular, omitting `triggers` removes ALL existing triggers, and omitting `displayOption` resets it to `displayOnce`. To change one setting, send the complete desired distribution. To leave distribution untouched, omit the whole `distribution` key.
          - `displayOption` 'displayOnce' | 'displayMultiple' | 'respondMultiple' | 'displaySome' — How often the survey may be shown to a contact. `displaySome` shows it up to `displayLimit` times (or until the contact responds, whichever comes first).
          - `displayPercentage` number, nullable — Independent throttle: show the survey to only this percentage of triggered contacts. Optional and valid with any `displayOption`; null/omitted means no throttle (shown to everyone).
          - `displayLimit` integer, nullable — Maximum number of times the survey is shown to a single contact. Required (must be >= 1) when `displayOption` is `displaySome`; otherwise optional.
          - `recontactDays` integer, nullable — Days to wait before showing this survey again to the same contact. Null uses the workspace default.
          - `autoClose` integer, nullable — Seconds of inactivity after which the survey widget auto-closes. Null disables auto-close.
          - `autoComplete` integer, nullable — Automatically stop collecting responses after this many completed responses. Null disables it.
          - `delay` integer — Seconds to wait after a trigger fires before showing the survey.
          - `triggers` SurveyTrigger[] — Action classes that trigger the survey. Every id must reference an existing workspace action class. On PATCH this list fully replaces the survey's triggers — omitting it (or sending `[]`) removes all existing triggers.
            - `actionClassId` string, cuid2, required — Id of an action class in the same workspace.
        - `targeting` SurveyTargeting — App-survey contact targeting. Only valid for `type: app`. `filters: []` targets everyone. Setting or changing non-empty filters requires the Contacts entitlement; otherwise create/patch returns 403. `attribute` filters reference workspace contact-attribute keys (discover them via `GET /api/v3/contact-attribute-keys`) and `segment` filters reference other segment ids — both are workspace-scoped resources you must obtain before constructing filters (an invalid key/id targets no one rather than erroring). See `SegmentFilter` for the per-`root.type` operator sets.
          - `filters` object[], required — Contact targeting filter tree. An empty array targets everyone. Each node joins the previous one via its `connector` (`and`/`or`; the first node's connector is null). A node's `resource` is either a single filter condition or a nested filter group (enabling parenthesized `and`/`or` logic).
            - `id` string, cuid2, required
            - `connector` 'and' | 'or' | 'null', nullable, required — Logical connector joining this node to the previous one. Null for the first node.
            - `resource` union, required — A single filter condition, or a nested filter group for grouped logic.
              - …
      - object
  - ValidateSurveyPatchRequest
    - `operation` 'patch', required
    - `surveyId` string, cuid2, required
    - `data` union, required — Intended patch payload. Invalid documents are allowed so the endpoint can return repairable validation errors.
      - PatchSurveyRequest — Patch payload shape. Top-level fields are partial; any provided nested object or array fully replaces that subtree. Omitted top-level fields are preserved. Immutable/system fields such as `id`, `workspaceId`, `type`, `defaultLanguage`, timestamps, `questions`, analytics, styling, and scripts are rejected. App surveys (stored `type: app`) additionally accept `distribution` and `targeting`; both are rejected for link surveys, and changing `targeting` filters requires the Contacts entitlement. `metadata`, `languages`, `welcomeCard`, `blocks`, `endings`, `hiddenFields`, and `variables` replace their full top-level value when provided. Missing ids in replaced arrays are deletions. Non-default locale keys in translatable maps must be declared in `languages`; undeclared locale keys are rejected with `unsupported_locale`. To remove a language, remove it from both `languages` and every translatable map that contains that locale key. Use `/api/v3/surveys/validate` with `operation: patch` before committing automated or agentic changes.
        - `name` string
        - `status` 'draft' | 'inProgress' | 'paused' | 'completed'
        - `metadata` SurveyMetadata — Arbitrary JSON survey context for customer- or operation-specific metadata. v3 preserves arbitrary metadata values as-is. If present, `title` and `description` are treated as translatable text maps and returned with real locale-code keys.
          - `title` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `description` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
        - `languages` CreateSurveyLanguage[] — Replaces the survey language configuration. The default language cannot be changed through PATCH; any `default: true` entry must match the existing default language. Languages referenced by `metadata`, `welcomeCard`, `blocks`, or `endings` translatable maps must be explicitly declared here, so remove the locale key from those maps as well when intentionally removing a language.
          - `code` string, required — Canonical locale code accepted by v3 survey APIs, for example `en-US`, `de-DE`, or `zh-Hans-CN`.
          - `default` boolean — Optional marker for readability; only the `defaultLanguage` entry may set this to true.
          - `enabled` boolean — Whether this language is enabled for respondent-facing delivery.
        - `welcomeCard` SurveyWelcomeCard — Optional card shown before the first survey block.
          - `enabled` boolean, required
          - `headline` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `subheader` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `buttonLabel` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `fileUrl` string
          - `videoUrl` string
          - `timeToFinish` boolean
          - `showResponseCount` boolean
        - `blocks` SurveyBlock[]
          - `id` string, cuid2, required — Stable block id.
          - `name` string, required
          - `elements` SurveyElement[], required
            - union — Survey element/question inside a block. Element ids are stable public identifiers used by logic, recall strings, response data, quotas, integrations, and analysis. `type` selects the allowed shape; unsupported fields are rejected instead of ignored.
              - …
          - `logic` SurveyBlockLogic[]
            - `id` string, cuid2, required
            - `conditions` SurveyConditionGroup, required
              - …
            - `actions` SurveyLogicAction[], required
              - …
          - `logicFallback` string, cuid2 — Block or ending id used when no logic condition matches. Only valid when this same block has at least one `logic` rule; omit it for normal sequential flow.
          - `buttonLabel` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
          - `backButtonLabel` TranslatableText — Multilingual text map keyed by the emitted `languages[].code` values for this survey.
        - `endings` SurveyEnding[]
          - union — Ending reached after the last block or a jump action. `type` selects the allowed shape; unsupported fields are rejected instead of ignored.
            - SurveyEndScreenEnding — Visual end screen displayed after survey completion.
              - …
            - SurveyRedirectEnding — Redirects the respondent to a URL after survey completion. External redirects require the organization's external URL permission; otherwise write endpoints return `403 Forbidden`.
              - …
        - `hiddenFields` SurveyHiddenFields — Hidden fields, sometimes called embedded data in other survey products. Field ids are stable public identifiers and may be referenced by logic, recall, quotas, integrations, and response data. Use only letters, numbers, underscores, and hyphens; avoid spaces and reserved ids.
          - `enabled` boolean, required
          - `fieldIds` string[]
        - `variables` SurveyVariable[]
          - union — Survey variable. Variable ids are stable references used by logic and calculation actions. Variable names are human-readable labels and must be unique within the survey.
            - SurveyNumberVariable — Number variable. Used by `calculate` logic actions with numeric operators such as `add`, `subtract`, `multiply`, `divide`, or `assign`.
              - …
            - SurveyTextVariable — Text variable. Used by `calculate` logic actions with text operators such as `assign` or `concat`.
              - …
        - `distribution` SurveyDistribution — App-survey runtime/display settings. Only valid for `type: app`; rejected for link surveys. **Replacement semantics (destructive):** when `distribution` is provided on PATCH it fully replaces the stored object — any sub-field you omit is reset to its default, NOT preserved. In particular, omitting `triggers` removes ALL existing triggers, and omitting `displayOption` resets it to `displayOnce`. To change one setting, send the complete desired distribution. To leave distribution untouched, omit the whole `distribution` key.
          - `displayOption` 'displayOnce' | 'displayMultiple' | 'respondMultiple' | 'displaySome' — How often the survey may be shown to a contact. `displaySome` shows it up to `displayLimit` times (or until the contact responds, whichever comes first).
          - `displayPercentage` number, nullable — Independent throttle: show the survey to only this percentage of triggered contacts. Optional and valid with any `displayOption`; null/omitted means no throttle (shown to everyone).
          - `displayLimit` integer, nullable — Maximum number of times the survey is shown to a single contact. Required (must be >= 1) when `displayOption` is `displaySome`; otherwise optional.
          - `recontactDays` integer, nullable — Days to wait before showing this survey again to the same contact. Null uses the workspace default.
          - `autoClose` integer, nullable — Seconds of inactivity after which the survey widget auto-closes. Null disables auto-close.
          - `autoComplete` integer, nullable — Automatically stop collecting responses after this many completed responses. Null disables it.
          - `delay` integer — Seconds to wait after a trigger fires before showing the survey.
          - `triggers` SurveyTrigger[] — Action classes that trigger the survey. Every id must reference an existing workspace action class. On PATCH this list fully replaces the survey's triggers — omitting it (or sending `[]`) removes all existing triggers.
            - `actionClassId` string, cuid2, required — Id of an action class in the same workspace.
        - `targeting` SurveyTargeting — App-survey contact targeting. Only valid for `type: app`. `filters: []` targets everyone. Setting or changing non-empty filters requires the Contacts entitlement; otherwise create/patch returns 403. `attribute` filters reference workspace contact-attribute keys (discover them via `GET /api/v3/contact-attribute-keys`) and `segment` filters reference other segment ids — both are workspace-scoped resources you must obtain before constructing filters (an invalid key/id targets no one rather than erroring). See `SegmentFilter` for the per-`root.type` operator sets.
          - `filters` object[], required — Contact targeting filter tree. An empty array targets everyone. Each node joins the previous one via its `connector` (`and`/`or`; the first node's connector is null). A node's `resource` is either a single filter condition or a nested filter group (enabling parenthesized `and`/`or` logic).
            - `id` string, cuid2, required
            - `connector` 'and' | 'or' | 'null', nullable, required — Logical connector joining this node to the previous one. Null for the first node.
            - `resource` union, required — A single filter condition, or a nested filter group for grouped logic.
              - …
      - object

## Response `200`

Validation completed. The survey document may still be invalid.

- object
  - `data` SurveyValidationResult, required
    - `valid` boolean, required — Whether the submitted survey document is valid.
    - `operation` 'create' | 'patch', required
    - `invalid_params` InvalidParam[], required — Repairable validation errors using document-relative paths.
      - `name` string, required — Dot-path to the invalid request field.
      - `reason` string, required — Human-readable repair guidance.
      - `code` 'dangling_reference' | 'duplicate_identifier' | 'duplicate_locale' | 'forbidden_identifier' | 'immutable_identifier' | 'invalid_graph' | 'invalid_locale' | 'invalid_reference' | 'missing_required_field' | 'missing_translation' | 'unsupported_field' | 'unsupported_locale' — Machine-readable validation category, when available. `invalid_graph` covers workflow graph-structure violations such as a duplicated trigger edge, an unreachable node, or a cycle.
      - `identifier` string — Identifier involved in the validation failure, when available. For language errors, this can be the normalized language code.
      - `referenceType` 'block' | 'element' | 'ending' | 'hiddenField' | 'language' | 'variable' | 'variableName' | 'recall' | 'node' | 'edge' | 'survey' | 'endingCard' — Identifier namespace involved in the validation failure. `node`, `edge`, `survey`, and `endingCard` are used by workflow validation.
      - `missingId` string — Referenced id that does not exist in the submitted survey document.
      - `firstUsedAt` string — Dot-path where a duplicate identifier was first used.
      - `conflictsWith` string — Dot-path to the existing identifier that conflicts with this field.
    - `languages` SurveyValidationLanguage[] — Languages that a successful write would connect or create. Present only when `valid=true`.
      - `code` string, required — Canonical locale code accepted by v3 survey APIs, for example `en-US`, `de-DE`, or `zh-Hans-CN`.
      - `default` boolean, required
      - `enabled` boolean, required
      - `writeBehavior` 'connect_or_create', required — Validation is read-only; a real write would connect an existing language or create it if missing.

## Other responses

- `400` — Malformed validation envelope, invalid route/query data, or unsupported operation
- `401` — Not authenticated (no valid session or API key).
- `403` — Forbidden — no workspace access, or resource does not exist (404 not used; avoids existence leak).
- `429` — Rate limit exceeded.
- `500` — Internal Server Error.

## Changes

- **2026-08-04** `aa2a946d376d` — 5 warning
  - added the new `service_unavailable` enum value to the `code` response property for the response status `400`
  - added the new `service_unavailable` enum value to the `code` response property for the response status `401`
  - added the new `service_unavailable` enum value to the `code` response property for the response status `403`
  - added the new `service_unavailable` enum value to the `code` response property for the response status `429`
  - …1 more
- **2026-07-31** `252a618df054` — 45 warning
  - added the new `conflict` enum value to the `code` response property for the response status `400`
  - added the new `conflict` enum value to the `code` response property for the response status `401`
  - added the new `conflict` enum value to the `code` response property for the response status `403`
  - added the new `conflict` enum value to the `code` response property for the response status `429`
  - …41 more
- **2026-07-30** `9010a37ad024` — 5 warning
  - added the new `ai_output_too_long` enum value to the `code` response property for the response status `400`
  - added the new `ai_output_too_long` enum value to the `code` response property for the response status `401`
  - added the new `ai_output_too_long` enum value to the `code` response property for the response status `403`
  - added the new `ai_output_too_long` enum value to the `code` response property for the response status `429`
  - …1 more
- …earlier changes not shown

[Full history](https://skmtc.dev/formbricks/apis/formbricks-api-v3/changes/api/v3/surveys/validate/post.md)

---

[API](https://skmtc.dev/formbricks/apis/formbricks-api-v3.md) · [All operations](https://skmtc.dev/formbricks/apis/formbricks-api-v3/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/formbricks/formbricks-api-v3/revisions/3c2c022e49d2/schema)
