API Tests
API tests exercise your application's endpoints directly, without a browser. Import an OpenAPI specification, let TestFlair generate tests from your user stories, then refine the requests, assertions and scripting in the editor.
API Tests is a Beta feature and may not be visible on every account. Contact your workspace admin or [email protected] if you'd like access.
Importing an OpenAPI Specification
TestFlair reads your endpoints from an OpenAPI spec rather than asking you to type them in.
- Open your project and go to the API Tests tab
- Click Import OpenAPI
- Provide your specification
- Give the version a label and confirm the base URL requests should be sent to
- Click Import
Endpoints are organised into groups, and each carries its method — GET, POST, PUT, DELETE or PATCH.
Specs are versioned. Importing again creates a new version with its own label and base URL rather than overwriting the previous one, so you can keep tests pointed at an older contract while a new one is reviewed.
Generating API Tests
Generation is a two-step wizard:
- Click Generate API Tests
- Select user stories — the requirements the tests should cover
- Select endpoints — which imported endpoints are in scope
- Click Generate
Generation consumes Flairs. Check your balance under Settings → Usage.
Generated tests are marked with a source of AI. Tests you create yourself are marked Manual.
How an API Test is Organised
A test has settings of its own, and a list of steps. Both levels can carry variables, headers, scripts and assertions — settings at the test level apply across every step.
| Level | What you can set |
|---|---|
| Test | Test variables, headers, a pre-request script, a post-request script, assertions |
| Step | The endpoint it calls, variables, query parameters, headers, request body, assertions, a pre-request script, a post-request script |
Variables are key/value pairs. Ones produced during generation are labelled AI generated; ones you add are Custom.
Classification
| Field | Values |
|---|---|
| Category | Positive, Negative, Edge |
| Type | Functional, E2E |
| Priority | Low, Medium, High |
A test can also be linked to one or more user stories, and assigned to a team member.
Working with the List
The API Tests list supports search, filters and stat cards summarising the suite. From it you can:
- Duplicate tests, individually or in bulk — useful for building a negative case from a positive one
- Delete tests, individually or in bulk
- Export to Excel for sharing outside the platform
The Editor
Open a test to edit it. The editor gives you the test-level settings, the ordered list of steps, and per-step request detail. Use the maximize control when you are working on a long body or script and want the full window.
Comments are available on an API test, so you can discuss it with your team in place. See Collaboration.
Troubleshooting
My import was rejected
- The specification must be valid OpenAPI. Validate it before importing — a spec that a viewer renders may still be missing fields TestFlair needs.
Generation produced no tests
- Check that the user stories you selected actually describe behaviour the selected endpoints cover. Generation works from the requirement text, so vague stories produce little.
Requests are going to the wrong host
- The base URL belongs to the spec version. Re-check it on the version you imported, and confirm you are working against the version you think you are.
Next Steps
- User Stories — The requirements API tests are generated from
- Test Cases — Browser-level test cases for the same project
- Collaboration — Comment on an API test with your team
- Settings — Check your Flair balance and usage