Cloud & app security

How Can I Test the Security of My API? A Practical Guide

Most API breaches are authorization failures, not exotic exploits. Here is a practical, repeatable way to test your API for them — with two test accounts, free tools and a checklist.

Cysoro Security TeamPublished · 10 min read
GET /api/orders/124Authorization: Bearer …403 Forbidden— not your orderBOLA test: PASS CLOUD & APP SECURITY Test yourAPI security Two accounts. One checklist.
Quick answer

To test the security of your API, start with written authorization and a test environment, inventory every endpoint including shadow APIs, then test each OWASP API Security Top 10 risk as a test case: try to access another user's objects, break authentication, modify fields you should not own, call admin functions as a normal user, and push rate limits. Automate the repeatable checks in CI and finish with a manual review of business logic.

Key takeaways

  • Most API flaws are authorization failures: test with at least two accounts and try to reach the other user's data.
  • Automated scanners catch known patterns, but BOLA, business logic abuse and shadow APIs need manual test cases.
  • Never test in production without explicit approval — use a test environment, test accounts and synthetic data.

Your API is your product's front door, and most of the time it has no lock that anyone checks. The most common API breaches are not clever exploits: they are an endpoint that never checks who owns the object it returns. Here is how to test your own API for that — and for everything else on the OWASP list — before an attacker does.

What is API security testing?

API security testing is the practice of systematically evaluating an API for vulnerabilities, misconfigurations and design flaws that attackers could exploit. It covers authentication, authorization, input validation, rate limiting, configuration and business logic.

It differs from generic web testing because APIs have no user interface to click through. The test surface is the request itself: the URL, the headers, the token and the body. OWASP publishes a dedicated list for this reason — the API Security Top 10 — because API flaws are distinct from classic web flaws. The current edition is 2023, and authorization failures dominate the top of it.

Testing combines two approaches. Automated scanners such as OWASP ZAP catch known patterns quickly. Manual testing catches what scanners cannot: authorization logic, business rules and the endpoints that are not in the documentation. A good program uses both, and this guide shows you how to run each.

What do you need before you test an API?

Before you send a single request, agree the rules of engagement. Security testing without permission is not testing, and in regulated industries it can be a disciplinary or legal matter.

  • Written authorization: agree the scope, environments and dates with the system owner and the security team.
  • An approved test environment: never test in production unless the security team explicitly runs a controlled exercise that includes you.
  • Test identities and synthetic data: no real customer data and no borrowed colleague credentials.
  • At least two test accounts: one per role you need to test, plus a second user at the same level to test object-level access.
  • The API specification: the OpenAPI or Swagger document, plus any Postman collections the team already has.

Set up your accounts before you start. You need at least User A, who creates the objects under test, and User B, who tries to access them. For role tests, add a viewer or read-only account in the same tenant. Hold each token in its own variable, never in files, and record the object IDs User A creates so you can reuse them in test cases.

Six steps to test an API1Authorizescope, environment,test accounts2Inventoryspec, traffic,shadow APIs3Auth teststokens, expiry,missing auth4AuthZ testsBOLA, BFLA,field access5Probe inputsfuzzing, injection,rate limits6AutomateCI gates,retestSteps 3 and 4 catch most real API breaches. Do not skip them for the scanner.
The six-step API security testing workflow. Illustration by Cysoro.

How do you inventory an API before testing?

You cannot protect what you do not know about. Maintain a live API inventory by parsing OpenAPI or AsyncAPI specs from source control, analyzing traffic in staging and production to detect shadow APIs, and crawling regularly to catch zombie endpoints that are deprecated but still responding.

Shadow APIs are endpoints that receive traffic but are not in the spec: an old mobile version, a debug endpoint someone left on, a partner integration that was never documented. Zombie APIs are the opposite problem: documented once, deprecated, never switched off. Both are prime targets, because nobody tests what nobody knows exists.

