Skip to content

General

API Security Best Practices: A Practical Guide to Protecting Your APIs

A practical guide to API security: the vulnerabilities attackers exploit, authentication, authorization, TLS, validation, rate limits, monitoring and testing.

APIs connect mobile apps, web frontends, partner integrations, internal microservices and, more and more, AI agents. Every one of those connections is a door into your data. Attackers know this, and they rarely bother with the network perimeter when an endpoint will hand them another customer's records because nobody checked who was asking.

This guide covers API security from end to end. It starts with why APIs need their own approach and which vulnerabilities attackers actually exploit, then works through the controls that stop them: authentication, tokens, authorization, transport encryption, input validation, rate limiting, security headers, gateways, monitoring and testing. It closes with how to turn those controls into a strategy, how to protect legacy APIs you cannot rewrite, and a short list of things you can do this week.

Why APIs need their own security approach

Traditional security tools such as network firewalls and intrusion detection systems work at the network level. They decide which hosts and ports can talk to each other. Most API attacks do not look like network attacks at all. They are well formed HTTPS requests from an authenticated client that abuse the application's logic.

Take a banking API that lets users transfer money. A firewall happily lets a logged in user call POST /transfers, because that is exactly what the endpoint is for. It cannot tell whether the from_account in the request body actually belongs to that user. Only the API itself can make that decision, which is why API security has to live in the API: in its design, its code and the infrastructure directly in front of it.

The problem grows with the size of the ecosystem. A typical organisation runs public APIs, partner APIs, internal service-to-service APIs and third party APIs it consumes. Some were built years ago, some are undocumented, and some nobody remembers. Each one is a potential entry point.

Every API security programme rests on a handful of core concepts:

  • Authentication: verifying who is making the request.
  • Authorization: deciding what that caller may do, on which objects.
  • Confidentiality and integrity: keeping data unreadable and untampered in transit.
  • Input validation: accepting only data that matches what the API expects.
  • Rate limiting: controlling how much any one caller can do.
  • Visibility: logging, monitoring and testing so you notice problems before attackers exploit them.

The rest of this guide takes these one at a time.

The vulnerabilities attackers actually exploit

The OWASP API Security Project maintains the best known list of API risks, the OWASP API Security Top 10. You do not need to memorise it, but you should recognise the patterns below, because they appear in real breaches again and again.

Broken object level authorization (BOLA)

BOLA is the classic API flaw. An endpoint such as GET /api/users/1042/invoices returns data for whatever ID the caller puts in the path. The API checks that the caller is logged in, but not that user 1042 is the caller. An attacker changes the number and reads other customers' invoices. It is simple, common and often leads to large data leaks, because IDs are easy to enumerate.

Broken function level authorization (BFLA)

BFLA is the same mistake one level up. Instead of reaching another user's object, the attacker reaches a function they should not have: an admin endpoint such as DELETE /api/users/{id} or POST /api/roles that only checks for a valid session, not for an admin role. A regular user who guesses or discovers the route escalates their privileges.

Injection attacks

Injection happens when an API passes untrusted input into an interpreter: a SQL query, a NoSQL filter, a shell command or a template. A login endpoint that builds WHERE username = ' plus the input plus ' can be bypassed with input that makes the condition always true. NoSQL databases are not immune either: a JSON body that sends an operator object where a string was expected can change the meaning of a query.

Broken authentication

Weak authentication lets attackers impersonate legitimate users. Typical causes are guessable or leaked API keys, tokens that never expire, missing signature checks on JWTs, credentials sent over plain HTTP, and login endpoints with no protection against credential stuffing.

Excessive data exposure

Many APIs return entire database records and leave it to the client to show only the relevant fields. The hidden fields still travel over the wire: internal IDs, email addresses, password hashes, flags such as is_admin. Anyone who reads the raw response gets them, and they give attackers a map of your data model for the next attack.

Mass assignment

The mirror image of excessive exposure: the API binds every field in the request body to the model. If the user object has a role property, a caller can send "role": "admin" in a profile update and the framework saves it.

