API Testing · Testing APIs by Hand

What to Test in an API: A Complete Checklist

Lesson 4 of 7 · 11 min read

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-Type is correct.
  • Security headers and CORS are set as the team expects.

4. Negative tests

TestExpected
Missing required field400 with the field name in the message
Wrong type ("quantity": "two")400
Empty string, only spaces, very long text400, or saved safely
Invalid email or date format400
Unknown id404
Malformed JSON400, 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

IDTestExpected
API-01Valid title, body and userId201, body echoes the data plus a new id
API-02Missing title400, message names "title"
API-03userId that does not exist400 or 404
API-04Title of 10,000 characters400 or saved without error
API-05No auth token (on a real API)401
API-06Body is not valid JSON400, never 500
Template: write these in the free test case template and report what you find with the bug report generator.
All 7 lessons in API Testing
  1. What Is API Testing?
  2. HTTP Basics for Testers: Methods, Status Codes, Headers
  3. API Testing with Postman, Step by Step
  4. What to Test in an API: A Complete Checklist
  5. Testing API Authentication: API Keys, Tokens and OAuth
  6. Automate API Tests with REST Assured (Java)
  7. API Test Framework Structure and CI