API security explained in plain terms is the practice of protecting the interfaces that let software systems talk to each other, so that only the right people and systems can reach the right data and actions. The central question is why these interfaces need their own kind of security, and the short answer is that an API exposes an application’s data and functions directly to the outside world, and anything it fails to check becomes an open door.
Almost every modern application depends on APIs. A phone app fetches data from an API, a website loads content through one, and businesses connect their systems to partners through them. Each API is a doorway into the application behind it.
Securing those doorways matters because attackers do not need to break into a server when an API will hand them the data, if it is asked in the right way.
Key takeaways
- API security protects the interfaces that let software systems exchange data and trigger actions.
- The most common API flaws are broken authorisation, broken authentication, and returning more data than the caller should see.
- Authentication proves who the caller is, while authorisation decides what that caller is allowed to do.
- Good API security layers several controls: authentication, authorisation, input validation, rate limiting, and monitoring.
- APIs should be inventoried, tested, and monitored like any other part of the system, not left undocumented.
What an API is and why it needs security
An application programming interface, or API, is a set of defined ways for one piece of software to ask another for data or actions. A typical web API accepts requests over the internet, each one naming an operation and carrying some data, and returns a response. The application behind the API trusts the requests it receives, within limits, and acts on them: looking up a record, updating an account, or starting a process.
That trust is what makes APIs useful and what makes them risky. A web page hides much of an application behind its interface, showing each user only what they should see. An API exposes the underlying operations directly, so its security depends entirely on the checks it performs itself.
If an API fails to check whether the caller is allowed to see a particular record, anyone who guesses the record’s identifier can fetch it. If it fails to validate input, an attacker can send data designed to break or manipulate the system behind it.
The most common API weaknesses
The best-known catalogue of API weaknesses is the OWASP API Security Top 10, a list maintained by the Open Web Application Security Project. Its leading items have stayed consistent across editions. Broken object level authorisation means an API lets a caller access an object, such as another user’s order or document, by simply changing an identifier in the request.
Broken authentication means the login and token mechanisms can be bypassed or abused. Excessive data exposure means an API returns whole records when the caller only needs part of them, relying on the client to filter out the rest.
Other common weaknesses include missing rate limits, which let an attacker make unlimited requests, and weak input validation, which lets unexpected data reach the system behind the API. There is also the problem of undocumented APIs: endpoints left over from development or old versions that nobody maintains but that still work, and that attackers can find and exploit. An API that nobody knows exists cannot be protected.
Authentication and authorisation
Authentication and authorisation are the two foundations of API security, and they are different jobs. Authentication proves who the caller is. Common methods include API keys, which identify a calling system, and tokens such as those issued through OAuth 2.0, which prove that a user has logged in and granted permission.
Tokens should expire, be sent only over encrypted connections, and be stored safely by the caller.
Authorisation decides what an authenticated caller is allowed to do. Every API operation should check that the caller is permitted to perform that action on that specific object, not merely that the caller is logged in. This check must happen on the server, for every request, because anything enforced only in the client can be bypassed by calling the API directly.
Our guide to identity and access management explains how organisations manage who users are and what they may do, and our guide to zero trust for small teams covers the principle of verifying every request rather than trusting the network.

Comparing API security controls
| Control | How it works | Main benefit | Main drawback |
|---|---|---|---|
| Authentication tokens | Proves the caller’s identity | Stops anonymous access | Tokens can be stolen if mishandled |
| Authorisation checks | Verifies permission per object | Stops users reaching others’ data | Must be applied to every endpoint |
| Input validation | Rejects unexpected data | Blocks injection and malformed requests | Needs care to avoid breaking valid use |
| Rate limiting | Caps requests per caller | Slows abuse and scraping | Can block legitimate bursts |
| API gateway | Central point enforcing policies | Consistent controls across APIs | Becomes a single point of failure |
Defence in depth for APIs
No single control secures an API; good security layers several. Encryption in transit, through TLS, protects requests and responses from being read or changed on the way. Input validation rejects data that does not fit the expected shape before it reaches the application.
Rate limiting caps how many requests a caller can make, slowing automated abuse. Logging records what was requested, by whom, and when, so that suspicious activity can be spotted and investigated.
An API gateway often sits in front of an organisation’s APIs, applying these controls consistently. The gateway can enforce authentication, apply rate limits, and validate requests before they reach the services behind it, so each service does not have to implement everything itself. Secrets such as API keys and signing keys need careful handling too: they should never be embedded in client code or shared in plain text.
Our guide to secrets management explains how to store and rotate them safely, and our guide to cloud security covers the wider environment most APIs run in.
What good practice looks like
Good practice starts with knowing what exists. An organisation should keep an inventory of every API it exposes, including old versions and internal ones, and remove what is no longer needed. Every API should be documented, and every endpoint should have an owner who is responsible for its security.
Good practice also means testing. APIs should be tested for the weaknesses in the OWASP list before release and regularly afterwards, including tests that try to access other users’ data by changing identifiers. Security should be part of the design, not added later: authentication, authorisation, and validation are far easier to build in from the start than to retrofit.
And when an incident does happen, logs should make it possible to see what was accessed, so the damage can be assessed honestly.
API security checklist
- Keep an inventory of every API, including old versions, and retire what is no longer needed.
- Require authentication on every endpoint, including internal ones, and use tokens that expire.
- Check authorisation on the server for every request, for the specific object being accessed.
- Return only the data the caller needs, never whole records for the client to filter.
- Validate all input on the server before it reaches the application behind the API.
- Apply rate limiting to slow automated abuse and scraping.
- Use TLS for all API traffic, and never accept credentials over unencrypted connections.
- Log API requests and monitor them for unusual patterns, such as sudden spikes or access to many records.
- Test APIs against the OWASP API Security Top 10 before release and regularly afterwards.
Frequently asked questions
What is API security?
API security is the practice of protecting the interfaces that let software systems exchange data and trigger actions. It covers authentication, authorisation, input validation, rate limiting, and monitoring, so that only the right callers can reach the right data and actions.
What is broken object level authorisation?
Broken object level authorisation is the weakness where an API lets a caller access an object belonging to someone else by changing an identifier in the request, for example fetching another user’s order by changing its number. It happens when the API checks that the caller is logged in but not that they are allowed to see that specific object.
What is the difference between authentication and authorisation?
Authentication proves who the caller is, for example by checking a token or API key. Authorisation decides what that caller is allowed to do, such as which records they may read or which actions they may perform. Both are needed: knowing who someone is does not by itself say what they may access.
Are API keys enough to secure an API?
No. An API key identifies a calling system, but it does not prove that the caller is allowed to perform a specific action on a specific object, and keys can be stolen if they are embedded in client code or shared carelessly. Keys should be combined with proper authorisation checks and, where users are involved, with user authentication.
What is an API gateway?
An API gateway is a central point in front of an organisation’s APIs that applies security policies consistently: authentication, rate limiting, request validation, and logging. It lets each service behind it focus on its own work while the gateway handles the shared controls.
How often should APIs be tested for security?
Before every release and regularly afterwards. APIs change frequently, and a new endpoint or a changed check can introduce a weakness. Testing against the OWASP API Security Top 10 is a good baseline, and monitoring live traffic helps catch problems that testing misses.
The bottom line
API security explained in one line is this: because an API exposes an application’s data and functions directly, it must check every request itself, proving who the caller is, verifying what they may do, and watching for abuse, with no endpoint left undocumented or untested.
Note: this article is general information about API security, not advice about a specific system. Security needs vary with the data and the risks involved, and systems handling sensitive data should be reviewed by qualified security professionals.







