Blog · API Security

API security best practices for 2026: the checklist that maps to real breaches

Most API security advice guards the front door with authentication, rate limits, and a WAF. Then the breach comes through a door that was already unlocked: an endpoint that authenticates you correctly and then hands over data that was never yours. This is a practical, OWASP-mapped list of the practices that actually matter, written by an offensive security team that breaks APIs for a living, ordered by how often each failure shows up in real compromise.

Planck Defense · Offensive Security Team · September 1, 2026 · 11 min read

By Berk Dusunur, Founder & CEO, Planck Defense & Aerospace

The short version

API security is really access-control engineering. Authenticate strictly, but spend most of your effort on authorization: verify on the server, for every request, that this caller may reach this object and this function. Whitelist writable fields, validate input, rate-limit everything, keep an exact endpoint inventory, and then test authorization continuously, because the flaws that breach APIs (BOLA and BFLA) are the ones scanners cannot see.

What is API security?

API security is the practice of protecting application programming interfaces from misuse and attack across their entire lifecycle, from design and authentication through authorization, input handling, rate limiting, inventory, monitoring, and testing. Because an API exposes your business logic and data directly, with no browser and no human in the loop, an attacker can call it a million times a minute and reason about every parameter. That changes the threat model: the perimeter controls that protect a web app matter far less than whether each individual request is correctly authorized.

Here is the fact that should reorganize your priorities. According to the OWASP API Security Top 10 (2023), the top two risks by real-world impact are broken object level authorization and broken function level authorization, not injection, not misconfiguration. Most serious API breaches are authorization failures. So a best-practices list that spends ten items on the perimeter and one on authorization has the ratio exactly backwards. The list below fixes that.

The API threats that actually cause breaches

Best practices only make sense against the threats they stop. These are the flaw classes that matter, mapped to the OWASP API Security Top 10 so you can cross-reference your own program.

Risk (OWASP API 2023)What goes wrongImpact
API1 · BOLA / IDOREndpoint does not verify the object belongs to the callerRead or modify other users' data
API2 · Broken authenticationWeak, forgeable, or non-expiring tokens; broken login flowsAccount takeover
API3 · BOPLA / mass assignmentCaller writes object properties they should not controlPrivilege or ownership takeover, price tampering
API4 · Unrestricted resource consumptionNo rate limits, quotas, or size capsDenial of service, cost blowups, brute force
API5 · BFLAServer does not check role before running a functionA normal user reaches admin actions
API6 · Sensitive business flow abuseAutomation abuses a legitimate flow at scaleFraud, scalping, spam
API7 · SSRFServer fetches an attacker-supplied URLInternal network and metadata access
API8 · Security misconfigurationPermissive CORS, verbose errors, missing headersInfo leak, wider attack surface
API9 · Improper inventory managementShadow, zombie, and deprecated endpointsUnmonitored, unpatched entry points
API10 · Unsafe consumption of APIsBlindly trusting third-party API responsesInjection and compromise via a partner

API security best practices for 2026

Twelve controls, ordered roughly by how often their absence appears in real API compromise. The first two are the ones almost every breached API got wrong.

1. Enforce object-level authorization on every endpoint

For every request that references an object by identifier (/orders/124, /users/89/profile, an ID in a query string or JSON body), the server must verify that the authenticated caller owns or is permitted that specific object before acting. Do it server-side, from a trusted session identity, on a deny-by-default basis. Never rely on the identifier being hard to guess: UUIDs, hashes, and nested GraphQL references are all BOLA surface. This single control prevents the number one API risk.

2. Enforce function and role level authorization on the server

Every privileged action must check the caller's role on the server, not in the UI. If the admin button is simply hidden but DELETE /users/89 still executes for a standard token, you have BFLA. Test method swaps on the same path (GET to DELETE), undocumented admin routes, and service methods the client was never meant to call. Authorization lives in the API, never in the client.

Illustrative Operator run: one role's requests replayed as another to prove BOLA and BFLA, the flaws a scanner cannot see.

3. Authenticate with short-lived, scoped tokens