Vulnerability What goes wrong Primary defence
BOLA Caller reads or changes objects that are not theirs Ownership check on every object access
BFLA Caller reaches functions above their role Role checks per endpoint, deny by default
Injection Untrusted input reaches an interpreter Parameterised queries, schema validation
Broken authentication Attackers impersonate users or clients Standard protocols, short-lived tokens, MFA
Excessive data exposure Responses carry fields the client never needed Explicit response schemas
Mass assignment Request bodies overwrite protected fields Allow lists of writable fields

Notice how few of these a firewall can see. Every row is fixed in the API's own logic or in a layer that understands the API's schema.

Authentication with OAuth 2.0 and OpenID Connect

Authentication is the foundation every other control builds on. For anything beyond simple server-to-server calls, the industry standard is OAuth 2.0 combined with OpenID Connect.

OAuth 2.0 is an authorization framework. It lets a user grant an application limited access to their resources without handing over their password. A useful analogy is a valet key: the valet can drive your car, but cannot open the boot or the glovebox. OAuth itself says nothing about who the user is; it only describes what the application may do.

OpenID Connect (OIDC) adds the missing identity layer on top of OAuth 2.0. To stay with the analogy, it is the driver's licence check at the valet desk. OIDC standardises how an application verifies who the user is and obtains basic profile information, and it is what makes single sign-on across applications work.

A typical authorization code flow looks like this:

  1. The client application redirects the user to the authorization server.
  2. The user signs in there and approves the requested scopes.
  3. The authorization server returns a short-lived authorization code to the client.
  4. The client exchanges the code for an access token, and usually a refresh token and an ID token.
  5. The client calls the API with the access token, and the API validates it before serving the request.

The key property is that the client never sees the user's password. It holds a token that is limited in scope and time and can be revoked.

When to use OAuth and OIDC

Use OAuth 2.0 whenever a third party application, a mobile app, a single page application or an AI client needs to act on a user's behalf. Use OIDC whenever you also need to know who the user is. Plain API keys are still fine for simple server-to-server integrations where one backend calls another, as long as they are managed carefully; the trade-offs are covered in OAuth or API key and key handling in API key management.

Strengths and costs

OAuth and OIDC remove credentials from client applications, provide fine-grained scopes, centralise authentication in one identity provider and are supported by every major platform and library. Identity providers such as Auth0, Okta, Microsoft Entra ID and AWS Cognito implement them so you do not have to.

The costs are real too. The specifications are large, and a hand-rolled implementation is easy to get wrong. Tokens must be stored and revoked properly, and a careless redirect handling or missing state parameter opens the door to cross-site request forgery and code interception.

Implementation tips

  • Use HTTPS for every leg of the flow. Tokens and codes are bearer credentials.
  • Use PKCE (Proof Key for Code Exchange) for public clients such as mobile apps and single page applications, and ideally for every client. It stops an intercepted authorization code from being redeemed.
  • Request the narrowest scopes the client needs, and design your scopes so that narrow ones exist.
  • Keep access tokens short-lived and refresh tokens revocable. A stolen access token then expires quickly.
  • Validate every token on the server. Never trust a token because it looks right.
  • Use an established library or identity provider rather than writing your own OAuth server.

For a wider comparison of basic auth, API keys, OAuth, JWT and mutual TLS, see API authentication methods.

JWTs and token management

JSON Web Tokens (JWTs) are the most common format for access tokens and ID tokens. A JWT is a compact string with three parts separated by dots:

  1. Header: the token type and the signing algorithm, for example RS256.
  2. Payload: the claims, such as the subject (user ID), issuer, audience, expiry time, scopes and roles.
  3. Signature: a cryptographic signature over the header and payload, so any change to the token is detectable.

Think of a JWT as a sealed envelope that carries its own credentials. The client sends it in the Authorization header:

Http
GET /api/orders HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...

The API verifies the signature and reads the claims without a database lookup. That statelessness is why JWTs suit distributed systems and microservices: any service holding the public key can validate a token on its own.

The trade-offs

