Cloud & app security

How to Ensure API Security: A Practical Checklist for Small Teams

API security starts with knowing every endpoint you expose and checking authorization on every request. This guide turns the OWASP API Top 10 into a checklist you can work through.

Cysoro Security TeamPublished · 9 min read
GET /users/124Authorization: Bearer …Owner check: FAILED403 ForbiddenNot your record.Request blocked. ✓ ✕ CLOUD & APP SECURITY APIsecurity Check every request. Every time.
Quick answer

To ensure API security, inventory every endpoint, require authentication by default, check authorization at the object, property and function levels on every request, use short-lived tokens, validate all input against a schema, encrypt traffic with TLS, rate-limit clients, and log and monitor API activity so abuse is spotted quickly.

Key takeaways

  • Authorization is the biggest API risk: check ownership on every object, field and function, not just at login.
  • Short-lived tokens, TLS everywhere and strict input validation close the most common gaps.
  • Rate limits, size caps and monitoring stop one client from draining your resources or your budget.

An API is a door into your application that any client can knock on. Unlike a web page, there is no user interface limiting what a caller can ask for, so a single weak check can expose every record in your database.

What is API security?

API security is the set of controls that decide who can call your API, what they can do, and what data they can see. It covers authentication, authorization, input validation, encryption, rate limiting and monitoring.

Every API you run has an attack surface: public endpoints, partner integrations, mobile app back ends and internal services. Attackers probe them directly, without the limits a browser interface imposes. That is why the OWASP API Security Project maintains its own Top 10 list of API risks, separate from the general web application list.

The good news is that most API breaches come from a small set of repeatable mistakes. Work through the checklist in this guide and you will close the gaps that cause the majority of real incidents.

How do you start securing an API?

Start by listing every API you actually run, including the ones you forgot about. You cannot protect an endpoint you do not know exists, and forgotten endpoints are a classic way in.

Build a simple inventory: each API, its host, its versions, its owner, who can call it, and what data it touches. Include internal services, partner APIs, old versions kept alive for one customer, and debug or admin endpoints. Then retire anything with no owner and no users.

OWASP calls this out as API9:2023, Improper Inventory Management. Old versions are dangerous because they often run older, weaker code and are rarely tested. Set a retirement date for every version you deprecate, and announce it to your callers.

Keep the inventory current. Add a step to your release process: no new endpoint ships without an entry in the inventory, an owner, and a note of which data it exposes.

What does the OWASP API Top 10 cover?

The OWASP API Security Top 10 (2023 edition) lists the ten most critical API risks, ranked by prevalence and impact. Authorization failures dominate the top of the list.

RiskWhat it meansFirst fix
API1 Broken Object Level AuthorizationChanging an ID returns another user's dataCheck ownership on every request
API2 Broken AuthenticationWeak tokens, missing checks, credential stuffingShort-lived tokens, rate-limited logins, MFA
API3 Broken Object Property Level AuthorizationReading or writing fields a user should not touchAllowlist fields in and out
API4 Unrestricted Resource ConsumptionNo limits on requests, size or costRate limits, size caps, pagination
API5 Broken Function Level AuthorizationNormal users calling admin endpointsDeny by default, check role per endpoint
API6 Sensitive Business FlowsBots abusing signup, checkout or bookingVelocity checks, step-up verification
API7 Server-Side Request ForgeryThe API fetches a URL an attacker controlsValidate and allowlist URLs
API8 Security MisconfigurationWeak defaults, verbose errors, open CORSHarden defaults, generic errors
API9 Improper Inventory ManagementShadow and retired APIs left runningInventory, version retirement
API10 Unsafe Consumption of APIsTrusting third-party API responses blindlyValidate upstream data like user input

The full list is published by the OWASP API Security Project, and Cloudflare's explainer gives a plain-English summary of each risk. Use the list as a review checklist, not as a ranking of what will hit you first: your own data and callers decide that.

Authorization has three levels — check all three1. Function level — may this caller use this endpoint at all?A normal user must never reach an admin endpoint, whatever their token says.2. Object level — may this caller touch this record?Check ownership of the exact ID in the request, on every request.3. Property level — may this caller read or change this field?Filter response fields by role and reject fields the caller may not set.
Three authorization checks every API request should pass. Illustration by Cysoro.

How should you authenticate API calls?

Require authentication by default and mark the few public endpoints explicitly. An endpoint that is public by accident is one of the most common API mistakes.