Use a standard protocol (OAuth 2.0 / OpenID Connect). Issue short-lived access tokens with the narrowest scope that works, rotate refresh tokens, and on every request validate the signature, issuer, audience, and expiry. Reject the alg: none JWT trick and unverified signatures outright. Authentication answers “who are you”; get it strict and boring so you can spend your real effort on authorization.

4. Whitelist writable fields to stop mass assignment

Never bind a request body straight onto your data model. Define an explicit allow-list of fields a caller may set, and drop everything else. Fields like ownerId, role, isAdmin, balance, and price should be server-controlled and never writable from the client. This closes broken object property level authorization (mass assignment), a common path to ownership takeover and price tampering.

Mass assignment in one exchange: the server bound ownerId straight from the body, so the caller took the object. A writable-field allow-list stops it.

5. Validate all input against a schema

Validate every parameter for type, format, range, and length at the edge, driven by your OpenAPI schema. Constrain what you accept before it reaches business logic. Strong input validation is your baseline defense against injection and a natural fit if you already publish a spec, which becomes the contract you enforce.

6. Rate-limit and quota every endpoint

Apply per-user, per-IP, and per-endpoint limits, plus quotas and payload-size caps. Rate limiting is not just anti-DoS: it blunts credential stuffing, object-ID enumeration, and business-flow abuse. Pay special attention to expensive endpoints and anything that fans out to a third party or a database.

7. Keep an exact API inventory, and kill shadow endpoints

You cannot secure an endpoint you have forgotten. Maintain an authoritative inventory of every API, version, and environment, and retire deprecated and undocumented (“shadow” and “zombie”) endpoints. Old /v1 routes and staging APIs exposed to the internet are frequent, unmonitored entry points. Your spec should match reality, and reality should have nothing extra.

8. Return only the data the caller needs

Shape responses on the server to the fields a caller is entitled to, rather than returning the full object and filtering in the client. Excessive data exposure leaks personal data, tokens, and internal fields that fuel the next step of an attack. Keep sensitive values out of error messages and logs too.

9. Defend outbound calls against SSRF

Any endpoint that fetches a URL, imports from a link, or calls a webhook can be turned inward against your own network and cloud metadata service. Validate and allow-list outbound destinations, block internal ranges and link-local addresses, and never trust a third-party API's response as safe input. Treat the data you consume with the same suspicion as the data you receive.

10. Encrypt everything and manage secrets properly

Enforce TLS on every route with HSTS, disable weak ciphers, and never accept credentials or tokens over plaintext. Keep API keys and signing secrets in a managed secret store, rotate them, and scope them tightly. Encryption is table stakes, but a single plaintext path or leaked key undoes the rest of the list.

11. Log and monitor for authorization anomalies

Log authentication and authorization decisions with enough context to answer “who accessed what” after the fact, and alert on the patterns that precede an authorization breach: a single account walking sequential object IDs, low-privilege tokens hitting admin routes, sudden spikes on a sensitive flow. Detection does not replace prevention, but it catches the abuse your controls missed.

12. Test authorization continuously, on every deploy

This is the practice that ties the other eleven together, and the one most programs skip, because it is the hardest to automate. Authorization is not a setting you configure once; it is a property that breaks on the next pull request that adds an endpoint. The only way to keep it honest is to test it continuously, with real identities, across every operation. That is exactly where scanners fail and where an identity-aware, spec-driven pentest belongs. More on that next.

A copy-paste API security checklist

Keep this next to your pull-request template. If a change touches the API, every box should still be true.

  • Object authorization: every object reference is checked against the caller's identity, server-side, deny-by-default.
  • Function authorization: every privileged action checks role on the server, not in the UI.
  • Tokens: short-lived, scoped, signature and expiry validated on every request.
  • Mass assignment: request bodies bound through an explicit writable-field allow-list.
  • Input: validated against the schema for type, range, and length at the edge.
  • Rate limits: per user, per IP, per endpoint, with quotas and size caps.
  • Inventory: spec matches reality; no shadow, zombie, or deprecated endpoints exposed.
  • Responses: only entitled fields returned; no secrets in errors or logs.
  • SSRF: outbound URLs allow-listed; internal ranges blocked; third-party responses distrusted.
  • Transport: TLS everywhere with HSTS; secrets in a managed store and rotated.
  • Monitoring: authorization decisions logged; alerts on enumeration and privilege anomalies.
  • Testing: identity-aware authorization testing runs on every deploy, not once a year.

