Response body and headers
Use request, environment, table, and generated values inside response JSON or response headers.
- 1.Open an endpoint response variant.
- 2.Put tokens directly inside the JSON response body or header values.
- 3.Send a request with matching params, query, headers, or body fields.
- 4.Mocklify replaces each token before returning the response.
{
"id": "{{params.userId}}",
"name": "{{request.body.name}}",
"source": "{{query.source}}",
"tenant": "{{headers.x-tenant}}",
"plan": "{{env.PLAN_NAME}}",
"request": {
"path": "{{request.path}}",
"receivedAt": "{{now}}"
},
"flags": {
"beta": "{{bool:query.beta}}",
"score": "{{number:request.body.score}}"
}
}Typed tokens such as {{number:request.body.score}} and {{bool:query.beta}} are useful when the output must stay valid JSON numbers or booleans.
