Overview
The Make an API Call step lets a test hit a backend HTTP endpoint directly, without going through the UI. Use it to:- Set up state before the UI test runs (create a user, seed data, reset an account)
- Assert on a backend response (status code, returned data)
- Extract a value — such as an auth token — and reuse it in later steps
How to access
- Type
/in an empty test step to open the shortcuts menu - Select Make an API Call
- Fill in the request using the structured editor (you don’t write the request by hand)
Request fields
| Field | Description |
|---|---|
| Method | GET or POST |
| URL | The endpoint to call. Supports {{variables}}. |
| Headers | Add request headers. Choose an environment header/secret (resolved automatically by name at run time) or type a hardcoded header. Values support {{variables}}. |
| Query Params | Key/value pairs appended to the URL. Values support {{variables}}. |
| Body | Request body for POST, entered as JSON. |
| Expect Status | The status code(s) that count as success — a single code or a comma-separated list. Defaults to 200, 201, 202, 204. The step fails if the response status isn’t in this set. |
| Save Response To | A variable name to store the response in, so later steps can reference it. |
Using variables and secrets
- Template variables — reference values from earlier steps (e.g. extractions, scenario
data, a saved response) anywhere that supports
{{variables}}: the URL, header values, query params, and body. - Environment headers & secrets — pick a header from your environment in the Headers
picker and it’s resolved automatically by name at run time (you don’t need a
{{...}}template for it). This keeps secrets like API keys out of the test definition. - Reading fields from a saved response — when you Save Response To a variable, you
can reach into the JSON with a dotted path, including array indices:
{{loginResponse.token}},{{loginResponse.user.id}},{{searchResults.items.0.name}}.
Examples
GET and save a token, then reuse itWorking with JavaScript steps
A response you Save Response To is also available to JavaScript steps aswindow.env.<name> — holding the raw
response text. This lets you parse a payload, pull out the value you actually need,
and save that for later steps. It’s the standard way to extract something buried in a
JSON response — an email’s id, a token, or an item from a list.
The pattern is three steps:
1. API Call — fetch and save the payload
return the value
Read window.env.inboxData, run your logic, and return the result. Use save: to
store the returned value under a name:
save:emailMsgId
emailMsgId):
{{emailMsgId}} in any later step (a UI step, or
another API Call):
window.env.<name> is the raw response text, so JSON.parse() it before reading
fields. Throwing inside the script (throw new Error(...)) fails the step — handy as an
assertion when the expected data isn’t present.Notes
Only
GET and POST are supported.