const url = 'https://platform.fomr.io/v1/forms/example/simulate';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"answers":{},"hidden_values":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://platform.fomr.io/v1/forms/example/simulate \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "answers": {}, "hidden_values": {} }'Walks one test response through the stored draft with the same logic engine respondents run, and answers the pages the respondent would see in order, the ending they reach, the Calculated values, and any redirect. Nothing is written and no submission is created. Answers are keyed by question public ID; a choice answer is the option value. An unknown question, option, or Hidden Value key is refused with 400 INVALID_INPUT at its path. A draft that is not ready to publish is refused with 422 and the same Publish Issues validate returns. Needs forms:read or templates:read. Costs 1 API credit.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The public ID of the form or Private Template.
Request Body
Section titled “Request Body”object
Test answers keyed by question public ID, in the shape a submission stores them. A choice answer is the option value, or an array of values for a multi-select. Leave a question out to treat it as unanswered.
object
object
The stable option value stored by the form.
The option label captured with the answer.
object
The stable option value stored by the form.
The option label captured with the answer.
object
Always file for a file answer.
The public ID of the uploaded file.
The original file name.
The file size in bytes.
The detected media type of the file.
A signed download URL that expires after five minutes.
Test Hidden Values keyed by their declared key, as if they came from the link.
object
Responses
Section titled “Responses”Default Response
object
Every page the respondent sees with these answers, from the first page to the ending, in order.
object
A page the respondent sees, in the order they see it.
Blocks on this page that logic hides for these answers.
Required questions on this page that the test answers leave empty. A real respondent must answer them to continue.
Example generated
{ "pages": [ { "page_public_id": "example", "hidden_node_public_ids": [ "example" ], "unanswered_required_node_public_ids": [ "example" ] } ], "ending_page_public_id": "example", "calculated_values": { "additionalProperty": 1 }, "redirect_url": "example"}Default Response
object
The stable code to branch on.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
Every value the request got wrong.
object
The path into the request, with property names and numeric array indexes.
What is wrong with the value at this path.
The stable code for the issue. Branch on it, and use it with params to write your own text.
Accepted values when a node type or enum value is rejected.
Example
{ "code": "INVALID_INPUT"}Default Response
object
The stable code to branch on.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
Example
{ "code": "INVALID_INPUT"}Default Response
object
The stable code to branch on.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
Example
{ "code": "INVALID_INPUT"}Default Response
object
Returned for a form that does not exist, is in Trash, or belongs to another organization. The three are not told apart.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
Example
{ "code": "NOT_FOUND"}A form that cannot be published as it stands: it is archived, or it holds no draft. Branch on code.
object
The form is archived: it has no editable draft, so draft writes, publish, and conversion are refused.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
object
The form has no draft version to publish.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
Example
{ "code": "FORM_ARCHIVED"}Default Response
object
The draft is not complete enough to publish. Nothing was written.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
Every Publish Issue that blocked the publish. The same list validate returns.
object
The stable Publish Issue code to branch on. Besides the draft checks, validate reports FORM_PUBLISH_EMAIL_UNVERIFIED, FORM_SAFETY_REJECTED, and PRO_FEATURE_REQUIRED for what publish would refuse. New codes are added over time.
What to fix, in words. Not part of the contract; never branch on it.
The path into the Draft Document, with property names and numeric array indexes, such as [“pages”, 1, “nodes”, 0, “meta”, “select_options_data”]. Empty when the issue is about the form as a whole.
Example
{ "code": "FORM_PUBLISH_VALIDATION_FAILED", "issues": [ { "code": "FORM_PUBLISH_DRAFT_INVALID" } ]}A rejected call. The organization budget names the policy it rejected the call under; the request floor that bounds hammering sends the envelope alone.
object
The stable code to branch on.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
The API Limit window that rejected the call.
The plan whose numbers were applied.
The policy limit in credits.
Credits already spent in the open window.
Credits still available under the policy.
What the rejected call would have cost.
How long the policy window lasts.
When the window that rejected the call ends.
Seconds to wait before retrying. Also sent as the Retry-After response header.
object
The stable code to branch on.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
Example
{ "code": "INVALID_INPUT", "policy": "15m", "plan": "free"}Default Response
object
The stable code to branch on.
A human-readable explanation. Not part of the contract; never branch on it.
The ID of the failed request, also sent as the X-Request-Id response header.
Example
{ "code": "INVALID_INPUT"}