Test APIs in a Flow
Call an API from a Flow, store the response as a Value, and assert JSON.
Last updated
Call an API from a Flow, store the response as a Value, and assert JSON.
API calls belong in the same Flow as your browser steps. Use them to seed data, fetch a token, assert backend state, or clean up after a UI journey.
Use the Flow Builder for this walkthrough.
A fully qualified API URL (or a Value that expands to one)
Optional credentials or tokens as Values
A Flow open in the Flow Builder
This example calls a login API, stores the JSON response, then asserts it. The same pattern works for any GET, POST, PUT, PATCH, or DELETE.
Start with Open. Point it at your application URL so the Test Case has a browser context, even when the next steps are API calls.
Add POST from the Integration family.
Set URL to the login endpoint. Use $BASE_URL plus a path when the host changes per environment.
Set Body Content-Type to JSON.
Enter a JSON body that uses Values for credentials, for example username and password from Assets.
Set Response Storage Name to something clear, such as authResponse.
For APIs that need a Bearer token or API key, open Headers on the Integration step and pass JSON such as:
{
"Authorization": "Bearer $API_TOKEN"
}Keep $API_TOKEN (or similar) in Assets → Values, or overwrite it for a Run with a Run Recipe. Integration steps read Headers you set on the step. They do not reuse browser cookies from Open.
Add Check JSON Value.
Set Input Item to the same name you stored, such as authResponse.
Choose Match Mode Contains or Equals.
Set the expected JSON with Custom, or compare against another Value Store item.
Use Check JSON Schema when you want a schema assert, or Check Value Store for a single stored field.
Pro tip: Store API hosts and secrets as Assets Values or Recipe overwrites. Keep response storage names specific (authResponse, order) so later Checks stay readable.
A finished login-token path looks like this:

Switch Method on an Integration API step to change between these without rebuilding the rest of the step.
Body (default)
Response body
Headers
Response headers
Complete
Body and headers together
The storage name must start with a letter and use only letters, numbers, and underscores.
Use the same Flow across staging and production by keeping the host in a Value:
Share data with Values for Assets Values and $ insertion
Run across environments for tags and overwrites
CI / CD to pass Value overrides from the pipeline
Check API Response Time measures how long a browser network request takes during the Test Case. It does not time Integration API steps. Use it when you care about page network performance, not when you are asserting an Integration response.
Last updated