Stateless tokens cannot be cancelled before they expire unless you add a revocation list or check a token introspection endpoint. Every claim you add makes the token larger, and it travels with every request. The payload is only encoded, not encrypted, so anyone holding the token can read it. And a stolen token works for whoever holds it until it expires.

Token management practices

  • Keep access tokens short-lived. Lifetimes of 15 to 60 minutes are a common choice, paired with refresh tokens so users stay signed in.
  • Validate everything: the signature, the alg value against an allow list (never accept none), the expiry, the issuer and the audience.
  • Prefer asymmetric signatures such as RS256 or ES256 when several services validate tokens, so only the issuer holds the private key.
  • Store tokens carefully. In browser apps, HttpOnly, Secure, SameSite cookies keep tokens away from JavaScript and reduce the impact of cross-site scripting. Avoid long-lived tokens in local storage.
  • Put only what you need in the payload, and never secrets or personal data the client should not see.
  • Plan for revocation: rotate refresh tokens on use, keep a deny list for high-risk applications, and revoke tokens when a user signs out or changes their password.

Multi-factor authentication

For user-facing sign-in flows behind your API, add multi-factor authentication, at least for administrators and sensitive operations. MFA belongs at the identity provider, so your API keeps receiving the same tokens while account takeover becomes much harder.

Authorization at the object and function level

Authentication tells you who is calling. Authorization decides what they may do, and it is where BOLA, BFLA and mass assignment live. These flaws are hard for generic tools to detect because the requests are perfectly valid; only your code knows the rules.

Check ownership on every object

Every handler that loads an object by ID must confirm that the caller may access that specific object. The safest pattern scopes the query itself to the caller:

Sql
SELECT * FROM invoices WHERE id = $1 AND account_id = $2

Here $2 comes from the validated token, never from the request. If the row does not exist for that account, return 404 rather than 403 so the response does not confirm that the object exists. Random, non-sequential IDs such as UUIDs make enumeration harder, but they are a second line of defence, not a substitute for the check.

Check roles on every function

Deny by default. Every route should declare which roles or scopes it requires, and a central middleware should enforce that before the handler runs. Keep admin functions on separate routes or a separate API, and test them with a regular user's token as part of your test suite.

Control what goes in and out

  • Writable fields: bind request bodies to an explicit allow list or a dedicated input schema, never directly to the database model.
  • Readable fields: shape responses through an explicit output schema or serializer, so new database columns do not leak automatically.
  • Least privilege everywhere: the same principle applies to service accounts, database users and API keys. A reporting service needs read access, not write access.

Encrypting traffic with TLS and forward secrecy

Transport Layer Security (TLS) encrypts traffic between client and server, verifies the server's identity through its certificate and detects tampering. Without it, tokens, keys and payloads cross the network in plain text, and anyone on the path can read or modify them. The older name, SSL, survives in conversation, but every SSL version is deprecated and should be disabled.

Perfect forward secrecy (PFS) adds an important property. With ephemeral key exchange (ECDHE), each session uses its own temporary keys. If the server's private key is stolen later, recorded past sessions still cannot be decrypted. TLS 1.3 makes forward secrecy mandatory; with TLS 1.2 you get it by choosing the right cipher suites.

Implementation tips

  • Support TLS 1.2 and 1.3 only. Disable SSL, TLS 1.0 and TLS 1.1.
  • Choose cipher suites with ECDHE key exchange and authenticated encryption such as AES-GCM or ChaCha20-Poly1305.
  • Send HSTS (Strict-Transport-Security) so browsers never fall back to HTTP, and reject or redirect plain HTTP requests to the API.
  • Automate certificate renewal. Let's Encrypt and the ACME protocol made free, automated certificates normal; an expired certificate is an outage you can prevent.
  • Encrypt internal traffic too. Service-to-service calls inside your network deserve TLS, and mutual TLS (mTLS) lets both sides authenticate each other.
  • Test your configuration with a scanner such as Qualys SSL Labs after every change.
  • Use certificate pinning only when you must, for example in a high-security mobile app, and plan how you will rotate pins before you ship.