For user-facing APIs, use a standard protocol: OAuth 2.0 or OpenID Connect, with short-lived access tokens and revocable refresh tokens. For service-to-service calls, use mutual TLS or signed tokens that identify the calling service. API keys alone are not authentication for users: they identify an integration, they are easy to leak, and they usually cannot be tied to one person.

Validate tokens fully on every request: signature, algorithm, issuer, audience and expiry. Never accept a token with the algorithm set to none, and never trust claims in a token you did not verify. Keep access tokens short-lived, ideally minutes rather than hours, so a stolen token is useful only briefly.

Protect the authentication flows themselves. Login, token and password-reset endpoints need rate limits and lockouts against credential stuffing, and admin accounts need multi-factor authentication. Never put API keys or tokens in URLs, where they end up in logs, browser history and referrer headers.

How do you fix broken authorization?

Check authorization in your code, on every request, at all three levels. A check at the gateway or in the user interface is not enough, because an attacker calls the API directly.

At the function level, deny by default: every endpoint lists the roles that may call it, and anything else gets a 403. At the object level, verify that the caller owns or may access the exact record named in the request.

At the property level, allowlist the fields a caller may read and write, and strip the rest from responses and updates. Even a random-looking UUID is not protection: check ownership on every request.

Test it the way an attacker would. Take a normal user's token, change the ID in a request to another user's record, and see what comes back. Call an admin endpoint with that same token. Add a field such as role to a profile update and see whether it sticks. If any of those succeed, you have found a real flaw.

Keep authorization logic in one place, such as a shared middleware or policy layer, so a new endpoint cannot accidentally skip it. Review that layer whenever roles or data rules change.

How do you validate API input?

Validate every request against a schema before your code touches it. Define the allowed fields, types, lengths and ranges in an OpenAPI or JSON Schema definition, and reject anything that does not match.

Reject unknown fields instead of ignoring them: an extra field is often a mass-assignment attempt. Enforce a maximum request body size, a maximum page size, and a limit on query complexity for GraphQL. Use parameterized queries for database access, and treat data returned by third-party APIs with the same suspicion as user input.

Return generic error messages. A detailed error that names a database table, a file path or an internal service helps an attacker map your system. Log the detail on your side, and send the caller a short, safe message.

Our guide to OWASP API security rate limiting covers the related problem of requests that are valid but far too numerous or expensive.

What about encryption and transport security?

Serve every API endpoint over HTTPS with TLS 1.2 or better, and redirect or reject plain HTTP. This protects tokens, keys and data in transit, and it is a basic expectation for any API that handles real user data.

Encrypt sensitive data at rest, and mask or omit fields that a caller does not need. An API that returns full records when the client only needs a name and an ID is over-sharing, and over-sharing turns a small leak into a large one.

Set strict CORS rules: allow only the origins you actually serve, and never reflect an arbitrary origin with credentials. Check your response headers with our free security headers checker.

Also check your certificate with the free SSL checker.

How do you stop abuse and runaway costs?

Rate-limit per user, per API key and per IP address, with tighter limits on login, password reset and expensive operations. Return 429 Too Many Requests with a Retry-After header when a limit is hit, so well-behaved clients back off instead of retrying blindly.

Rate limits alone are not enough. Cap page sizes, upload sizes and execution time, and protect sensitive business flows such as signup, checkout and coupon redemption with velocity checks or step-up verification. A bot that can create a thousand accounts or redeem a thousand coupons is an API6 problem, not just a rate problem.

Watch your per-request costs. Some operations trigger a paid service on your side, such as an SMS, an email or a lookup. An attacker who can trigger those at will can run up your bill in minutes, so put the same limits on costly operations as you do on logins.

Your API security checklistInventory every endpointOwner, versions, data touchedAuthenticate by defaultShort-lived tokens, MFA for adminsAuthorize at three levelsFunction, object, propertyValidate against a schemaReject unknown fields and sizesLimit and cap consumptionRate limits, page and body capsLog and monitor everythingAlerts on spikes and failures
Six checks that cover most API risk. Illustration by Cysoro.

How should you handle API keys and secrets?

Store secrets in a secrets manager or vault, never in source code, config files checked into version control, or mobile app binaries. Rotate keys on a schedule, and revoke them immediately when an employee leaves or a key is exposed.

