Validate a response payload
Checks a create or patch payload and reports what a real write would do — without writing anything. Never has side effects: no response is created, no pipeline fires, nothing is metered.
Deliberately the same shape as POST /api/v3/surveys/validate: same dual auth, a request discriminated on operation carrying the body the real call would take, and a result of valid, operation and invalid_params with document-relative paths. The value is that the two endpoints behave alike, so a client can validate uniformly. Answers are checked against the survey’s own validation rules, so a payload this endpoint accepts is one the real write accepts.
It reports effects, not just a verdict. When valid is true, effects names the language that would be stamped, the contact and display that would be linked, the quotas that would count, whether the pipeline would fire, and whether the write would be metered. The language is the field that motivated this endpoint: an importer can see that a payload produces language-less responses before writing thousands of them.
Authorization is the same as the operation being validated — read-write for create and patch — so this cannot be used as a cheaper cross-tenant existence probe than the write itself. An inaccessible responseId on a patch validation answers 403, as the patch would.
What it does not do: an endpoint lets a caller check; it cannot stop a caller writing a bad record anyway. Consistency across the write paths comes from all of them calling the same validator — this endpoint is that validator’s public face, not a gate in front of it.
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
- Option 1
- Option 2
create Intended create payload, checked against CreateResponseRequest by the operation rather than by this envelope. Any JSON value is accepted here so the endpoint can return repairable validation errors: a document that is not an object, or that breaks CreateResponseRequest, is a 200 with valid: false, not a 400. Only the request limits come first: an array past its budget, or nesting past 256 levels, is a 400 for any request.
Response
Validation completed. A 200 means the check ran, not that the payload is valid — read valid.
Outcome of a dry-run validation. Deliberately the same shape as SurveyValidationResult — the value of this endpoint is that the two behave alike, so a client can treat validation uniformly.
Answers are checked against the survey's own validation rules (SurveyValidationRule) rather than a parallel rule set, so a payload this endpoint accepts is a payload the real write accepts.
Show child attributes
Show child attributes
Was this page helpful?