Many providers enforce modern TLS for their own APIs; Stripe, for example, requires TLS 1.2 or higher for API calls. Treat TLS as a requirement for every API, not only those that handle payments or health data.

Input validation and sanitization

Input validation is your first line of defence against injection and logic attacks. The rule is simple: treat every value that arrives at the API as untrusted, and accept only what matches what you expect.

What to validate

  • Structure: describe request bodies with JSON Schema or an OpenAPI specification and validate every request against it. Unknown fields should be rejected or stripped.
  • Types and formats: an ID is an integer or a UUID, an email looks like an email, a date parses as a date.
  • Ranges and lengths: page sizes, quantities, string lengths and array sizes need upper limits, or a single request can exhaust memory.
  • Allowed values: prefer allow lists (only these characters, only these enum values) over deny lists that try to catch known bad input and are always incomplete.
  • Business rules: a transfer amount must be positive, a delivery date must be in the future.

A minimal schema for a create request might look like this:

JSON
{
  "type": "object",
  "additionalProperties": false,
  "required": ["email", "quantity"],
  "properties": {
    "email": { "type": "string", "format": "email", "maxLength": 254 },
    "quantity": { "type": "integer", "minimum": 1, "maximum": 100 }
  }
}

Libraries such as AJV for JavaScript and express-validator for Express, and the validation built into most modern frameworks, make this cheap to apply everywhere.

Sanitize for the context

Validation alone does not make data safe everywhere. Use parameterised queries or an ORM for databases instead of building query strings. Never pass input to a shell. When data is later rendered in HTML, encode it for HTML; when it goes into a URL, encode it for URLs. Each output context has its own encoding.

Tips

  • Validate at every layer, not only at the gateway. A gateway check is a useful first filter, but services must not assume their input was checked upstream.
  • Return clear validation errors that tell legitimate developers what to fix, without stack traces, SQL fragments or internal paths.
  • Keep schemas in sync with the API. Generating validation from the same OpenAPI document that produces your docs prevents drift.
  • Do not make rules so strict that they reject legitimate input, such as names with apostrophes or non-Latin characters. Overly strict validation pushes developers to switch it off.

Rate limiting and throttling

Rate limiting caps how many requests a client can make in a time window. It protects against denial of service, brute force attacks on login and token endpoints, credential stuffing, scraping and simple runaway scripts. It also keeps resources fair between customers.

How it works

Most implementations use one of a few algorithms:

  • Token bucket: each client has a bucket that refills at a steady rate; every request takes a token. Short bursts are allowed up to the bucket size.
  • Leaky bucket: requests drain at a constant rate, which smooths traffic but allows no bursts.
  • Fixed or sliding window: count requests per client per minute or hour and reject anything over the limit.

Limits can apply per API key, per user, per IP address, per endpoint or globally. Throttling is the softer cousin: instead of rejecting requests, it slows them down or queues them.

Communicate limits clearly

Clients behave better when they know the rules. Return the current state in headers on every response and use status 429 with Retry-After when a client goes over:

Http
HTTP/1.1 429 Too Many Requests
Retry-After: 30
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1735689600

GitHub's API is a good public example: it documents its limits and reports them in response headers, so client authors can adapt.

Tips

  • Set limits per endpoint by cost. A search or export endpoint deserves a tighter limit than a cheap read.
  • Put strict limits on authentication endpoints, and add lockouts or progressive delays after repeated failures.
  • Document the limits and offer higher tiers for legitimate heavy users rather than forcing them to work around you.
  • Ask clients to use exponential backoff with jitter when they receive 429 responses.
  • Use a shared store such as Redis for counters when the API runs on several servers, or the limit multiplies by the number of instances.
  • Also limit payload sizes, page sizes and query complexity, especially for GraphQL, where one request can be very expensive.

Security headers and CORS