Why testing is the best practice most teams skip

Read that checklist again and notice which items a tool can verify for you. A scanner can flag a missing security header or an outdated TLS suite. It cannot tell you whether GET /orders/124 should be allowed for the account that asked, because authorization is relative to identity, and a signature engine sees one request, one response, one caller. The controls at the very top of the list, the ones that actually stop breaches, are the ones automated scanning is structurally blind to. That is why authorization flaws sail through CI and land in production.

Testing authorization properly means authenticating as more than one user and role, then, for every operation the API exposes, replaying one identity's requests as another and checking whether the server wrongly allows it. Done by hand across a real API, that is dozens or hundreds of operations times several role pairings, which is why it usually gets sampled rather than done. This is the exact shape of problem an agentic API penetration test is built for. You give it your OpenAPI spec and one token per role; it enumerates every operation, replays one role as another across the whole surface, probes parameters for injection and mass assignment, and, because it is an agentic pentester rather than a scanner, it does not stop at “this looks off.” It reproduces the exploit and reports it with the exact request and response that prove it, rated with a CVSS v3.1 vector, on every deploy rather than once a year.

Every operation, every deploy. Only findings the agent could reproduce are reported, so there is nothing to triage by hand.

Best practices one through eleven are how you build a secure API. Practice twelve, continuous authorization testing, is how you keep it secure as the code changes underneath you. For the deeper method, see API security testing and our engagement methodology.

References

FAQ

Common questions about API security

What is API security?

API security is the practice of protecting application programming interfaces from misuse and attack across their whole lifecycle: authenticating callers, authorizing every request against the specific data and functions the caller should reach, validating input, limiting resource consumption, keeping an accurate inventory of every endpoint, and testing all of it continuously. Because APIs expose business logic and data directly, the highest-impact API risks are broken authorization flaws (BOLA and BFLA), not injection.

What are the most important API security best practices?

Enforce object-level authorization on every endpoint that references an object, enforce function and role level authorization on the server rather than in the UI, use short-lived scoped tokens with validated signatures, whitelist writable fields to stop mass assignment, validate all input against a schema, rate-limit every endpoint, maintain an accurate inventory with no shadow or deprecated endpoints, return only the data a caller needs, defend against SSRF on outbound calls, encrypt everything in transit, monitor for authorization anomalies, and test authorization continuously on every deploy.

What is the number one API security risk?

Broken Object Level Authorization (BOLA), also called IDOR, is the number one risk in the OWASP API Security Top 10. It happens when an endpoint authenticates a user but does not verify that the specific object they request belongs to them, letting an attacker change an identifier and read or modify other users' data. Automated scanners cannot find it because authorization is relative to identity.

How do you test API security?

Authenticate as more than one user and role, then, for every operation the API exposes, replay one identity's requests as another to check object and function level authorization, probe every parameter for injection and mass assignment, and confirm rate limits. Scanners miss the authorization class, so effective testing is identity-aware and, ideally, continuous. An agentic API penetration test does this across every documented operation and proves each finding with the exact request and response.

Why can't a scanner secure my API?

A vulnerability scanner or DAST tool matches one request and one response against known signatures. The dominant API flaws, BOLA and BFLA, are only visible when you compare what one account can do against what another account should be allowed to do. That is a stateful, multi-identity comparison a signature engine cannot express, which is why authorization flaws pass automated scans and reach production.

Keep Reading

Related

Get Started

Test the practices that actually stop breaches

Give Operator your spec and a token per role. It replays one role as another across every operation, probes every parameter, and proves what it finds, on every deploy.