Give each integration its own key with the smallest scope it needs. A key that can read and write everything is a single point of failure, and a scoped key limits the damage when it leaks. Monitor key usage so an unusual spike, a new country, or a sudden change in volume triggers an alert.

Scan your repositories for leaked secrets as part of your build pipeline, and treat a leaked key as compromised until it is revoked and replaced. The same rule applies to tokens and passwords found in logs: scrub them, rotate them, and fix the logging.

How do you monitor an API for attacks?

Log who called which endpoint, when, with what result, and from where. Keep enough detail to investigate an incident, but never log tokens, passwords or full request bodies containing personal data.

Alert on the patterns that matter: a spike in 401 and 403 responses, repeated failed logins, a single key calling unusual endpoints, a sudden jump in traffic from one client, and error rates climbing on one endpoint. These are the signals of credential stuffing, enumeration and abuse, and they are easy to miss if nobody watches them.

Review your logs regularly, not only after an incident. A monthly look at the top callers, the most common errors and the slowest endpoints often surfaces a misbehaving integration or an endpoint nobody owns.

Test in staging, not productionAuthorization and rate-limit tests can lock accounts, trigger alerts or generate charges. Run them against a staging environment with test accounts and test data first.

What are the most common API security mistakes?

The same mistakes appear in breach after breach. Avoid them and you are ahead of most teams.

  • Trusting the client. Checking permissions in the app but not in the API lets anyone call the API directly and skip the check.
  • Sequential, guessable IDs. Returning another user's record by changing /users/123 to /users/124 is the classic BOLA flaw.
  • Returning too much data. Sending full records when the client needs two fields turns a small flaw into a large exposure.
  • Leaving old versions live. A retired version with old code and no owner is an open door.
  • No rate limits on costly endpoints. One script can drain your budget through SMS, email or lookup charges.
  • Verbose errors. Stack traces and database errors in responses hand attackers a map of your system.
  • Keys in code and logs. A secret in a public repository or a log file is already compromised.

If you run a small business, our small business cybersecurity checklist covers API controls alongside backups, updates and device security.

The bottom line

API security is mostly discipline: know every endpoint, authenticate every caller, check authorization on every request, validate every input, and limit what any one client can consume. The OWASP API Top 10 gives you the map; the checklist in this guide is the route.

Start with the inventory and the authorization tests. They find the most serious flaws the fastest, and they cost nothing but time. Then add rate limits, monitoring and key hygiene, and repeat the tests after every major change. You can check the public face of your own API in seconds with the free SSL checker.

Frequently asked questions

What is API security?

API security is the practice of protecting the interfaces your software uses to exchange data. It covers authentication, authorization, input validation, encryption, rate limiting and monitoring, so only the right callers can reach the right data and actions.

What is the biggest API security risk?

Broken authorization is the biggest risk. OWASP ranks broken object level authorization first in its 2023 API Top 10, and three of the top five risks are authorization failures. A caller who can change an ID in a request and read another user's data is the most common serious API flaw.

Do I need an API gateway for API security?

A gateway helps, because it can enforce authentication, rate limits and schema checks in one place. It does not replace authorization checks inside your services, though. A gateway cannot know whether a specific user owns a specific record.

Are API keys enough to secure an API?

No. API keys identify a project or integration, not a person, and they are often shared or leaked. Use OAuth 2.0 or OpenID Connect for user-facing APIs, short-lived tokens, and mutual TLS or signed tokens for service-to-service calls.

How often should API keys be rotated?

Rotate keys on a schedule your team can sustain, such as every 90 days, and immediately if a key is exposed in code, logs or a breach. Store keys in a secrets manager, never in source code, and give each integration its own key so you can revoke one without breaking the rest.

Should internal APIs be secured too?

Yes. Internal APIs are a common target once an attacker gets a foothold, and a compromised partner or employee account can reach them. Apply the same rules inside your network: authenticate every call, check authorization, and log access.

How do I test my API security?

Test in staging with real attack patterns: change IDs in requests, call admin endpoints with a normal account, add extra fields to updates, send oversized pages and bursts of requests, and try expired or forged tokens. Fix what you find, then repeat the tests after every major change.

Sources

  1. OWASP — API Security Project
  2. OWASP Developer Guide — API Top 10
  3. Cloudflare — What is the OWASP API Security Top 10?
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 edition) and the OWASP Developer Guide.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

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

Start free