API stands for Application Programming Interface. An API defines how applications request data, trigger functions and exchange results. It is the controlled boundary between a provider and its clients, such as a mobile app, web frontend, partner service or internal system.
How does an API work?
Many APIs use a client-server model. The client sends a request to a defined endpoint with a method, parameters, headers and, where needed, a body. The server verifies identity, authorization and inputs, processes the action and returns data together with a status code.
GET /api/orders/4711 HTTP/1.1
Host: example.test
Authorization: Bearer <access-token>
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
{"id":4711,"status":"processing"}
A technically valid token is not sufficient. The server must also verify that this identity may read this particular order. Missing object-level authorization commonly creates an IDOR vulnerability.
What types of API are there?
| Style or protocol | Characteristics | Typical use |
|---|---|---|
| REST | Resources, HTTP methods and commonly JSON; REST is an architectural style rather than a separate protocol. | Web, mobile and partner APIs. |
| GraphQL | Clients specify required fields in a query; a schema describes types and operations. | Flexible frontends and composed data models. |
| SOAP | XML messages, formal contracts and established extensions for enterprise requirements. | Legacy enterprise and integration systems. |
| RPC/gRPC | Calls defined functions; gRPC commonly uses Protocol Buffers and HTTP/2. | Internal, strongly typed service communication. |
| WebSocket | A long-lived bidirectional connection instead of separate request-response exchanges. | Chat, live data and other real-time applications. |
| Webhook | One system actively notifies another when an event occurs. | Payment status, CI/CD and integrations. |
The choice affects the data model, error handling and security controls. The WebSockets article explains risks of bidirectional connections, while the GraphQL article covers schemas, queries and resolver security.
Authentication and authorization
Authentication establishes who is making a request. Authorization decides what that identity may do with each operation and object. API keys often identify an application, but are not automatically suitable for user login or fine-grained permissions. Delegated access commonly uses OAuth 2.0 and OpenID Connect. Access tokens-often JSON Web Tokens-must be checked for signature, issuer, audience, lifetime and intended purpose.
Which API vulnerabilities matter most?
| Risk area | Typical problem | Detailed article |
|---|---|---|
| Object access | An identifier is accepted without checking permission for the referenced object. | Broken Access Control and IDOR |
| Data binding | Unexpected fields such as role, price or owner can be set. | Mass Assignment |
| Business processes | Individually valid actions can be executed in an unauthorized sequence or quantity. | Business Logic Vulnerabilities |
| Server-side requests | Import, preview or webhook functionality calls uncontrolled destinations. | SSRF |
| Resource consumption | Unbounded queries, batching or large responses exhaust backends and databases. | Rate Limiting and DoS |
| Trust boundaries | Browser origins, redirects or external data are trusted incorrectly. | CORS Misconfiguration and Open Redirect |
How is an API designed securely?
- Inventory and contract:
Document endpoints, versions, owners, data classifications and dependencies. Include undocumented and legacy versions. - Explicit inputs:
Validate allowed fields, types, ranges and object sizes on the server; reject unknown properties. - Authorization per action:
Check role, tenant, object relationship and state transition on every request-not only at login. - Resource limits:
Limit rate, concurrency, query depth, page size, uploads and execution time according to the endpoint. - Safe output:
Return only required fields, avoid internal details in errors and prevent uncontrolled caching of sensitive responses. - Monitoring:
Record failed authorization, unusual object access and high error rates with a request ID, but never log tokens or unnecessary personal data.
Documentation, versioning and testing
OpenAPI describes REST-oriented interfaces in a machine-readable form; a GraphQL schema serves part of that purpose for GraphQL. Documentation should cover authentication, errors, limits, data models and examples without exposing production credentials. Changes need a clear compatibility and retirement strategy. Security reviews combine contract analysis, source review and manual tests using different roles and tenants. Automated scanners find known patterns, but rarely understand whether a business process can be abused in context.
Thank you for your feedback! We will review it and optimize this content.
Do you have feedback on API? Tell us!
APIs are excellent targets for attacks. We help you to design your API securely and prevent successful attacks.
Damian Strobel - CEO
Additional Services
Comprehensive IT security solutions for complete protection
Red Teaming
Simulation of real attacks on your company including people, infrastructure and processes. A comprehensive approach to testing your entire security strategy.
Learn morePhishing Exercises
Practical phishing simulations to raise employee awareness. Increase awareness and reduce the risk of successful email-based attacks.
Learn more