When browsers call your API, HTTP response headers tell them how to treat the responses. A few headers close entire classes of attacks at almost no cost.

  • Strict-Transport-Security: forces HTTPS for your domain. Use a long max-age.
  • X-Content-Type-Options: nosniff: stops browsers from guessing content types and executing a response as script.
  • Content-Security-Policy: limits where scripts, frames and other resources may load from. For a pure JSON API, a strict policy such as default-src 'none'; frame-ancestors 'none' is appropriate.
  • X-Frame-Options: DENY or frame-ancestors 'none': prevents your responses from being framed, which blocks clickjacking.
  • Cache-Control: no-store on responses that contain personal or sensitive data, so they do not linger in shared caches.

Configuring CORS

Cross-Origin Resource Sharing decides which websites may call your API from a browser using the visitor's credentials. Misconfigured CORS is a common way to undo every other control.

  • List exact allowed origins in Access-Control-Allow-Origin. Do not reflect whatever Origin header arrives.
  • Never combine a wildcard origin with credentials. If cookies or authorization headers are involved, origins must be explicit.
  • Allow only the methods and headers you use.
  • Remember that CORS protects browsers, not your API. A script or server can call your endpoints regardless of CORS, so authentication and authorization still do the real work.

Tools such as Mozilla Observatory scan a site's headers and point out what is missing. Headers are easy to forget because nothing visibly breaks without them, so add them to your API framework's defaults and check them in automated tests.

API gateways, WAFs and dedicated security platforms

Some controls are best enforced once, in front of all your services, rather than reimplemented in each one. Three kinds of tools do this, and they complement each other.

API gateways

An API gateway is a reverse proxy that acts as the single entry point for API traffic. It authenticates requests, enforces rate limits, validates requests against schemas, routes traffic to backend services, terminates TLS and records metrics. Because policies live in one place, every service gets the same protection, and clients see one consistent interface regardless of how many microservices sit behind it. Common options include Amazon API Gateway, Kong, Google Apigee and Azure API Management.

A gateway must be built for resilience, because it sits on every request:

  • Scale it automatically for traffic spikes, and run more than one instance so it is not a single point of failure.
  • Use circuit breakers and timeouts so one failing backend does not tie up the gateway.
  • Watch its latency, since every millisecond it adds applies to every call.
  • Keep business authorization in the services. The gateway can check that a token is valid and has a scope; only the service can check that invoice 1042 belongs to the caller.

Web application firewalls

A WAF inspects HTTP traffic for known attack patterns such as SQL injection strings and malicious payloads, and many also offer bot protection and rate limiting. WAFs are mature and easy to put in front of existing systems, which makes them useful for legacy APIs. Their weakness is that they look for generic signatures and do not understand your API's logic, so BOLA and BFLA pass straight through.

Dedicated API security platforms

These platforms discover APIs from traffic, build an inventory including undocumented "shadow" endpoints, learn normal behaviour, flag anomalies and scan for vulnerabilities. They give the deepest API-specific coverage but take more effort to deploy and tune.

Tool category Strengths Weaknesses
API gateway Central auth, rate limits, routing and metrics Cannot enforce object level business rules
WAF Mature, quick to deploy in front of old systems Signature based, blind to API logic flaws
Dedicated API security platform Discovery, behaviour analysis, API-specific findings More complex to deploy, tune and maintain

When you compare products, ask how well they fit the size and complexity of your API estate, which of your actual risks they address, how they integrate with your existing infrastructure and CI pipeline, how much latency they add, and how much ongoing maintenance they need. No single tool removes all risk. Security comes from layers: a gateway and WAF at the edge, solid authorization in the code, and monitoring across all of it.

Monitoring and logging

Even well defended APIs get probed every day. Monitoring and logging are how you notice an attack in progress, investigate it afterwards and prove compliance.

What to log

For each request, log a timestamp, the caller identity (user, client or key ID, never the secret itself), the endpoint and method, the response status, latency, the source IP and a correlation ID. Log authentication failures, authorization denials, validation errors and rate limit hits explicitly, because those are the signals attacks produce.

Do not log passwords, tokens, API keys, full card numbers or other sensitive payloads. Logs are copied, shipped and retained, so anything sensitive in them becomes a second copy of your data with weaker protection.

