API Security Testing: How to Find Flaws Before Attackers Do
API security testing checks who can reach which data and actions through your APIs. List your endpoints, test authorisation before anything else, then tokens and input, automate repeat checks, and add manual testing for logic flaws.
By Sangam Goel, Founder & C.T.O · Updated 10 Nov 2026

Key takeaways
- After listing your endpoints, test authorisation before anything else. Three of the ten risks in the OWASP API Security Top 10 (2023) are authorisation failures, and broken object level authorisation is first on the list.
- A scan usually runs under one login. Object-level and function-level flaws need two accounts per role and a person reading the results.
- Test annually and after major authentication or authorisation changes.
- Before an outside tester starts, prepare scope, specifications, two test accounts per role, allowlisting and a named contact.
In this article
- 1What is API security testing, and how is it different from functional API testing?
- 2Start with an API inventory: find shadow, deprecated and undocumented endpoints
- 3Test authorisation first: who can reach which object, function and field
- 4Broken object level authorisation (BOLA)
- 5Broken function-level authorisation
- 6Broken object property-level authorisation
- 7Authentication and token testing: JWT, API keys, OAuth flows and rate limits
- 8Input handling, injection, SSRF and business-logic abuse
- 9Injection and SSRF
- 10Business-logic abuse
- 11What automation catches and what needs manual testing
- 12How often to test: CI checks, pre-release tests and periodic penetration tests
- 13What a useful API VAPT report contains
- 14API security testing checklist: what to prepare before an external test
- 15Black box, grey box or white box: what access to give a tester
- 16Test safely: staging versus production
- 17Next step: Scope your API test with GS2
- 18Frequently asked questions
The authorisation-first test order
1. Inventory List every host, version and endpoint, including forgotten ones
|
2. Object level Can user B read or change user A's records? (BOLA)
|
3. Function level Can a basic user call admin or higher-role actions?
|
4. Property level Can a user see or set fields they should not?
|
5. Authentication Tokens, API keys, OAuth flows, rate limits
|
6. Input and flows Injection, SSRF, abuse of business logic
|
7. Automation Repeat steps 2 to 6 on every build; keep manual tests periodic
BOLA means broken object level authorisation. Every term in the diagram is explained below.
An API can pass a full vulnerability scan and still hand one customer another customer's data. The request is valid, the login is valid and the response is a clean success. Nothing looks wrong unless the tester knows whose data it is.
Authorisation, the set of rules about who may do what, is therefore the first thing to test.
What is API security testing, and how is it different from functional API testing?
API security testing checks whether an application programming interface (API) lets only the right callers do the right things, and whether it survives hostile input. Functional testing asks whether the API does its job for a valid user. Security testing asks what a wrong user, a stolen token or a crafted request can make it do.
A passing Postman test suite therefore says little about security. Every functional test can pass while any user can read any record. Your collection is still useful, because it can serve as a specification for a tester.
The OWASP API Security Top 10 (2023) is the reference list of API risks. Its release notes call it "a forward-looking awareness document" and say the 2023 edition was built from the project team's experience and review, because no data was contributed. Use it to decide what to cover. It is not a test plan.
Start with an API inventory: find shadow, deprecated and undocumented endpoints
Start with a written list of every live API host, version and endpoint, because untested endpoints are where old flaws survive. The OWASP API Security Top 10 (2023) rates improper inventory management (API9) as Exploitability Easy, Prevalence Widespread and Detectability Average.
According to the Salt Security H2 2025 State of API Security Report, a survey of 386 security professionals, only 19% were “very confident” in the accuracy of their API inventory. If your team is not sure its list is complete, the first test is finding what is missing from it.
A shadow API runs in production without appearing in your documentation or gateway. A deprecated API is an old version that still answers requests. An undocumented endpoint exists in code or traffic but is missing from your specification, the OpenAPI file or Postman collection that describes your API.
Build the list by comparing the specification, gateway and load-balancer logs, route definitions in code, and Domain Name System (DNS) and cloud-account records. An endpoint in the logs but not in the specification is a shadow-API candidate.
Include the endpoints your mobile apps call. A tester can send requests the app never would, as our mobile app penetration testing guide explains.
- Pass: every endpoint has an owner, an environment, a version and a stated authentication rule.
- Fail: any entry nobody can explain. Remove it or put it in scope.
Your internal list covers what you know about. Our external attack surface management (EASM) service scans your internet-facing assets for exposures, which can show you exposed assets your own list may have missed.

