API Security:
Protect Your Digital Attack Surface
APIs carry more business logic and sensitive data than any other interface. They are also the most attacked. This guide covers the OWASP API Top 10, authentication architecture, shadow API governance, penetration testing, and compliance -- sourced from NIST, OWASP, and industry research.
What Is API Security?
API security is the practice of protecting application programming interfaces from exploitation, misuse, and unauthorized access. APIs serve as the connective tissue between applications, microservices, cloud infrastructure, and third-party integrations. When an API is compromised, attackers gain direct access to backend systems and the data they process.
Unlike traditional web application attacks that exploit rendering logic or browser behavior, API attacks target business logic, authorization models, and data exposure at the programmatic layer. A single misconfigured endpoint can expose millions of records without triggering a traditional web application firewall.
Who Needs This
84% of organizations experienced an API security incident in the past 12 months -- the third consecutive year of increases. The average remediation cost in the US is $591,000 per incident. API breaches leak 10x more data than traditional web application breaches. As organizations adopt microservices, AI agents, and third-party integrations, the API attack surface expands faster than security teams can inventory it.
Key Concepts
API security spans authentication (proving identity), authorization (enforcing access), input validation (preventing injection), rate limiting (stopping abuse), encryption (protecting data in transit), and governance (knowing what APIs exist). This page covers each domain with practitioner-level depth.
The API Threat Landscape
OWASP API Security Top 10 (2023)
Key API Security Terms
Securing the API Layer
API Producer Lifecycle: 8 Security Stages
Use threat intelligence and regulatory contexts (GDPR, HIPAA, PCI DSS) to shape security user stories. Define abuse cases -- hypothetical scenarios of how features could be subverted -- to force early visibility into mitigation pathways.
Pre-configured governance rules ensure compliance from the start. Threat modeling at this stage prevents costly retrofits. Secure design is built into the system blueprint, not bolted on later.
Version control and code reviews provide auditable provenance for every commit. Strict input validation prevents injection attacks. Type safety and parameterized queries are non-negotiable.
Software Composition Analysis (SCA) runs in parallel to identify vulnerable open-source dependencies. Contract tests verify that the API's actual behavior matches its OpenAPI specification, preventing unauthorized changes to the API surface.
This phase focuses entirely on identifying security vulnerabilities before deployment. Scanning covers broken access controls, injection points, misconfigured CORS policies, and exposed sensitive data.
Collect software telemetry -- metrics, logs, and traces -- to observe code behavior in real environments. The API gateway enforces rate limiting, schema validation, and authentication at the edge.
Use OpenTelemetry or Jaeger to trace requests across services. Correlate API calls with downstream effects in databases, queues, and storage layers. Configure monitors for authentication failures, rate limit breaches, and unusual access patterns.
Internal teams discover and consume APIs in a controlled environment. The catalog becomes the single source of truth for what APIs exist, who owns them, and what security controls are applied. APIs not in the catalog are candidates for decommissioning.
Shadow APIs, Zombie APIs & the Governance Gap
Shadow APIs are undocumented endpoints that bypass formal security review. They lack authentication, rate limiting, and input validation. 50% of enterprise API traffic flows through shadow endpoints.
Zombie APIs are deprecated endpoints that were never fully decommissioned. They remain live on legacy load balancers and expose old vulnerabilities patched in current versions. 31% of malicious API attacks target shadow and zombie endpoints.
Shadow API Risk Maturity Model
MTTD: Mean Time to Detection for new endpoints. Shadow API Coverage Ratio: % total APIs inventoried vs discovered. Inventory Completeness Score: % APIs with owners, docs, and controls. MTTR: Days from detection to secure/deprecate.
API Penetration Testing Methodology
- Route enumeration via wordlists
- Exposed OpenAPI/Swagger discovery
- Subdomain and endpoint fuzzing
- Authentication bypass testing
- Role-based access control testing
- BOLA and BFLA exploitation
- SSRF and injection testing
- Business logic abuse scenarios
- Source code review for auth flaws
- Hardcoded secret detection
- Dependency vulnerability analysis
- Complete coverage guarantee
SAST analyzes source code without executing it -- catches risky code paths, unvalidated inputs, and hardcoded secrets during development. DAST interacts with the running API from outside -- finds injection points, authentication bypasses, and configuration errors in staging/production. SCA identifies vulnerable open-source dependencies. All three should run automatically in CI/CD pipelines, blocking vulnerable deployments before they reach production.
API Security Compliance Requirements
- TLS 1.2+ encryption for all API traffic
- Regular API penetration testing
- Input validation and rate limiting
- Secure endpoint configuration audit
- OAuth 2.0 / OpenID Connect authentication
- RBAC and ABAC access controls
- Tamper-proof audit logs for all data access
- Business Associate Agreements for API vendors
- Data minimization in API responses
- Support for data erasure requests
- Tokenization / pseudonymization of PII
- Comprehensive logging for audit trails
API Security & Compliance Controls
Requirement 2: Apply secure configurations, including API gateway hardening.
Requirement 7: Restrict access to system components — applies to API authorization controls.
Requirement 11: Test security regularly — includes API penetration testing.
CC6.6: System boundaries — API gateway as the system boundary enforcement point.
CC6.7: Data transmission — TLS/mTLS for API communications.
CC7.1: Monitoring — API traffic monitoring and anomaly detection.
A.8.24: Use of cryptography — API token encryption and TLS requirements.
A.8.25: Secure development lifecycle — API design reviews and security testing.
A.8.26: Application security requirements — API input validation and output encoding.
PR.DS: Data security — API data-in-transit and at-rest protections.
PR.PS: Platform security — API gateway and infrastructure hardening.
DE.CM: Continuous monitoring — API traffic analysis and threat detection.
API Security Certifications
API Security Articles
Start Securing Your API Attack Surface
Explore the full Application Security pillar -- API security, OWASP Top 10, secure coding, and DevSecOps integration. Practitioner resources, no sales pitch.