Compare the spec against reality. Send the requests the spec describes and check the responses match: status codes, fields, error formats. Differences between spec and implementation are themselves findings, because a field the spec does not mention may still leak data. Record every endpoint, method, authentication requirement and role in one inventory before you write a single test case.

How do you test for broken object level authorization?

Broken Object Level Authorization, or BOLA, is the number one OWASP API risk. It happens when an endpoint accepts an object ID without checking that the caller owns that object. The test is simple and every API should pass it.

  1. User A creates a resource and you capture its ID, for example an order, a document or a payment.
  2. Authenticate as User B and request the same resource using User A's ID.
  3. The API must return 403 or 404, not the resource data. A 200 response with someone else's data is a confirmed BOLA finding.
  4. Repeat for writes: try to update and delete User A's object as User B, and try enumerating IDs to see whether they are predictable.

OWASP notes that comparing the user ID from the session token with the ID parameter is not a sufficient fix on its own, because object ownership is often more complex than a single user match. The check must enforce the real authorization rule for that object. Test every endpoint that receives an ID, not just the obvious ones, and test with IDs from different tenants, not only different users.

A related test covers Broken Object Property Level Authorization. Request an object and compare the response fields against the spec: sensitive fields such as internal notes, pricing or other users' data should not appear. Then try mass assignment: add a field you should not be able to set, such as is_admin or price, to an update request and see whether the server accepts it.

How do you test API authentication?

Broken authentication is API2 in the OWASP list. Test it by attacking the token lifecycle: expired tokens, tokens with a tampered signature, tokens sent in the wrong place, and endpoints that forgot to require authentication at all.

  • Missing authentication: call every endpoint with no token. Any endpoint that returns data without one is a finding, especially legacy or admin paths.
  • Expired and forged tokens: replay an expired token and a token with a modified payload. Both must be rejected.
  • Token placement: tokens in query parameters leak into logs and browser history. Check that tokens travel in headers, not URLs.
  • Weak credentials: test for default credentials, weak password policies and missing lockout on login endpoints.
  • JWT checks: inspect tokens for weak signing algorithms, missing expiry and sensitive data in the payload. Our free JWT decoder shows you what a token actually contains.

Also test the refresh flow: a refresh token should expire, should be single-use where possible, and should be invalidated on logout and password change. If a stolen refresh token works forever, the whole authentication design is broken.

How do you test function level authorization?

Broken Function Level Authorization, or BFLA, is when a normal user can call an admin function. The test is a role matrix: list every endpoint, list every role, and call each endpoint as each role.

Start with the admin paths: user management, role changes, billing, configuration and data export. Then check the paths nobody thinks about: bulk operations, report generation, webhook management and internal tools that were exposed for convenience. Undocumented or legacy admin endpoints are the most common BFLA findings, which is why the inventory step matters.

Test business flows too, under API6. Can a customer apply a discount code unlimited times? Can a user submit the same payment twice? Can a booking be made for a negative quantity? These are not coding bugs in the usual sense; they are business rules the API never enforced, and only a manual test designed around the business will find them.

How do you test API inputs and rate limits?

Input testing has three parts: fuzzing, injection and resource consumption. Fuzzing sends malformed, oversized and boundary-value inputs — empty strings, maximum lengths, negative numbers, unexpected types — and watches for 500 errors, stack traces or data leaks. A proper error is a 400 with a generic message; a stack trace is a finding.

Injection testing covers the usual suspects in API form: SQL and NoSQL injection in query parameters, command injection in fields that reach the shell, and server-side request forgery in any parameter that accepts a URL. Test SSRF only with security team approval and only against controlled targets, because a successful probe can reach internal systems.

Rate limiting is API4, unrestricted resource consumption. Send requests faster than a legitimate client would and watch for throttling: the API should return 429 with a retry-after header, not keep serving you until the backend falls over. Test per-user and per-IP limits, and test expensive operations such as large file uploads, deep pagination and complex GraphQL queries, which can exhaust resources with very few requests.

