What to Test in an API: A Complete Checklist
Sending a request and seeing 200 OK is not testing. A good API tester checks everything the endpoint promises, and what happens when a client breaks the rules. Use this checklist for every endpoint.
1. Status code
- The exact code is right: 201 for create, not just "any 2xx".
- Errors return 4xx with a helpful message, never 500.
2. Response body
- All required fields are there, with the right types (number, string, boolean, array).
- Values are correct, not just present. A created record returns what you sent.
- No sensitive data leaks, such as password hashes or other users' emails.
- Lists: paging, sorting and filters work, and an empty result is
[], not an error.
3. Headers
Content-Typeis correct.- Security headers and CORS are set as the team expects.
4. Negative tests
| Test | Expected |
|---|---|
| Missing required field | 400 with the field name in the message |
Wrong type ("quantity": "two") | 400 |
| Empty string, only spaces, very long text | 400, or saved safely |
| Invalid email or date format | 400 |
| Unknown id | 404 |
| Malformed JSON | 400, not 500 |
| Wrong method (DELETE on a read-only endpoint) | 405 |
| Duplicate (same email twice) | 409 |
5. Boundaries
If quantity must be 1 to 10, send 0, 1, 10 and 11. Use the same boundary value analysis you use for UI fields. The API must enforce the rule even if the UI already does, because anyone can call the API directly.
6. Authentication and authorisation
- No token returns 401.
- An expired or edited token returns 401.
- User A cannot read or change user B's data by changing the id in the URL. It should return 403 or 404. This bug (called IDOR) is one of the most common security bugs.
- A normal user cannot call admin endpoints.
7. Business rules and data
- After a POST, a GET returns the new record. After a DELETE, a GET returns 404.
- Side effects happen: stock goes down after an order, an email is queued.
- Calling the same PUT or DELETE twice gives the same end result (idempotency).
8. Performance basics
- Response time is within the agreed limit, for example under 500 ms.
- Large lists are paged and do not return 10,000 records at once.
- The rate limit returns 429, not a crash.
Example: test cases for POST /posts
| ID | Test | Expected |
|---|---|---|
| API-01 | Valid title, body and userId | 201, body echoes the data plus a new id |
| API-02 | Missing title | 400, message names "title" |
| API-03 | userId that does not exist | 400 or 404 |
| API-04 | Title of 10,000 characters | 400 or saved without error |
| API-05 | No auth token (on a real API) | 401 |
| API-06 | Body is not valid JSON | 400, never 500 |
Template: write these in the free test case template and report what you find with the bug report generator.