What Can You Do With API Calls?
- Fetch test data or credentials from your backend before testing UI workflows
- Authenticate via API to get tokens or sessions for protected pages
- Validate data by checking API responses match what you expect
Setup: Creating an API Call Config
API Calls are configured as Configs in your project settings. Here’s how to create one:1
Open Config Settings
Navigate to Settings → Configs in your project dashboard, then click Add config and select API Call Configuration
2
Fill the Configuration Form
You’ll see a form with these fields:
- Config Name: A descriptive name for this API configuration (e.g., “Get Test User”)
- URL: The complete API endpoint URL (e.g.,
https://api.example.com/v1/users) - Method: Select HTTP method from dropdown (GET, POST, PUT, DELETE, PATCH) - defaults to GET
- Headers: A textarea where you paste JSON with HTTP headers
- Body: A textarea where you paste JSON for POST/PUT/PATCH request bodies
3
Save and Assign to Tests
Click Save to create the configuration, then assign it to your test cases under test Settings → Configs
The Headers and Body fields are textareas where you paste JSON strings (such as from the examples below). The UI will validate that your JSON is properly formatted before saving.
Configuration Examples
Example 1: GET Request with Authentication
This example shows how to fetch user data with an API key. Fill the form fields:| Field | Enter This |
|---|---|
| Config Name | Get User Data |
| URL | https://api.example.com/v1/users/123 |
| Method | Select GET from dropdown |
Understanding the Headers field
Understanding the Headers field
The Headers field is a textarea where you paste a JSON object. Each key-value pair becomes an HTTP header in the request.Common headers:
Authorization: For API keys, bearer tokens, or basic authContent-Type: Usuallyapplication/jsonfor JSON APIsAccept: Tells the API what format you want back- Custom headers: Any header your API requires (e.g.,
X-API-Key,X-Tenant-ID)
Example 2: POST Request with Body
This example shows how to send data to your API (e.g., creating a new user, submitting a form, or posting a record). Fill the form fields:| Field | Enter This |
|---|---|
| Config Name | Create Test User |
| URL | https://api.example.com/v1/users |
| Method | Select POST from dropdown |
The Body field is only used for POST, PUT, and PATCH requests. It’s ignored for GET and DELETE.
Example 3: Minimal Configuration
If your test needs to check whether an API endpoint is responding (e.g., verify your backend is up before testing UI features), you only need URL and method:| Field | Enter This |
|---|---|
| Config Name | Health Check |
| URL | https://api.example.com/health |
| Method | GET |
{"status": "ok"}), and can verify the service is available before proceeding with UI interactions.
How It Works
Once you create and assign an API Call config to a test:- The agent detects the config is available
- During the test, the agent makes the HTTP request
- The agent receives the response (status code, headers, and data)
- The agent uses the response to continue the test
The agent can only make API calls if you’ve assigned an API Call config to the test under Settings → Configs.
Overriding Config Values in Test Steps
Why override? If you need to call the same API with different parameters in different test steps (e.g., fetching different user IDs, different query parameters, or different request bodies), you can override values without creating multiple configs. Example scenario: You have one “Get User” config, but your test needs to fetch multiple users. Your base configuration:- URL:
https://api.example.com/users - Method:
GET - Headers:
{"Authorization": "Bearer token123"}
- Step 1: “Call the API with URL
https://api.example.com/users/123” → Fetches user 123 - Step 2: “Call the API with URL
https://api.example.com/users/456” → Fetches user 456
Response Format & Using Response Data
The agent receives API responses in this format:- Status Code: HTTP status (200, 404, 500, etc.)
- Status Text: Status message (“OK”, “Not Found”, etc.)
- Data: Parsed JSON response body (or raw text for non-JSON responses)
- Headers: All response headers are captured and available
What the Agent Does With Responses
The AI agent can use the API response data to continue the test workflow: Example 1: Use response data in the browser- API returns:
{"email": "[email protected]", "password": "temp123"} - Agent extracts the email and password from the response
- Agent then enters these credentials into the login form in the browser
- API returns:
{"orderId": "ORD-456", "status": "pending"} - Agent checks that the order was created successfully (status code 200)
- Agent can verify the orderId exists and status is correct
- Then proceeds with the rest of the test
- API returns:
{"statusCode": 404, "statusText": "Not Found"} - Agent detects the failure and reports it in the test results
- Test can fail if the expected API is not available
Limitations
- API calls do not respect SSH Tunnel Proxy and instead go directly from our servers, not through your SSH tunnel.
- Headers and request bodies must be manually configured (no variables or templating)
- Failed requests are not automatically retried
- APIs must be publicly accessible or allow QA.tech IPs
Related Documentation
- Configs Overview - How to create and manage configs
- IP Access Control - Whitelist QA.tech IPs if needed
- SSH Tunnel Proxy - Understanding the SSH tunnel limitation