Authentication and token testing: JWT, API keys, OAuth flows and rate limits
Authentication testing checks that the API accepts only valid, current credentials and limits how fast anyone can try them. OWASP covers this under broken authentication (API2) and unrestricted resource consumption (API4). Each check below has a clear pass.
- JWT security testing. A JavaScript Object Notation (JSON) Web Token (JWT) is a signed token that carries the caller's identity. Send an expired token, a token with an edited payload and the old signature, and a token whose header sets the signing algorithm to "none". Pass: all return 401. Also confirm that a logged-out or revoked token stops working.
- API keys. A key identifies an application, not a person. Check that keys are not accepted in URLs, which end up in logs, that each key has limited scope, and that a revoked key fails at once.
- OAuth flows. OAuth (Open Authorization) lets one service act for a user on another. Check that the redirect address must match exactly, that the state value is verified, and that the API itself enforces scopes. Pass: a tampered redirect is refused, and a token with a read scope cannot write.
- Rate limits. Send repeated attempts at login, password-reset and one-time-password (OTP) endpoints. Pass: the API slows or blocks after a threshold you can state. Fail: attempt 10,000 is treated like attempt 1.
Input handling, injection, SSRF and business-logic abuse
Input testing sends unexpected data into every field the API accepts. Business-logic testing uses valid requests in ways the designers did not intend. Both come after authorisation because they find what a correct permission model cannot stop. Browser-side web flaws such as cross-site scripting belong to web application testing, which we run through our web application VAPT service and explain in our web application penetration testing guide.
Injection and SSRF
Injection means attacker-supplied text is executed as a command, for example Structured Query Language (SQL), NoSQL (non-relational database) or operating-system commands. Send wrong data types, oversized values and special characters in every parameter, including headers and nested JSON fields. Pass: a clean validation error and no change in behaviour. Fail: an error trace or altered results.
Server-side request forgery (SSRF, API7) occurs when an API fetches a web address that the caller supplies, as in webhooks and image imports. Supply addresses of internal services. Pass: the API refuses any address outside an allow-list. Fail: it fetches the address.
Business-logic abuse
Business-logic abuse is chaining valid requests to cause harm: redeeming a coupon repeatedly, skipping the payment step of a checkout, or requesting thousands of OTPs. OWASP calls this unrestricted access to sensitive business flows (API6).
Replay the flow at volume and out of order.
- Pass: limits are enforced on the server and out-of-order calls are refused.
- Fail: the hundredth coupon redeems, or the final step succeeds alone.
A scanner does not know what a flow should allow. Agree the volume limits first (see the checklist below).
What automation catches and what needs manual testing
Automated tools catch known patterns quickly on every build. Manual testing finds flaws that depend on who the caller is and what the business intends. Scanners and manual testers do different jobs, so a sound programme uses both.
| Method | What it does | Strong at | Weak at |
|---|---|---|---|
| SAST (static application security testing) | Reads source code without running it | Injection patterns, hard-coded secrets, early feedback | Runtime configuration and data ownership |
| DAST (dynamic application security testing) | Sends requests to a running API and checks responses | Misconfiguration, known injection and error patterns | Usually run under one login and cannot judge who should own an object, so it misses most object-level and function-level flaws |
| Fuzzing | Sends malformed or random input at scale | Crashes, validation gaps, unexpected errors | Business rules |
| Manual testing | A tester uses several identities and reasons about your rules | Authorisation, token and logic flaws | Slower, so done periodically |
REST and GraphQL need different approaches. Representational State Transfer (REST) APIs are tested endpoint by endpoint. GraphQL, a query language in which the client chooses the fields, is tested query by query and field by field, including nested queries.
Burp Suite and ZAP (Zed Attack Proxy) are two tools testers use to intercept and replay requests. What matters more than the tool is whether the test uses more than one identity.
API penetration testing is the manual end of this table: a person attacks the API the way an adversary would, usually delivered as vulnerability assessment and penetration testing (VAPT).
How often to test: CI checks, pre-release tests and periodic penetration tests
Run automated checks on every code change, run a targeted test before any release that changes authentication or authorisation, and schedule a full penetration test at least annually. Some providers recommend quarterly testing for sensitive production APIs, such as those handling payments or personal data.
Continuous integration (CI) is the build pipeline that runs on each code change. Put static analysis, a dynamic scan of staging and regression tests for authorisation bugs you have already fixed there.
The right interval follows how fast your permission model changes. If roles or tenants change monthly, a test taken eleven months ago says little. That is our inference, not a fixed rule.
If you want testing between periodic tests, our penetration testing as a service (PTaaS) platform provides continuous penetration testing through an online platform, as an option alongside periodic tests. Our guide to PTaaS versus annual penetration testing compares the two in detail.
What a useful API VAPT report contains
A useful report ties every finding to a risk, an impact, evidence you can reproduce and a fix your developers can apply. Our report sets out the vulnerabilities found, their risks, impact, evidence and recommended fixes.
NIST SP 800-115, published in 2008, is general guidance on planning technical security tests, analysing findings and developing mitigation strategies. It is not specific to APIs, so use it for planning and for the shape of a report, and use OWASP for API risks.
| Vulnerability | Risk | Impact | Evidence | Recommended fix |
|---|---|---|---|---|
Illustrative row: broken object level authorisation on | High | Any signed-in customer can read other customers' orders and delivery addresses | Request made as user B with user A's order ID returned HTTP 200 and A's order data | Check order ownership on the server for every read and write, and return 403 on mismatch |
The row above is illustrative. It is not a client result.
We test in five steps: information gathering, vulnerability identification, analysis, penetration testing and a comprehensive report. Testing combines automated scanning with manual testing by our security experts. See our API VAPT service.
API security testing checklist: what to prepare before an external test
Settle five items and three questions before an outside tester starts. Each item has a ready-when test.
- Scope and endpoint listReady when every in-scope host, base path and version is listed with its environment, and each deprecated version is marked in or out of scope.
- OpenAPI or Postman specificationsReady when the file imports without errors and its endpoint count matches your scope list.
- Test accounts per role, two per roleReady when each account can log in and account A owns at least one object of each type that account B cannot see.
- Access permissions and allowlistingReady when requests from the tester's agreed Internet Protocol (IP) addresses pass your web application firewall (WAF) and rate limiter, and the tokens are valid for the whole test window. Allowlisting means the test measures the API, not your firewall.
- Test windows and contactsReady when dates, hours and a named person on your side are written down.
Three questions to settle with any tester:
- Which operations are allowed: read, write, delete, high-volume? Ready when the answer is written per environment.
- Who do we call to stop a test immediately? Ready when a named person with a phone number is reachable during test hours.
- Is a retest in scope? Ready when the agreement says yes or no. Confirming fixes is good practice with any provider.
Black box, grey box or white box: what access to give a tester
The access you grant decides which flaws can be found. In a black-box test the tester gets only the target address. In a white-box test they also get source code and architecture. Grey box sits between, usually with specifications and accounts. Black box without accounts cannot test signed-in authorisation, because there is no second identity. Grey box with test accounts for two roles suits authorisation testing. White box helps most with logic flaws.
Test safely: staging versus production
Run write, delete and high-volume tests in a staging environment that mirrors production's authentication, roles and data shape. Test production only for what staging cannot show, such as live gateway settings and rate limits. Keep those production tests to agreed read-focused cases, inside an agreed window, with a stop contact. Use synthetic data in test accounts, never real customer records. This is our recommendation.
Next step: Scope your API test with GS2
If you expose APIs to customers or partners, use one rule to decide what to do next. If you cannot list every endpoint and name its owner, start with the inventory. If you can, run the two-account test on your five most sensitive endpoints this week, and treat any cross-account read as a release blocker. Whatever you find, ask any outside tester how fixes will be confirmed before you sign.
When you want an outside team to take over, book a consultation with GS2. We agree the scope of your API testing with you and report the vulnerabilities found, their risks, impact, evidence and recommended fixes. Pricing is arranged through a consultation. You can read how our API VAPT service works first.
Call +91-9838391333, email info@gs2cybersec.com or message us on WhatsApp at +91 73079 70448.




