QuantaAPI
Dashboard
Guides

Response

Write the JSON the endpoint returns, and use template variables to make it change on every request.

JSON editor
4 min read

Open the Response tab to edit the stored body. The editor validates JSON as you type and shows whether the document is valid.

Editing the response

  • Format re-indents the JSON. It requires valid syntax.
  • Reset discards unsaved edits and restores the last saved body.
  • Save changes stores the body. It stays disabled while the JSON is invalid or unchanged.
The root must be an objectThe body is stored as a JSON object. A top-level array, string, or number is not accepted.

A new endpoint starts with { "message": "{{message}}", "statusCode": 200 }. The statusCode property is ordinary data. The HTTP status is decided separately by validation and error simulation.

Template variables

Write a token anywhere in the body. It is replaced when the request is served.

TOKENDESCRIPTIONEXAMPLE
{{message}}Result messageSuccess
{{status_code}}Resulting HTTP status code200
{{success}}Whether the request succeededtrue
{{latency}}Configured latency in milliseconds20
{{url}}Endpoint path that was called/users

When a token is the entire value, the real type is preserved. "ok": {{success}} becomes a boolean, and "status": {{status_code}} becomes a number. When a token is embedded in a longer string, it is inserted as text.

Type-preserving and embedded usage
{
  "ok": {{success}},
  "status": {{status_code}},
  "latency_ms": {{latency}},
  "path": "{{url}}",
  "message": "Request to {{url}} finished with status {{status_code}}"
}
Unquoted tokens can break JSON{{url}} resolves to a string, so it must stay inside quotes. A bare {{url}} outside quotes produces an invalid document.

Values by outcome

OUTCOME{{SUCCESS}}{{STATUS_CODE}}{{MESSAGE}}
Valid requesttrue200Success
Validation failurefalse400Joined validation messages
Simulated errorfalsePool entry statusPool entry message

Because the same template is used for every outcome, keep it tolerant: do not assume a success-only shape, and do not encode success values in the key names.