Logging practices

  • Use structured logs (JSON lines with consistent field names) so tools can query them.
  • Propagate correlation IDs across services to trace one request through a distributed system.
  • Aggregate logs centrally, for example with the ELK stack (Elasticsearch, Logstash, Kibana) or a platform such as Datadog or Splunk.
  • Protect log integrity: write logs to storage that the application cannot alter, so an attacker cannot erase their tracks.
  • Set rotation and retention policies that match your compliance requirements and no more.

Dashboards and baselines

A good monitoring dashboard shows a small set of signals at a glance:

  • Request volume: sudden spikes can indicate denial of service or scraping; sudden drops can indicate an outage.
  • Error rates: a rise in 401, 403 or 404 responses often means someone is guessing credentials or enumerating IDs.
  • Latency: unusual patterns can reveal expensive abusive queries.
  • Geography and clients: requests from unexpected regions or user agents deserve a look.

Establish a baseline of normal behaviour from historical traffic, then alert on deviations: one client fetching thousands of different object IDs, a key suddenly used from a new country, a burst of failed logins. Anomaly detection, including machine learning features in commercial monitoring tools, can spot subtle patterns across large volumes of traffic that a person would miss.

People still matter

Automated alerts produce false positives, and too many of them lead to alert fatigue and missed real incidents. Tune alerts regularly, route them to people who can act, and keep a written incident response plan: who investigates, how to revoke compromised keys or tokens, how to block a client, and how to communicate with affected users.

Security testing

Monitoring catches problems in production. Testing catches them before they get there. Combine several methods, because each finds different flaws.

  • Automated scanning: tools such as OWASP ZAP scan APIs for known weaknesses, misconfigurations, missing headers and injection flaws. Run them against staging in your CI pipeline.
  • Authorization tests: for every endpoint, write tests that call it with another user's token and with a lower-privileged token, and assert that the API refuses. This is the most reliable way to catch BOLA and BFLA.
  • Fuzz testing: send malformed, oversized and unexpected input to see how the API copes. Crashes and odd errors often reveal validation gaps.
  • Penetration testing: experienced testers simulate real attacks, chaining small weaknesses together the way an attacker would. Schedule tests regularly and after major changes.
  • Dependency and secret scanning: check libraries for known vulnerabilities and scan repositories for committed keys.

Make security tests part of the normal build so they run on every change, not once a year.

Building an API security strategy that works

Individual controls only help if they are applied consistently. A strategy turns them into habits without slowing teams down.

Build security into the lifecycle

Security is cheapest at design time. Decide authentication, authorization rules, input schemas, rate limits and error handling while the API is still on paper, and review the design before anyone writes code. Then carry those decisions through development, testing and deployment instead of bolting them on at the end.

Keep an API inventory

You cannot protect an API you do not know exists. Maintain a complete list of your APIs with their owner, purpose, environment, authentication method and the data they handle. Include internal and deprecated versions, because forgotten old versions without current security controls are a favourite target. An inventory also tells you where to focus first: public APIs that handle personal or financial data.

Governance and requirements

Define clear standards that every API follows, such as "every endpoint declares its required scope" or "every request body has a schema", along with who owns security for each API and how findings are reported and fixed. Write requirements so they can be verified automatically through linting of OpenAPI documents, tests and CI checks rather than manual review alone.

Make policies practical

Policies that block developers get worked around. Focus on the risks that matter most, provide secure defaults in shared libraries and templates, and give examples of the right way instead of only forbidding the wrong one. A framework that validates input and checks scopes by default does more than any policy document.

Get support from leadership

API security needs time and budget. Explain the risk in business terms: the data each API exposes, the cost of a breach in customer trust and regulatory exposure, and how much of the business depends on APIs. Then report progress with simple metrics, such as the number of vulnerabilities found and fixed, the time it takes to fix them and the number of security incidents over time.

Securing legacy APIs

