When to use it
Use template assertions for checks that should always be true for this endpoint regardless of context: the response status code should be200, the response body should always include an id field, a specific header must be present. These are structural expectations about the endpoint itself, not about a particular journey’s behavior.
If an assertion is specific to one journey’s flow — for example, “the returned balance should be greater than the amount passed in the previous step” — put it on the step instead.
Key concepts
- Template-level vs. step-level assertions — template assertions are inherited by every step that uses the template. Step assertions are local to that step in that journey. Both run during execution.
- Inheritance — when a step uses a template, its assertions combine with any step-level assertions you’ve added. Template assertions run first.
- Shared enforcement — a template assertion enforces a consistent baseline across all journeys. If the assertion fails anywhere, you know the endpoint itself is behaving unexpectedly, not just one workflow.
How it works
Template assertions follow the same assertion syntax as step-level assertions. You can assert on:- Status code — e.g., response status must equal
200or be in the2xxrange. - Response headers — e.g.,
Content-Typemust containapplication/json. - Response body fields — e.g.,
body.idmust be present,body.statusmust equalactive. - Response time — e.g., response must complete within 2000 ms.
Template assertions are a good place for contract-level checks — the kind of thing you’d write in an API integration test. Step assertions handle behavior that depends on the journey’s specific values and flow.
Examples
Status code and content-type assertionsPOST /v2/payments might assert:
Related pages
Step assertions
Assertions added directly to a step for journey-specific checks.
HTTP request templates
The full shape of an HTTP request template.
Assertion reference
Complete reference for all assertion types and operators.
Run mode
How assertion results appear in run output.