OWASP API Top 10 (2023): what to test for each riskRiskThe test that catches itAPI1 Broken Object Level AuthorizationUser B requests User A's object by IDAPI2 Broken AuthenticationExpired, forged and missing tokensAPI3 Broken Object Property Level AuthZExtra fields in responses; mass assignmentAPI4 Unrestricted Resource ConsumptionFlood requests; expensive queriesAPI5 Broken Function Level AuthZNormal user calls admin endpointsAPI6 Business flow abuseRepeat discounts, double paymentsAPI7 SSRF, API8 misconfiguration, API9 inventory, API10 unsafe consumption: see the checklist below.
The OWASP API Top 10 mapped to the test that catches each risk. Illustration by Cysoro.

How do you test API configuration and transport?

Security misconfiguration is API8, and it is the easiest category to test because most of it is observable without any special access.

Check the transport first: the API must serve HTTPS only, with TLS 1.3 preferred and TLS 1.2 as the minimum. The OWASP TLS cheat sheet says TLS 1.0 and 1.1 must be disabled, and CISA's guidance tells organizations to disable HTTP, enforce HTTPS and HSTS, and disable weak ciphers.

Then check the headers and error behavior. Security headers should be present, CORS should not use a wildcard with credentials, and error messages should be generic: a 404 that says "user not found" versus "wrong password" leaks information, and a stack trace leaks far more. Check for unnecessary HTTP methods, debug flags left on, and verbose errors in staging that also appear in production.

Finally, check versioning and inventory hygiene. Deprecated API versions should be switched off, not merely undocumented. Test every old version you can find: if v1 still answers requests, it is still in scope, whatever the documentation says. You can check the transport layer of any public API endpoint yourself with our free SSL checker.

Which tools test API security?

Different tools cover different parts of the job. No single tool does all of it, so pick one from each row and combine them.

ToolTypeBest forPrice
OWASP ZAPDAST scannerAutomated API scanning, CI integrationFree, open source
Burp SuiteIntercepting proxyDeep manual testing, request tamperingCommunity free; Pro paid
Postman / BrunoAPI clientAuthorization test cases with two accountsFree tiers available
SchemathesisSpec-based fuzzerAuto-generated tests from OpenAPI specsFree, open source
StackHawkDAST in CIModern DAST as a CI gateFree tier; paid plans
AktoAPI discoveryFinding shadow APIs from trafficFree tier; paid plans

For GraphQL APIs, add specific checks: disable introspection and field suggestions in production, enforce query depth and complexity limits, and limit batching. For gRPC and event-driven APIs, test the same authorization rules at the message level, because the transport changes but the trust decisions do not.

One caution about tools: a scanner that reports zero findings has usually tested nothing. Confirm the scan actually hit authenticated endpoints by checking its request log. If it only tested the login page, it found nothing because it looked nowhere.

How do you automate API security testing in CI?

Shift API security testing left: run it on every change, not once a year. The pipeline has four stages, and each one catches a different class of problem.

  1. Spec validation: lint the OpenAPI spec on every pull request and fail the build if the spec and the implementation drift apart.
  2. Contract tests: run positive and negative tests against the spec — valid requests return expected responses, and invalid inputs return proper error codes, not 500s or data leaks.
  3. DAST in CI: run OWASP ZAP or an equivalent against the test deployment on every merge, with the authorization test cases included.
  4. Secret and config scanning: check for hardcoded credentials, debug flags and permissive CORS before the build ships.

Keep the CI suite fast enough to run on every change, and keep the deep manual pass for releases. A test suite that takes an hour will be skipped; a suite that takes five minutes will be run. Record results against the OWASP API Top 10 so coverage is visible: if API1 has no test cases, say so, rather than reporting a green build.

What do you do with the findings?

