API Security Testing: A Complete Guide for 2026
API security testing is the process of finding every endpoint your application exposes and then checking that each one enforces authentication, authorization, input validation and sensible limits, the way an attacker would probe it rather than the way your frontend calls it. In practice that means four things: build an inventory, map who is allowed to do what, try to break those rules with real requests across user roles, and confirm the infrastructure around the API (gateways, CORS, error handling, rate limits) isn't leaking or permitting more than it should. This guide walks through each phase with concrete requests you can run against your own staging environment.
Most of the serious API bugs found in pentests and bug bounty programs aren't exotic. They're a missing ownership check on GET /api/invoices/{id}, a role field the server happily accepts on PATCH /api/users/me, or a v1 endpoint nobody remembered was still routed. Scanners are good at some of these and blind to others, which is why the method matters more than the tool.
Why API security testing is different from web app testing
A traditional web app test follows pages and forms. An API has no pages. The frontend only calls a subset of what the backend exposes, and the server trusts the client to send object IDs, filters and property names. That shifts the risk profile toward authorization, which is why Broken Object Level Authorization sits at API1 in the OWASP API Security Top 10 (2023). OWASP rates BOLA as easy to exploit and widespread because the server "usually does not fully track the client's state, and instead, relies more on parameters like object IDs" (OWASP API1:2023).
If you want the category-by-category breakdown, read our companion piece, OWASP API Security Top 10 Explained with Real Testing Examples. This guide focuses on the workflow.
Phase 1: Build the endpoint inventory
You can't test what you don't know exists. Start by collecting endpoints from every source you have, then reconcile them:
- Your spec. OpenAPI/Swagger files, Postman collections, GraphQL schemas. Treat them as a starting point, not the truth.
- Traffic. Proxy the web and mobile clients through Burp Suite or OWASP ZAP and click through every feature as each role. Export the observed requests.
- Client code. JavaScript bundles and mobile binaries contain route strings and sometimes keys. Our JS Secrets Scanner pulls API keys and secret endpoints out of served bundles.
- Common paths. Check for exposed docs and debug routes such as
/swagger.json,/openapi.json,/api-docs,/graphqland/actuator. - Old versions and other hosts.
api-v1.,staging-api.,/v1/next to/v2/. OWASP's API9:2023 Improper Inventory Management describes a beta host that ran the same password-reset API without the rate limiting production had.
The gap between "what the spec says" and "what actually responds" is where shadow APIs live. We cover that process in depth in How to Find Shadow and Undocumented APIs Before Attackers Do. For an automated first pass, the API Endpoint Discovery scanner enumerates REST and GraphQL endpoints and hidden routes on a domain you've verified.
Phase 2: Map authentication and authorization
Before sending a single attack payload, write down the access model. A simple matrix is enough:
| Endpoint | Anonymous | User (own data) | User (other tenant) | Admin |
|---|---|---|---|---|
GET /api/projects/{id} | 401 | 200 | must be 403/404 | 200 |
PATCH /api/users/{id} | 401 | 200 (limited fields) | must be 403/404 | 200 |
POST /api/admin/invites | 401 | must be 403 | must be 403 | 201 |
GET /api/billing/export | 401 | 200 (own org) | must be 403/404 | 200 |
The bold cells are your test cases. You need at least two accounts per role in two separate tenants to fill them in. Without them you're running an unauthenticated test, which is useful but misses most of the high-severity API bugs. (See Authenticated vs Unauthenticated Penetration Testing for what each one covers.)
Authentication checks
- Does every endpoint reject missing, expired and malformed tokens? Test with no
Authorizationheader, a token from a deleted user and a token with a tampered signature. - For JWTs: is
algenforced server-side? Areexpandaudvalidated? - Are login, password reset and OTP endpoints rate limited per account, not just per IP?
- Do refresh tokens get revoked on logout and password change?
Phase 3: Test authorization with real requests
This is where most of your time should go. The technique is simple: capture a legitimate request as User A, then replay it with User B's credentials, changing only the identity.
# As user A (tenant 1), fetch your own object
curl -s https://staging.example.com/api/projects/8812 \
-H "Authorization: Bearer $TOKEN_A"
# Same request, user B's token (tenant 2). Expect 403 or 404.
curl -s -o /dev/null -w "%{http_code}\n" \
https://staging.example.com/api/projects/8812 \
-H "Authorization: Bearer $TOKEN_B"
A 200 with A's data is a BOLA finding. Repeat it for every verb (GET, PUT, PATCH, DELETE), not just reads. Teams often protect GET and forget DELETE.
Object property checks (mass assignment and over-exposure)
Look at what the API returns and what it accepts. If GET /api/users/me returns role, is_verified or org_id, try writing them back:
curl -s -X PATCH https://staging.example.com/api/users/me \
-H "Authorization: Bearer $TOKEN_A" \
-H "Content-Type: application/json" \
-d '{"display_name":"test","role":"admin"}'
Then re-fetch the user and see whether role changed. OWASP groups both reading too many properties and writing ones you shouldn't under API3:2023 Broken Object Property Level Authorization, and recommends avoiding generic serializers like to_json() in favor of explicitly chosen fields.
Function-level checks
Take every admin request you captured and replay it with a regular user's token. Also try predictable siblings: if you see GET /api/users, try GET /api/admin/users. Change methods too; a read-only route sometimes accepts PUT.
Phase 4: Inputs, limits and injection
Once access control is mapped, test what the API does with hostile data:
- Type confusion: send arrays where strings are expected, nested objects where IDs are expected, negative and huge numbers.
- Injection: SQL, NoSQL operators (
{"$ne": null}), and command injection in any field that reaches a shell or query. - SSRF: any parameter that takes a URL (webhooks, avatar import, PDF rendering). Point it at a server you control and check whether internal addresses are blocked. This is API7:2023.
- Resource limits: large
limit/page_sizevalues, huge uploads and expensive endpoints called in loops. OWASP's API4:2023 lists the limits to look for, including records per page and third-party spending limits (think SMS and email sends).
If your API is GraphQL, add introspection, alias batching and query-depth tests. Those are covered in GraphQL Security Testing: Introspection, Batching and Authorization Flaws.
Phase 5: Business logic
No scanner understands that a coupon should apply once, or that a refund shouldn't exceed the original charge. Write down the three or four flows that move money or grant access (signup, invite, checkout, refund, plan upgrade) and ask "what if I skip a step, repeat a step or run it 50 times in parallel?" OWASP calls this API6:2023 Unrestricted Access to Sensitive Business Flows and notes it "doesn't necessarily come from implementation bugs."
Phase 6: Configuration around the API
- CORS: does the API reflect arbitrary
Originvalues withAccess-Control-Allow-Credentials: true? - Errors: do 500s return stack traces, SQL fragments or internal hostnames?
- TLS and headers: our SSL/TLS misconfiguration checklist covers the transport side.
- Exposed tooling: Swagger UI, GraphiQL and actuator endpoints reachable in production.
What automated tools catch vs. what needs a human
| Test area | Automated scanning | Manual or agent-driven testing |
|---|---|---|
| Endpoint discovery, exposed docs | Strong | Confirms what matters |
| Known CVEs, misconfigured headers/TLS | Strong | Rarely needed |
| Injection in obvious parameters | Good | Finds context-specific cases |
| BOLA / IDOR across tenants | Weak without multiple accounts | Strong |
| Mass assignment | Partial | Strong |
| Business-logic abuse | Very weak | Required |
The practical approach is to run automated checks continuously so regressions surface quickly, and do deeper authenticated testing before major releases and audits. Our Automated vs Manual Penetration Testing post goes deeper on that split.
A minimal API security testing checklist
- Inventory every host, version and endpoint, including staging and deprecated ones.
- Remove or protect public Swagger/GraphiQL/actuator routes.
- Build an authorization matrix with two tenants and every role.
- Replay every object-ID request across tenants, for every HTTP method.
- Try writing every returned property back.
- Replay admin requests as a normal user.
- Fuzz types, inject into every parameter, and test URL parameters for SSRF.
- Push pagination, upload size and per-account rate limits.
- Abuse the money and access flows: skip, repeat, race.
- Check CORS, error verbosity and TLS.
Where SecurityInfinity fits
SecurityInfinity's agents run recon, web, network and secrets checks against domains you've verified you own, read-only, and pivot on what they find. Each finding comes with evidence and remediation, ordered by severity. The quick web scan is free, and the Starter plan on /pricing gives you 100 credits with no card. When you need deeper coverage for a customer or auditor, the Authenticated Startup Pentest (from $999 per application) covers every user role and includes access-control, IDOR, business-logic, API and privilege-escalation testing, with a signed attestation letter and a free retest within 30 days.
If you have an enterprise deal or SOC 2 audit coming up, start a scan on your API domain today and fix the easy findings before the formal test.
Frequently asked questions
What is API security testing?
API security testing is checking every exposed API endpoint for flaws in authentication, authorization, input handling, resource limits and configuration. Testers send requests directly to the API instead of going through the UI, so they find issues the frontend hides, like other users' records being returned when an ID is changed.
What are the most common API vulnerabilities?
Broken object level authorization (IDOR), broken authentication and broken object property level authorization take the top three spots in the OWASP API Security Top 10 2023. Missing rate limits, function-level authorization flaws, SSRF and forgotten API versions are also common.
Can API security testing be fully automated?
Partly. Automated tools handle discovery, known vulnerabilities, misconfigurations and many injection cases well. Cross-tenant authorization and business-logic flaws need multiple authenticated accounts and an understanding of what the application should allow, so they need manual testing or an agent that can reason about context.
How often should you test API security?
Run automated checks continuously or on every deploy, because new endpoints ship constantly. Do a deeper authenticated test at least annually and before major releases, audits or large customer reviews. Our guide on how often to pentest covers this in more detail.
What tools are used for API security testing?
Common choices include intercepting proxies such as Burp Suite and OWASP ZAP for manual testing, content-discovery tools such as Kiterunner for finding routes, and GraphQL-specific tools for schema analysis. A platform like SecurityInfinity combines discovery, scanning and reporting for domains you've verified.