Older APIs are often the weakest, and they are rarely candidates for a full rewrite. You can still make real progress:

  • Put a protective layer in front. A gateway or WAF can add authentication, rate limits, schema validation and TLS without changing the legacy code.
  • Upgrade authentication and authorization first. Replace static shared keys with scoped credentials or tokens, and add ownership checks to the handlers that expose the most sensitive data.
  • Refactor gradually. Fix specific security issues one endpoint at a time rather than waiting for a rewrite that never comes.
  • Add monitoring early, so you learn how the API is actually used before you change it.
  • Retire what nobody needs. Old versions and unused endpoints are pure risk. Announce a deprecation date, watch the logs and switch them off.

API security when AI agents call your tools

More API traffic now comes from AI agents rather than humans or traditional apps. Assistants such as Claude, ChatGPT and coding agents in editors call tools on a user's behalf, and the Model Context Protocol (MCP) has become a common way to expose those tools. The same principles apply, with a few extra emphases:

  • Use OAuth for connectors that act for a user, so the agent holds a scoped, revocable token rather than a password.
  • Scope tools narrowly. An agent that only needs to read data should not hold a token that can delete it.
  • Treat model-generated arguments as untrusted input. Validate them with the same schemas you use for any other client.
  • Rate limit per account, because an agent in a loop can send far more requests than a person.
  • Log tool calls with the account and tool name so you can audit what an agent did.

MultitaskAI is built along these lines: it is a remote MCP server that gives AI agents a set of exact tools, including DNS, WHOIS and SSL certificate lookups, JSON repair and regex testing, through one endpoint. Connectors in clients such as Claude and ChatGPT sign in with OAuth, editors and CLIs use an API key, and every signed-in account gets 100 free requests a day. If you want to check an API's certificate or DNS records from inside your assistant, see the tools and the docs, or read what an MCP server is for the background.

Where to start this week

If this list feels long, start with an assessment and a few high-impact fixes:

  1. Inventory your APIs. List every API, its owner and the data it handles.
  2. Scan them. Run an automated scanner such as OWASP ZAP against staging and fix the critical findings.
  3. Check authorization. For your most sensitive endpoints, try another user's ID with your token. If it works, fix that before anything else.
  4. Enforce strong authentication. Use OAuth or scoped, rotated keys; avoid long-lived shared secrets for sensitive operations.
  5. Validate input with schemas on every write endpoint.
  6. Turn on rate limits, starting with login, token and expensive endpoints.
  7. Verify TLS and headers with SSL Labs and Mozilla Observatory.
  8. Make sure you log authentication and authorization failures, and that someone sees the alerts.

Comparing the controls

Control Effort Main protection Best fit
OAuth 2.0 and OIDC High, use a provider Delegated, scoped access without shared passwords User-facing and third party access
JWT access tokens Moderate Stateless, verifiable identity in each request Microservices, distributed systems
Object and function authorization Moderate, per endpoint BOLA, BFLA, mass assignment Every API
TLS with forward secrecy Low to moderate Eavesdropping, tampering, impersonation Every API
Input validation Moderate Injection and logic attacks Every endpoint that accepts input
Rate limiting Moderate Abuse, brute force, denial of service Public and authentication endpoints
Security headers and CORS Low Browser-based attacks, cross-origin abuse APIs called from browsers
Gateway or WAF Moderate to high Consistent edge policies, legacy protection Many services or old systems
Monitoring and logging Moderate Detection and investigation Every production API
Security testing Moderate, ongoing Flaws found before release Every API under active development

Conclusion

API security is not one product or one setting. It is a set of layers that each close a different door: standard authentication with short-lived tokens, authorization checks on every object and function, TLS everywhere, strict input validation, rate limits, sensible headers, a gateway at the edge, and monitoring and testing that tell you when something slips through.

Start with what you have. Inventory your APIs, fix the authorization holes in the most sensitive ones, and add the cheap protections such as TLS, headers and rate limits. Then build the rest into how your team designs and ships APIs, so new endpoints are secure by default and old ones get safer with every release.

Give your agent 433 tools in a minute

Connect MultitaskAI to your MCP client and ask in plain words. 100 requests a day are free.