A finding is only useful if it gets fixed and retested. Score each finding by impact and exploitability, not by scanner severity alone: a BOLA on an order history endpoint matters more than a missing header on a public status page.

Write each finding so a developer can reproduce it: the exact request, the token role used, the expected response and the actual response. Include the fix, not just the problem: enforce object-level checks server-side, validate fields against an allowlist, or add the missing rate limit. Then retest with the same request after the fix, and add a regression test to the CI suite so the flaw cannot come back silently.

Track the categories, not just the count. If most findings are BOLA and BFLA, the problem is an authorization design gap, and the fix is a shared authorization layer rather than ten individual patches. If most findings are misconfiguration, the fix is a secure baseline and a config check in CI. The pattern tells you where to invest.

Retest after every fixA fix that was never retested is an assumption, not a fix. Keep the original failing request, replay it after the change, and confirm the API now returns 403 or 404 instead of the data.

The bottom line

Testing API security is mostly testing authorization: two accounts, a list of endpoints, and the discipline to try the request you are not supposed to be able to make. Scanners help, but the findings that matter most — BOLA, BFLA, business logic abuse — come from manual test cases designed around your own rules.

Start today: inventory your endpoints, create your two test accounts, and run the BOLA test on your most sensitive resource. You can check the transport layer while you are at it with the free SSL checker.

If you work with tokens, the free JWT decoder will show you exactly what your tokens carry.

Frequently asked questions

How can I test the security of my API?

Get written authorization and a test environment, inventory all endpoints, create at least two test accounts with different roles, then turn each OWASP API Security Top 10 risk into a test case. Use automated scanners for known patterns and manual tests for authorization and business logic, then fix findings and retest.

What is API security testing?

API security testing is the practice of systematically evaluating an API for vulnerabilities, misconfigurations and design flaws that attackers could exploit. It covers authentication, authorization, input validation, rate limiting, configuration and business logic, and it combines automated scanning with manual testing.

What is the OWASP API Security Top 10?

It is OWASP's ranked list of the ten most critical API-specific security risks. The current edition is 2023, and it starts with Broken Object Level Authorization, Broken Authentication and Broken Object Property Level Authorization. Use it as the checklist your testing must cover.

What tools test API security?

OWASP ZAP is the best free automated scanner, and Burp Suite is the standard commercial proxy for manual testing. Postman and Bruno are good for writing authorization test cases with two accounts. Dedicated API security tools such as Akto, Schemathesis and StackHawk add spec-based and CI-integrated testing.

Can I test my own API without permission?

You can test an API you own, but only in an approved test environment and with the system owner's agreement. Testing in production without approval, or testing someone else's API, can be a disciplinary or legal matter. Agree the scope, environment and dates in writing first.

What is BOLA in API security?

BOLA, Broken Object Level Authorization, is the top OWASP API risk. It happens when an endpoint accepts an object ID, such as an order number, without checking that the caller owns that object. An attacker changes the ID and reads another user's data. Test for it by requesting user A's objects with user B's token.

How often should I test my API?

Run automated API security tests on every code change in CI, and run a full manual test pass before every major release and at least twice a year. Retest after any authentication, authorization or rate-limit change, and whenever a new endpoint ships.

What is the difference between SAST, DAST and API testing?

SAST reads your source code for flaws, DAST attacks a running application from the outside, and API testing is a specialized form of DAST that exercises API endpoints with real requests. API testing adds authorization and business-logic cases that generic scanners cannot infer, which is why it needs manual test design.

Sources

  1. OWASP — API Top 10 (Developer Guide)
  2. OWASP — API Security, DevSecOps Guideline
  3. OWASP — API1:2023 Broken Object Level Authorization
  4. OWASP — Transport Layer Security Cheat Sheet
  5. CISA — Website Security
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against the OWASP API Security Top 10 (2023), the OWASP DevSecOps Guideline for API security and the OWASP TLS cheat sheet.

How we write and fact-check →

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free