What are API Security Standards?
API security standards focus on protecting data, ensuring authorization, and preventing abuse through protocols like OAuth 2.0/2.1 for authorization, OpenID Connect (OIDC) for authentication, and JSON Web Tokens (JWT). Essential practices include enforcing HTTPS (TLS 1.2+), input validation, rate limiting, and comprehensive logging. These standards prevent common threats like unauthorized access, data breaches, and injection attacks.
Essential API security best practices:
- Rate limiting and throttling: Prevent DoS attacks and abuse by setting limits per user or IP address.
- Input sanitization: Sanitize inputs to prevent injection attacks (SQLi, XSS, Command Injection).
- Secure header usage: Implement security headers like Content Security Policy (CSP) and HTTP-only cookies to mitigate XSS.
- API gateway: Use an API gateway for centralized authentication, authorization, and rate limiting.
- Logging and monitoring: Maintain comprehensive, audited logs for auditing and anomaly detection.
- Mass assignment protection: Explicitly define which fields can be updated to prevent unauthorized data modification.
In this article:
1. OWASP API Security Top 10
The OWASP API Security Top 10 is a recognized framework that highlights critical security risks specific to APIs. It covers issues such as broken object-level authorization, excessive data exposure, lack of resources and rate limiting, and improper asset management. The framework serves as a reference for developers and security teams to understand the primary threats facing modern APIs and prioritize mitigation strategies.
By addressing each item on the OWASP API Security Top 10, organizations can reduce their attack surface. The list is updated periodically to reflect emerging threats and industry trends, making it a current resource for tracking new vulnerabilities. Adoption of these recommendations improves API security posture and ensures that security considerations are integrated throughout the API development lifecycle.
2. NIST API and Web Services Security Guidance
The National Institute of Standards and Technology (NIST) provides guidance for securing APIs and web services, notably in publications such as NIST SP 800-95 and SP 800-204. These documents cover secure design, deployment, and management of APIs, emphasizing access control, input validation, and secure communication protocols. NIST standards are widely used in government and regulated industries as a baseline for technical and organizational controls.
NIST's approach includes recommendations for continuous monitoring, incident response, and integration with broader cybersecurity frameworks. Following NIST guidelines helps organizations meet federal requirements and align with industry best practices. These standards also support compliance efforts and provide a foundation for risk assessment and mitigation.
3. OAuth 2.0 Security Best Current Practice
OAuth 2.0 is the industry-standard protocol for authorization, allowing applications to access resources on behalf of users without sharing credentials. The OAuth 2.0 Security Best Current Practice document, maintained by the IETF, addresses known vulnerabilities in earlier implementations and recommends secure patterns for token usage, client authentication, and redirect handling. It focuses on preventing attacks such as token leakage, code injection, and replay attacks.
Implementing OAuth 2.0 according to these practices strengthens authorization flows, especially in distributed and mobile environments. The document advises using Proof Key for Code Exchange (PKCE), short-lived tokens, and securing confidential client credentials. Following these guidelines reduces the risk of unauthorized access and improves trust in API integrations.
4. OpenID Connect
OpenID Connect is an authentication protocol built on top of OAuth 2.0, providing a standardized way to verify user identities and obtain basic profile information. It adds an identity layer to OAuth, using JSON Web Tokens (JWTs) for interoperable identity assertions. OpenID Connect is widely adopted for single sign-on (SSO) scenarios, enabling consistent user experiences across applications while maintaining security.
The protocol defines endpoints, scopes, and flows that support web, mobile, and native applications. It also specifies mechanisms for user consent, session management, and revocation, making it suitable for enterprise environments. Using OpenID Connect allows organizations to implement secure authentication without relying on custom solutions.
5. TLS and HTTPS
Transport Layer Security (TLS) is the standard protocol for encrypting data in transit between clients and servers, with HTTPS being HTTP layered over TLS. Using TLS ensures that API requests and responses are protected from eavesdropping, tampering, and man-in-the-middle attacks. All sensitive API traffic should be transmitted over HTTPS, using strong cipher suites and up-to-date certificates.
Enforcing TLS across API endpoints is a requirement in security standards and compliance frameworks. Regularly updating TLS configurations, disabling deprecated protocols, and implementing strict certificate validation are critical steps for maintaining secure communications. TLS protects sensitive information and establishes trust between API consumers and providers.
REST API Security Standards
REST APIs are the most common type of web APIs, and their security standards focus on stateless communication, standard HTTP methods, and resource-oriented design. Security recommendations include strict authentication and authorization, input validation, and least-privilege access. REST APIs should use HTTPS, implement proper CORS policies, and use frameworks like OAuth 2.0 for access control.
REST API security standards also advise rate limiting, logging, and structured error handling to prevent abuse and information leakage. RESTful APIs should avoid exposing sensitive implementation details in URLs, responses, or headers. Following these standards helps defend against injection attacks, data exposure, and unauthorized resource access.
GraphQL API Security Standards
GraphQL APIs introduce security challenges due to flexible query capabilities, which can expose large data sets or enable denial-of-service attacks. Security standards for GraphQL APIs emphasize strong authentication, query complexity analysis, and depth limiting to control resource consumption. Implementing granular authorization checks at the resolver level ensures users can access only permitted data.
Input validation and error handling are also critical to prevent injection and information disclosure. Best practices include using persisted queries, disabling introspection in production, and logging query activity. Adhering to these standards helps reduce risks associated with GraphQL's dynamic query model and protects backend data.
SOAP and Web Services Security Standards
SOAP APIs and traditional web services rely on XML-based messaging and often operate in regulated environments. Security standards for SOAP APIs are defined by protocols such as WS-Security, which outlines mechanisms for message integrity, confidentiality, and authentication using XML signatures and encryption. SOAP APIs should use TLS for transport security and implement strict input validation to prevent XML-based attacks like XML External Entity (XXE) injection.
Access control in SOAP APIs is typically enforced through SAML assertions or token-based authentication, aligned with industry compliance requirements. Logging, auditing, and schema validation are also key components of SOAP API security standards. Following these protocols helps ensure secure exchange of structured data and supports regulatory obligations.
Internal and Microservices API Security
Internal APIs and microservices face different security challenges compared to external APIs due to their exposure within trusted network boundaries. Security standards emphasize mutual authentication, network segmentation, and service-to-service encryption using protocols like mutual TLS. Fine-grained access control and strict API gateway policies are recommended to prevent lateral movement within internal networks.
Monitoring, logging, and anomaly detection help identify unauthorized activity or misconfigurations in microservices architectures. Automated security testing and policy enforcement tools help maintain consistent security controls across changing environments. Following these standards reduces internal risk and supports secure service-to-service communication.
Uri Dorot
Uri Dorot is a senior product marketing manager at Radware, specializing in application protection solutions, service and trends. With a deep understanding of the cyber threat landscape, Uri helps companies bridge the gap between complex cybersecurity concepts and real-world outcomes.
Tips from the Expert:
In my experience, here are tips that can help you better implement and operationalize API security standards:
1. Treat standards as minimum baselines, not complete protection: Compliance with OWASP, PCI DSS, or SOC 2 does not stop business logic abuse, token replay, or workflow manipulation. Build controls beyond checklist requirements.
2. Enforce "security invariants" across all API types: REST, GraphQL, gRPC, and SOAP should share consistent authentication, authorization, logging, and rate-limiting policies despite protocol differences.
3. Validate JWTs defensively, not optimistically: Always verify issuer, audience, signature algorithm, token age, clock skew, and key rotation state. Many breaches happen because APIs only validate signatures.
4. Use asymmetric signing for distributed systems: Prefer RS256 or ES256 over shared-secret HS256 in multi-service environments to reduce blast radius and simplify key rotation.
5. Separate machine identity from user identity: Service accounts, bots, integrations, and humans should use distinct authentication flows, scopes, and monitoring baselines to improve detection and least privilege.
API Keys
API keys are unique identifiers used to authenticate requests to an API. They are simple to implement and widely used for basic access control, especially in public or low-risk APIs. API keys are typically sent in request headers or query parameters and should be kept confidential. However, API keys alone do not provide strong authentication or user identification, as they can be leaked or shared.
To improve security:
- API keys should be rotated regularly, assigned minimal permissions, and monitored for unusual usage patterns.
- Enforce HTTPS for all API key transmission and avoid exposing keys in client-side code or public repositories.
- API keys should be combined with other authentication mechanisms for sensitive or high-value APIs.
OAuth 2.0
OAuth 2.0 is the standard for delegated authorization, allowing applications to access resources on behalf of users without exposing credentials. It defines flows for web, mobile, and machine-to-machine applications, supporting granular permission scopes and token-based access. OAuth 2.0 separates authentication from authorization and enables revocable access for third-party applications.
Proper implementation involves:
- Using secure redirect URIs, short-lived access tokens, and refresh tokens for session continuity.
- Employing Proof Key for Code Exchange (PKCE).
- Enforcing confidential client authentication.
OAuth 2.0 is suitable for a range of API authentication scenarios, from consumer apps to enterprise integrations.
JSON Web Tokens
JSON Web Tokens (JWTs) are a compact, URL-safe format used to transmit claims between parties as a JSON object. A JWT consists of three parts: header, payload, and signature. The signature ensures token integrity and verifies that it was issued by a trusted authority. JWTs are commonly used in stateless authentication systems, where the server relies on the token for each request.
Security standards for JWT usage emphasize signing tokens with strong algorithms such as RS256, validating signatures on every request, and avoiding unsecured tokens (alg: none). Sensitive data should not be stored directly in the payload unless encrypted, as JWTs can be decoded.
Best practices include:
- Setting short expiration times.
- Using refresh tokens when needed.
- Implementing token revocation mechanisms.
Mutual TLS
Mutual TLS (mTLS) is an extension of TLS in which both the client and server authenticate each other using digital certificates. Unlike standard TLS, which verifies only the server's identity, mTLS ensures both parties are trusted before establishing a connection. This approach is commonly used in high-security environments, including microservices architectures and internal APIs.
To implement mTLS:
- Focus on issuing and managing certificates for participating services or clients.
- Each request is authenticated at the transport layer, reducing reliance on application-level credentials such as API keys or tokens.
- Security standards for mTLS recommend strict certificate validation, automated certificate rotation, and secure storage of private keys.
PCI DSS and Payment APIs
The Payment Card Industry Data Security Standard (PCI DSS) defines security requirements for handling cardholder data in payment APIs. These standards require encryption for data in transit and at rest, secure authentication mechanisms, and strict access controls. Payment APIs must avoid storing sensitive authentication data such as CVV codes and must tokenize or encrypt card numbers.
Compliance involves regular security testing, including vulnerability scans and penetration testing, as well as maintaining audit logs of API activity. Rate limiting, fraud detection, and anomaly monitoring help prevent abuse and unauthorized transactions. Aligning APIs with PCI DSS reduces the risk of data breaches and supports secure payment processing.
HIPAA and Healthcare APIs
The Health Insurance Portability and Accountability Act (HIPAA) sets requirements for protecting electronic protected health information (ePHI) in healthcare APIs. These standards focus on ensuring confidentiality, integrity, and availability of patient data. APIs must implement strong authentication, role-based access control, and encryption to prevent unauthorized access.
HIPAA compliance also requires audit controls to track access and modifications to ePHI, along with mechanisms for data integrity verification. Secure data transmission using TLS, strict user identity management, and breach notification procedures are required components. Organizations must also establish administrative safeguards, such as employee training and risk assessments, to support technical controls.
GDPR and Privacy Requirements
The General Data Protection Regulation (GDPR) governs the processing of personal data for individuals in the European Union and affects API design. APIs must support data protection principles such as data minimization, purpose limitation, and lawful processing. This includes collecting only necessary data, defining its use, and ensuring it is not retained longer than required.
Security requirements under GDPR include encryption, pseudonymization, and the ability to respond to data subject rights such as access, correction, and deletion requests. APIs should include consent management mechanisms and ensure that personal data is not exposed through logs or error messages.
SOC 2 and Enterprise API Security
SOC 2 is a compliance framework that evaluates how organizations manage customer data based on trust service criteria: security, availability, processing integrity, confidentiality, and privacy. For APIs, SOC 2 compliance requires strong access controls, secure authentication, and continuous monitoring to protect data and ensure reliable service delivery.
API security under SOC 2 also emphasizes logging, auditing, and incident response capabilities. Organizations must demonstrate that APIs are resilient against threats and that controls are enforced across environments. This includes secure development practices, configuration management, and regular risk assessments.
Step 1: Build an API Inventory
Start by identifying all APIs in your environment, including public, partner, and internal endpoints. This includes REST, GraphQL, SOAP services, and shadow or undocumented APIs deployed outside standard processes. Each API should be cataloged with details such as endpoints, data types handled, authentication methods, and owning teams.
An accurate inventory provides visibility into your attack surface. Without it, security gaps are likely. Automating discovery using API gateways or traffic analysis tools helps keep the inventory current as services evolve.
Step 2: Map APIs to Risk
Once the inventory is complete, classify each API based on the sensitivity of the data it processes and its exposure level. APIs handling financial data, personal information, or authentication flows should be categorized as high risk. Public-facing APIs generally carry more risk than internal ones, but internal APIs should not be assumed safe.
Risk mapping helps prioritize stricter controls. Consider factors such as data sensitivity, user access scope, regulatory requirements, and potential business impact of a breach. This step ensures that security efforts are focused where they matter most.
Step 3: Apply Security Controls
Implement security controls based on the risk classification. Common controls include strong authentication (OAuth 2.0, mTLS), fine-grained authorization, input validation, rate limiting, and encryption using TLS. High-risk APIs may require additional protections such as token binding, IP allowlisting, and threat detection.
Security controls should be enforced centrally where possible, using API gateways or service meshes. This reduces misconfiguration and ensures policies are applied uniformly. Proper secret management and secure key storage are also critical.
Step 4: Test Continuously
Security testing should be integrated into the development lifecycle rather than treated as a one-time activity. Use automated tools for static and dynamic analysis to detect vulnerabilities such as injection flaws, broken authentication, and misconfigurations. Regular penetration testing helps uncover issues automated tools may miss.
Testing should include negative and edge-case scenarios, such as malformed requests or abuse patterns. Incorporating security tests into CI/CD pipelines ensures vulnerabilities are caught before deployment. Continuous testing helps maintain security as APIs change.
Step 5: Monitor and Improve
Ongoing monitoring is required for detecting and responding to threats in real time. Implement logging and observability across API traffic, capturing request patterns, error rates, and authentication activity. Anomaly detection systems can identify suspicious behavior such as traffic spikes or repeated failed login attempts.
Use these insights to refine security controls and response strategies. Establish incident response procedures and review logs and metrics to identify trends or weaknesses. API security requires ongoing adjustment to address new threats, evolving usage patterns, and application changes.
Organizations can improve their API security by implementing the following best practices.
1. Rate Limiting and Throttling
Rate limiting controls how many requests a client can make within a defined time window, while throttling slows down or blocks excessive traffic. These controls protect APIs from abuse, denial-of-service attacks, and resource exhaustion. Limits can be applied per user, IP, API key, or endpoint.
Effective rate limiting requires the following:
- Use techniques such as token buckets or sliding windows.
- Responses should include clear status codes (e.g., 429 Too Many Requests) and retry headers.
- Applying stricter limits to sensitive endpoints and unauthenticated traffic reduces risk without disrupting legitimate usage.
- Limits can also be adjusted based on system load or user behavior.
- Trusted clients may receive higher quotas, while suspicious traffic is restricted.
2. Input Sanitization
Input sanitization ensures that incoming data is validated and cleaned before processing. APIs should treat all client input as untrusted, including headers, query parameters, and request bodies. This prevents attacks such as SQL injection, command injection, and cross-site scripting. Validation should enforce strict schemas, data types, and allowed values.
Considerations for input sanitization:
- Reject malformed or unexpected input early in the request lifecycle.
- Using parameterized queries and safe parsing libraries reduces risk by avoiding direct execution of user-supplied data.
- Normalization of input, such as trimming whitespace or standardizing formats, helps prevent bypass techniques.
- Schema validation tools like JSON Schema or OpenAPI validators enforce consistency across requests.
3. Secure Header Usage
HTTP security headers enforce safe communication and reduce attack surface. APIs should use headers such as Content-Security-Policy (CSP), X-Content-Type-Options, and Strict-Transport-Security (HSTS) to prevent content injection and enforce HTTPS usage. Headers should limit data exposure.
Considerations for ensuring secure header usage:
- Avoid revealing server details through headers like Server or X-Powered-By.
- Proper cache-control headers ensure sensitive responses are not stored in shared caches.
- Consistent header configuration strengthens baseline API security. Additional headers such as X-Frame-Options and Referrer-Policy reduce risks related to clickjacking and data leakage.
- APIs should validate incoming headers to prevent spoofing or header injection attacks.
4. API Gateway
An API gateway acts as a centralized control point for managing and securing API traffic. It handles authentication, authorization, rate limiting, request validation, and routing. Enforcing policies at the gateway reduces inconsistent security across services. Gateways also provide request transformation, logging, and threat detection.
They simplify security management in microservices architectures by separating security logic from application code. This reduces misconfiguration. Modern gateways often integrate with identity providers, web application firewalls, and service meshes. They can enforce zero trust principles by validating every request before it reaches backend services.
Considerations for API gateways:
- Centralize authentication, authorization, rate limiting, and request validation policies at the gateway.
- Integrate the gateway with identity providers, WAFs, SIEM platforms, and threat detection tools.
- Regularly review gateway configurations, access policies, and exposed endpoints to prevent misconfigurations and security gaps.
5. Logging and Monitoring
Logging captures records of API activity, including requests, responses, errors, and authentication events. Monitoring analyzes this data in real time to detect anomalies, performance issues, or attacks. Together, they provide visibility into API behavior. Logs should include context, such as user identifiers and timestamps, without exposing sensitive data.
Key points regarding logging and monitoring:
- Centralized logging systems and alerting mechanisms enable faster detection and response. Continuous monitoring helps maintain security as usage patterns evolve.
- Advanced setups use SIEM or observability platforms to correlate events across systems.
- Machine learning-based anomaly detection can identify attack patterns such as credential stuffing or slow-rate attacks.
- Retention policies and secure log storage are important for compliance and forensics.
6. Mass Assignment Protection
Mass assignment occurs when APIs automatically bind incoming request data to object properties without filtering. This can allow attackers to modify unintended fields, such as roles or permissions, leading to privilege escalation. To prevent this, APIs should define which fields are allowed for input.
Considerations for mass assignment:
- Use allowlists instead of blocklists and avoid directly mapping request payloads to internal models.
- Validating and controlling field-level access ensures only intended data is processed and stored.
- Framework-level protections, such as data transfer objects (DTOs) or serializers, can enforce strict input mapping.
- Code reviews and testing should verify that sensitive fields are not exposed for modification.
Implementing API security standards consistently is difficult when APIs change constantly and attackers target business logic that traditional controls miss. Radware API Security helps organizations operationalize these standards by continuously discovering APIs and learning their business logic in real time, then using AI-based analysis to generate and enforce accurate protection policies across any architecture or environment. Delivered as part of Radware's Cloud Application Protection Services, it provides real-time, accurate API protection that complies with PCI DSS 4.
Key capabilities of Radware API Protection:
- Automated API discovery: Finds API endpoints and undocumented changes, then generates tailored security policies, supporting the API inventory and risk-mapping steps central to API security standards.
- Business logic attack prevention: Continuously learns from real-time transactions to detect and stop sophisticated business logic attacks as they occur.
- Positive security model: Validates requests against the defined API schema and scans for embedded attacks, enforcing strict input and schema validation.
- Bot and account takeover protection: Blocks malicious bot and ATO activity targeting APIs, such as credential stuffing and scraping.
- Data leakage prevention: Inspects API responses and masks sensitive data such as credit card numbers and PII.
- API quotas: Limits the number of API calls per timeframe, per endpoint and source, to prevent abuse and resource exhaustion.
- API DDoS protection: Mitigates API DDoS attacks by automatically generating accurate attack signatures in real time.
- PCI DSS 4 compliance: Addresses the requirement to detect and protect against business logic vulnerability-based attacks.
- Consistent security: Applies uniform protection across all environments as part of Radware's Cloud Application Protection Services.