API security testing is sending chosen requests to an API to check authentication, authorisation, limits and configuration. Use the OWASP API Security Top 10 (2023) as the test plan, replay each request with a second account to find BOLA and BFLA, and keep the request and response as proof.
- Use the OWASP API Security Top 10 (2023) as your test plan; three of its ten risks are authorisation flaws.
- BOLA and BFLA need two or more accounts; a scanner with one login cannot find them.
- You cannot test routes you do not know about, so build the inventory first and check for old versions.
- Keep the request and response as proof for every finding, and prove a fix by replaying the same request.
- Put authorisation tests in CI and schedule a deeper test around each major release.
API security testing is the practice of checking an API's authentication, authorisation, input handling, limits and configuration for flaws before an attacker finds them. Start with the OWASP API Security Top 10 (2023), prepare two or more test accounts, replay each request with the wrong account, and keep a proof for every finding.
The worst API bugs are missing checks: an endpoint that returns another customer's invoice, an admin function a normal account can call, a field a client should never set. A scanner finds some. A person, or a tool that understands your application, finds the rest. Below are the method, a test for each OWASP risk and a plan to repeat it every release.
What is API security testing, and how is it different from testing a website?
API security testing sends deliberately chosen requests to an API and judges the responses against what the caller should be allowed to do. A website test follows pages and forms. An API test works on endpoints, methods, tokens, identifiers and JSON bodies, often with no user interface to guide you.
That changes the work in three ways. First, the client is not the control: anything a mobile app or single-page app hides can still be sent by hand. Second, APIs expose raw objects, so authorisation mistakes show up as data. Third, there is often no complete map of endpoints, so finding them is part of the test.
Which methods can you use?
No single method covers an API. The table shows what each one is good at.
| Method | What it checks | Typically finds | Typically misses |
|---|---|---|---|
| Specification and schema review | The OpenAPI or GraphQL schema against the real behaviour | Undocumented endpoints, missing auth requirements, loose types | Anything the schema does not describe |
| Automated dynamic scan (DAST) | Running endpoints with generated requests | Injection, missing headers, verbose errors, open CORS | Flaws that need two accounts or knowledge of your business rules |
| Static analysis (SAST) | Source code patterns | Unsafe calls, hardcoded secrets, missing decorators | Whether the deployed behaviour is exploitable |
| Manual testing with an intercepting proxy | Requests replayed and modified by a person | Cross-account access, function-level gaps, workflow abuse | Breadth, unless time is generous |
| Pentest with code or credentials (grey-box, white-box) | Running API plus code or credentials | Authorisation gaps traced to the exact line, then proven by exploit | Depends on the access and scope you agree |
For a wider comparison see our guide to DAST, SAST and IAST. For how API tests sit inside a full engagement, read the web application penetration testing guide.
Why does API security testing matter in 2026?
It matters because APIs carry the data and the actions, so a missing check is a breach, not a cosmetic bug. The Verizon 2026 Data Breach Investigations Report says 31% of breaches now start with software vulnerabilities, ahead of stolen passwords as the top way in.
Survey data from API-focused vendors points the same way, though it comes from a security vendor's own respondents and should be read as a signal rather than a census. In its H2 2025 State of API Security Report, Salt Security surveyed 386 security professionals. It reports that 33% had an API security incident in the past year, 80% lack continuous, real-time API monitoring, and only 19% are very confident in the accuracy of their API inventory. It also found that 54% rely on developer documentation, which goes stale, to identify sensitive data exposure.
You cannot test an endpoint you do not know exists, which is why API9 is a testing problem as much as a governance one.
What should you prepare before an API security test?
Prepare four things: a list of endpoints, test accounts that differ in privilege and tenant, a safe environment, and written rules for what may be sent.
The pre-test checklist
| Item | What to have ready | Why it matters |
|---|---|---|
| Endpoint list | OpenAPI or GraphQL schema, gateway routes, traffic captured from the web and mobile clients | Tests cover what exists, including undocumented routes |
| Accounts | At least two ordinary accounts in different tenants, one in the same tenant, a low-privilege role and an administrator | Cross-account tests need a victim and a tester |
| Seed data | Objects owned by each account (orders, files, invoices) with their IDs written down | You can tell a leak from an empty response |
| Environment | Staging with production-like auth and rate limits, and test data only | Real data and real email or payment side effects stay out of the test |
| Rules of engagement | Written permission, dates, source IP ranges, off-limits systems, a contact for emergencies | Testing needs permission; this also protects you if alarms fire |
Why two accounts in different tenants?
Most serious API flaws need a second identity. Account A creates an object and records its ID. Account B asks for that ID. If B receives it, you have a cross-account access flaw and the proof. Add a lower role in the same tenant for function-level checks. Our guide to access control testing shows how to plan these accounts and what to record.
What is the OWASP API Security Top 10?
The OWASP API Security Top 10 is a ranked list of the ten most critical API risks, maintained by the OWASP community. The current edition is 2023. It differs from the general OWASP Top 10 because it concentrates on authorisation, resource limits and API-specific abuse. Our Knowledge Hub entry on the OWASP API Top 10 gives a short definition.
The ten risks and the first test for each
| ID and name | What goes wrong | First test to run |
|---|---|---|
| API1 Broken Object Level Authorization | An endpoint takes an object ID and does not check the caller owns it | Replay account A’s request with account B’s token |
| API2 Broken Authentication | Weak or missing checks on credentials and tokens | Tamper with, expire and strip tokens; try repeated logins |
| API3 Broken Object Property Level Authorization | Sensitive fields are returned or can be written | Compare response fields by role; send extra fields in writes |
| API4 Unrestricted Resource Consumption | No limits on size, rate, pages or third-party spend | Raise page size, payload size and request rate in stages |
| API5 Broken Function Level Authorization | A low-privilege caller reaches an admin function | Call admin routes and change HTTP methods with a low-privilege token |
| API6 Unrestricted Access to Sensitive Business Flows | A valuable flow can be automated at scale | Script the flow and see what slows or stops it |
| API7 Server Side Request Forgery | The API fetches a user-supplied URL without validation | Point URL parameters at an address you control |
| API8 Security Misconfiguration | Missing hardening, verbose errors, loose CORS | Check errors, headers, methods and CORS responses |
| API9 Improper Inventory Management | Old, test or undocumented API versions stay reachable | Probe older versions and non-production hosts |
| API10 Unsafe Consumption of APIs | Data from third-party APIs is trusted without checks | Feed hostile responses from a stub third party |
Three of the ten are authorisation risks (API1, API3 and API5), and a fourth, API6, is about abusing allowed functions. If your time is short, spend it there.
How do you test for BOLA, BFLA and property-level flaws?
You test them by replaying the same request with a different identity and comparing what comes back. These three risks, API1, API5 and API3, are where most high-severity API findings live, and a scanner without two accounts cannot see them.
The three authorisation tests
API1: Broken Object Level Authorization (BOLA)
BOLA means an endpoint that takes an object identifier does not check that the caller may use that object. OWASP says any endpoint that takes an object ID and acts on that object needs its own object-level authorization check. Its risk table rates exploitability as easy and prevalence as widespread. BOLA is the API form of IDOR; our BOLA explainer and IDOR checklist go deeper.
- As account A, create an object and note its ID, for example
GET /v2/invoices/8841. - As account B in another tenant, send the same request with B's token.
- Repeat for every method that accepts the ID: read, update, delete, and sub-resources such as
/invoices/8841/pdf. - Look for IDs outside the path: query strings, JSON bodies, headers, and batch endpoints that take a list of IDs.
- Try an ID that does not exist and an ID that belongs to someone else. If the errors differ (404 against 403), you have an enumeration signal.
Do not treat random IDs as a fix. OWASP prefers unpredictable GUIDs but lists them as one measure among several; the check on the server is the control. Long random IDs also leak through logs, emails and shared links.
API5: Broken Function Level Authorization (BFLA)
BFLA means a caller can reach a function their role should not reach. OWASP's test questions are practical: can a regular user reach administrative endpoints, can a sensitive action be performed by changing the HTTP method from GET to DELETE, and can a user in one group reach a function meant for another by guessing a URL such as /api/v1/users/export_all?
- Collect every admin and internal route from the spec, the front-end bundle and the gateway configuration.
- Call each with a low-privilege token, then with no token.
- Swap methods on every route;
PUT,PATCHandDELETEare often less guarded thanGET. - Check versioned paths. A fixed
/v3route can leave/v1open.
The fix OWASP recommends is to deny all access by default and grant functions to specific roles explicitly.
API3: Broken Object Property Level Authorization
This risk covers two directions. The API returns fields the caller should not see, or it accepts writes to fields the caller should not change. The second is mass assignment. OWASP's guidance is to cherry-pick returned properties instead of using generic to_json() style methods, and to allow changes only to properties the client should update.
- Read the same object as an owner, a different tenant's user and an admin. Diff the field lists.
- In a profile or order update, add fields such as
role,isAdmin,price,tenantIdorstatus. - Re-read the object to confirm whether the value was accepted, since some APIs return 200 and ignore the field.
What does a pass and a fail look like?
| Test | Pass (safe) response | Fail (finding) response |
|---|---|---|
| Account B reads A’s object | 403 or 404, no object data | 200 with A’s data |
| Account B updates A’s object | 403 or 404, object unchanged | 200 or 204, and a later read shows the change |
| Low-privilege token calls admin route | 401 or 403 | 200 or a data-bearing 2xx |
| Unexpected field in a write | 400 with a clear error, or the field ignored and unchanged | Field stored; later reads show the new value |
| Sensitive field in a read | Field absent for the caller’s role | Field present (hash, internal ID, other tenant’s flags) |
How do you test API authentication (API2)?
Test authentication by trying to be believed without proof: no token, a changed token, an old token and a guessed credential. API2 lists failures such as accepting unsigned or weakly signed JWTs, not validating the expiry date, putting tokens in the URL, and allowing unlimited password attempts.
Token tests
JWT checks
The OWASP REST Security Cheat Sheet says to validate the issuer (iss), audience (aud), expiry (exp) and not-before (nbf) claims. Test each: change aud to another service, send an expired token, set the algorithm to none, and strip the signature. Any 200 response is a finding.
OAuth and session checks
If you use OAuth, compare the flow to RFC 9700, the OAuth 2.0 security best current practice. It requires exact string matching of redirect URIs, expects PKCE for public clients, discourages the implicit grant, and asks for refresh token rotation or sender-constraining for public clients. Test a near-match redirect URI, a replayed authorisation code, and a refresh token used twice.
Brute force and recovery
Send repeated failed logins and password resets and confirm lockout, throttling or a challenge appears. Check that changing an email address or phone number asks for the current password, as OWASP advises. An API key identifies an application; OWASP states keys should not be used to authenticate users.
How do you test resource limits and business-flow abuse (API4 and API6)?
Raise the load and the repetition in controlled steps, and record where the API stops you. API4 lists the limits to look for: execution timeouts, memory, maximum upload size, operations per request, records per page and third-party spending limits.
Resource consumption (API4)
- Ask for
?limit=100000and note whether the server caps it. - Upload a file above the stated size.
- Send a batch of operations in one request, such as 500 items in a bulk endpoint.
- Call an endpoint that triggers SMS, email or a paid third-party call and see whether a spending cap exists.
- Check that rate limiting differs by endpoint: login and OTP checks need tighter limits than reads.
Sensitive business flows (API6)
API6 is about legitimate functions used at harmful scale: purchases that enable scalping, comment creation that enables spam, reservations that let one party hold all stock. OWASP's advice has a business layer, identifying flows that would hurt the business if overused, and an engineering layer, such as device fingerprinting and human detection.
List your five most valuable flows (sign-up, coupon redemption, checkout, referral, password reset) and script each at a modest volume. If nothing slows the script, you have a finding. This overlaps our business logic testing checklist.
How do you test SSRF, misconfiguration, inventory and third-party risks (API7 to API10)?
These four risks are about what surrounds your code: URLs it fetches, how it is configured, which versions are reachable, and which other APIs it trusts. Each has a simple first probe.
The four surrounding risks
API7: Server Side Request Forgery
SSRF appears wherever an API fetches a user-supplied URL: webhooks, image imports, link previews, PDF generators. Supply an address you control and watch for the callback. Then try internal ranges and cloud metadata addresses on a staging host. OWASP recommends allowlists for origins, schemes, ports and media types, disabling HTTP redirections and using a well-tested URL parser.
API8: Security Misconfiguration
Send malformed JSON, wrong content types and oversize bodies. The REST cheat sheet expects 405 for disallowed methods, 415 for unsupported content types, 413 for oversized requests and 429 when limits trigger. Check for stack traces in errors, missing TLS, and a permissive CORS policy that reflects any origin with credentials allowed.
API9: Improper Inventory Management
Look for older versions (/v1, /beta), forgotten hosts (api-staging, old-api) and debug routes. OWASP asks you to inventory all API hosts and document each one, and to avoid using production data on non-production deployments. Unretired versions are zombie APIs; routes nobody documented are shadow APIs. Our guide to the API inventory term explains the control.
API10: Unsafe Consumption of APIs
Your API trusts other APIs too. Stand up a stub of a partner or webhook source that returns oversize bodies, unexpected fields, redirects to internal addresses and slow responses. OWASP says to validate and sanitise data from integrated APIs, use TLS, set timeouts for third-party calls and not follow redirects blindly.
The table lists the proof to keep for a finding, and the proof that closes it, by risk.
| Risk | Evidence that proves a finding | Evidence that proves a fix |
|---|---|---|
| API1, API5 | Request, response with another account’s data or admin output | Same request now returns 403 or 404 |
| API2 | Accepted forged or expired token | Same token rejected |
| API3 | Diff of fields, or stored privileged value | Field absent or ignored after the fix |
| API4, API6 | Response time, size or count showing no limit | Same script is throttled or blocked |
| API7 | Out-of-band callback or internal response body | Callback no longer arrives |
| API8, API9, API10 | Stack trace, open version, hostile data accepted | Header, route or validation changed |
How do you test a GraphQL API?
Test a GraphQL API for the same ten risks, plus the problems its single endpoint creates. The OWASP GraphQL Cheat Sheet tells you to validate input, block expensive queries, check access control and change insecure defaults, and warns that GraphQL often ships with introspection switched on and no authentication in front of it.
- Introspection and suggestions: the cheat sheet advises disabling introspection in production and turning off field-name suggestions. Query
__schemaand note what leaks. - Depth and amount limits: send deeply nested queries and requests for large lists. The cheat sheet recommends depth limiting, amount limiting and timeouts.
- Batching: send many aliased login or lookup operations in one request to see whether per-request rate limits are bypassed.
- Authorisation per field: the cheat sheet warns that possession of an object's ID does not mean the caller should have access. Run the BOLA test through queries and mutations alike.
Which API security testing tools and approaches should you use?
Use a mix: an intercepting proxy and an API client for manual work, a schema-driven fuzzer for breadth, a dynamic scanner for baseline checks, and a pentest for the authorisation and logic flaws that tools miss.
| Job | Tool type | Good for | Limit |
|---|---|---|---|
| Replay and modify requests | Intercepting proxy, API client | API1, API2, API3, API5 | Manual, so it depends on skill and time |
| Test from a spec | Schema-driven fuzzer or scanner reading OpenAPI | API4, API8, input handling | Only as complete as the spec |
| Baseline checks in CI | Dynamic scanner | Headers, TLS, known patterns | Little business context |
| Find code-level causes | Static analysis | Missing checks, secrets, unsafe binding | No proof of exploitability |
| Prove impact and fixes | Pentest with exploitation | Cross-account access, logic flaws, chained issues | Needs scope, access and time |
Where white-box and grey-box access helps
With credentials and the source code, testing gets faster and more accurate. Cyberlop finds vulnerabilities in web apps and their APIs with black-box, grey-box and white-box pentesting. In white-box mode it reads your code while testing the running app, so a finding can point to the file and line, and it checks cross-account access and business-logic flaws. It reports what it actually exploited, with the request and response as evidence. See how it works and what a finding looks like, and the guide on exploited, not suspected findings.
In what order should you run an API security test?
Run cheap, broad checks first and careful ones last.
- Inventory and accounts: endpoint list, test accounts, seed data, written permission.
- Unauthenticated sweep: call every endpoint with no token. Anything that answers should be public on purpose.
- Authentication (API2): tokens, login, recovery, sensitive changes.
- Objects and properties (API1, API3): two accounts in two tenants.
- Functions (API5): each privilege level, across methods.
- Input and fetch (API7): injection, URL fields, file handling.
- Limits and flows (API4, API6): in small, agreed steps.
- Configuration, versions, third parties (API8 to API10).
- Report, fix, retest.
How often should you run API security tests, and how do you fit them into CI/CD?
A common pattern is a full manual test at least yearly and after major changes, with automated checks on every build. No standard fixes the interval; match it to how fast your API changes. Our guide to continuous penetration testing covers the cadence in detail.
A practical cadence
- Every pull request: unit tests that assert authorisation (account B gets 403 on account A's object), plus static analysis.
- Every deploy to staging: schema-driven checks and a dynamic scan; gate the build on new high-confidence findings.
- Quarterly or on a major release: a pentest with at least two tenants and an admin account.
- Continuously: inventory checks that compare the routes seen in traffic with the routes in the spec.
The OWASP BOLA guidance says it plainly: write tests that evaluate the authorisation mechanism and do not deploy changes that make the tests fail. Cyberlop can run on a schedule or in CI/CD and gate a build; see integrations.
How do you prove an API fix works?
Replay the exact failing request against the fixed code and show the new response. A fresh scan that stays quiet is not proof, because the scan may never have sent that request. Keep the exploit as a regression test.
- Store the failing request and response with the finding.
- Fix the check on the server, not in the client.
- Replay the same request with the same token; expect 403, 404 or a rejected field.
- Add the replay to the test suite.
- Close the ticket with the before and after responses attached.
Cyberlop proves a fix by re-running the exact exploit against the new code (a closed-loop retest), not by a fresh scan.
What mistakes make an API security test miss things?
- One account. Authorisation flaws cannot be seen from a single identity.
- Trusting the interface. A hidden button proves nothing about the endpoint behind it.
- Documented routes only. The risky ones are often not in the spec.
- Reading status codes alone. A
200can be correct or a leak; compare bodies across accounts. - Treating a clean scan as a pass. It means the scanner found nothing it knows how to find.
Questions people ask
Api security testing: FAQs
What is API security testing?
API security testing is the process of sending chosen requests to an API to check its authentication, authorisation, input handling, limits and configuration. It combines schema review, automated scanning and manual tests, and ends with evidence for each flaw and a retest of each fix.
What are the OWASP API Security Top 10 risks?
The 2023 list is API1 Broken Object Level Authorization, API2 Broken Authentication, API3 Broken Object Property Level Authorization, API4 Unrestricted Resource Consumption, API5 Broken Function Level Authorization, API6 Unrestricted Access to Sensitive Business Flows, API7 Server Side Request Forgery, API8 Security Misconfiguration, API9 Improper Inventory Management and API10 Unsafe Consumption of APIs.
What is the difference between BOLA and BFLA?
BOLA (API1) is about objects: a caller reaches data they do not own by changing an ID. BFLA (API5) is about functions: a caller reaches an action their role should not allow, such as an admin route.
Test BOLA with two accounts and one object. Test BFLA with a low-privilege token and a list of admin routes and alternative HTTP methods.
Is a vulnerability scanner enough for API security testing?
No. A scanner is useful for baseline checks such as headers, TLS and common injection patterns. It rarely holds two accounts or understands who should own which object, so it misses most authorisation and business-logic flaws. Use it alongside manual or code-aware testing.
How often should APIs be security tested?
Run automated checks on each build, and a deeper manual or pentest-style test at least once a year and after large changes such as a new auth model or a new tenant feature. Compliance frameworks may set their own minimum, so check the one that applies to you.
How do you test a GraphQL API for security?
Check that introspection and field suggestions are off in production, send deeply nested and very large queries to test depth and amount limits, try batched operations against rate limits, and run the BOLA test on every query and mutation that takes an ID.
What do you need before starting an API pentest?
You need an endpoint list or specification, at least two accounts in different tenants plus a low-privilege and an admin role, a staging environment with test data, and written permission with dates and contacts. Seed data with known IDs makes cross-account results easy to read.
Can API security testing run in CI/CD?
Yes. Authorisation unit tests, static analysis and schema-driven dynamic checks fit well in a pipeline, and new high-confidence findings can fail a build. Deeper cross-account and logic testing is usually scheduled around releases.
Sources
Where the facts come from
- OWASP: API Security Top 10 2023
- Verizon: 2026 Data Breach Investigations Report
- Salt Security: H2 2025 State of API Security Report (press release)
- OWASP: API9:2023 Improper Inventory Management
- OWASP: API1:2023 Broken Object Level Authorization
- OWASP: API2:2023 Broken Authentication
- OWASP: API3:2023 Broken Object Property Level Authorization
- OWASP: API4:2023 Unrestricted Resource Consumption
- OWASP: API5:2023 Broken Function Level Authorization
- OWASP: API6:2023 Unrestricted Access to Sensitive Business Flows
- OWASP: API7:2023 Server Side Request Forgery
- OWASP: API8:2023 Security Misconfiguration
- OWASP: API10:2023 Unsafe Consumption of APIs
- OWASP: REST Security Cheat Sheet
- IETF: RFC 9700 Best Current Practice for OAuth 2.0 Security
- OWASP: GraphQL Cheat Sheet
Keep reading
Related articles
Access control testing checklist: sideways, upward and across tenants.
A step-by-step access control testing checklist for web apps and APIs: account planning, sideways, upward and cross-tenant checks, evidence and retests.
Broken object level authorization (BOLA): examples, testing and fixes
Broken object level authorization (BOLA) explained: examples, BOLA vs IDOR, a two-account test, the ownership-check fix and code review questions.
Business logic testing checklist: prices, coupons, workflows and race conditions
A business logic testing checklist covering prices, quantities, coupons, workflows, limits, timing and race conditions, with test ideas and fixes.
Test your API on one real app
Cyberlop finds vulnerabilities in web apps and their APIs with black-box, grey-box and white-box pentesting, and reports only what it exploited, with the request and response. Ask us to run it on one of your applications.
Or start with a $199 pilot on one application: thirty days, success criteria agreed before day one, credited against the annual if you convert.