Skip to main content
New: Deck Doctor. Upload your deck, get CPO-level feedback. 7-day free trial.
TemplateFREE⏱️ 3-6 hours

API Security Template for Engineering Teams

A structured template for securing API endpoints covering authentication, authorization, rate limiting, input validation, and monitoring.

By Tim Adair• Last updated 2026-03-05
API Security Template for Engineering Teams preview

API Security Template for Engineering Teams

Free API Security Template for Engineering Teams — open and start using immediately

or use email

Instant access. No spam.

Need a custom version?

Forge AI generates PM documents customized to your product, team, and goals. Get a draft in seconds, then refine with AI chat.

Generate with Forge AI

What This Template Is For

APIs are the attack surface most product teams underestimate. Your UI might enforce perfect validation, but every API endpoint is accessible to anyone with curl and your base URL. A single misconfigured endpoint can expose customer data, allow privilege escalation, or enable denial-of-service attacks that take down your entire product.

This template provides a systematic approach to API security covering five layers: authentication (who is calling), authorization (what they can access), input validation (what they can send), rate limiting (how often they can call), and monitoring (how you detect abuse). It works for REST APIs, GraphQL endpoints, and webhook receivers.

Most teams bolt on security after the API is built. That approach leads to inconsistent enforcement, where some endpoints check auth and validate input while others skip it because "it is an internal endpoint." This template helps you define security policies before implementation, so every endpoint is covered from day one.

For PMs working on API products, the Technical PM Handbook covers the architecture decisions that affect API design. If you are also designing access control for your product's UI, the access control template covers role-based permissions. For a full security posture review, see the enterprise security review template.


How to Use This Template

  1. Inventory your endpoints. List every API endpoint, its HTTP method, and who should be able to call it.
  2. Choose your auth strategy. Select from the authentication options in Part 1 based on your use case.
  3. Define authorization rules. Map each endpoint to the roles or scopes that can access it.
  4. Set rate limits. Define limits per tier, per endpoint, and per client.
  5. Document input validation rules. For each endpoint, specify expected input types, ranges, and sanitization requirements.
  6. Configure monitoring and alerting. Define what abnormal traffic looks like and how you will respond.

The Template

Part 1: Authentication Strategy

Select the authentication mechanism for each client type. Most products need more than one.

Client TypeAuth MechanismToken LifetimeRefresh StrategyNotes
Web application (SPA)OAuth 2.0 + PKCE15 min access tokenRefresh token (7 days, rotated)Use httpOnly cookies for token storage, not localStorage
Mobile applicationOAuth 2.0 + PKCE15 min access tokenRefresh token (30 days, rotated)Pin SSL certificates to prevent MITM
Server-to-serverAPI key + HMAC signingNo expiration (rotated quarterly)Manual rotation with overlap windowRequire HMAC signature on all mutating requests
Third-party integrationsOAuth 2.0 client credentials1 hour access tokenRe-authenticate on expiryScope tokens to specific resources
Webhooks (outbound)HMAC signature verificationPer-requestN/AInclude timestamp in signature to prevent replay
Internal microservicesmTLS or service mesh tokensShort-lived (5 min)Auto-renewed by meshZero-trust between services

Authentication checklist:

  • All endpoints require authentication (no accidental public endpoints)
  • Tokens are transmitted only over HTTPS (HSTS enforced)
  • Access tokens are short-lived (< 1 hour for most use cases)
  • Refresh tokens are rotated on every use (detect token theft via reuse)
  • API keys are hashed at rest in the database (never stored in plaintext)
  • Failed authentication returns 401 with a generic message (no information leakage)
  • Brute-force protection: lock out after 10 failed attempts per IP per 15 minutes
  • All authentication events are logged (success and failure)

Part 2: Authorization and Scoping

Define what each authenticated identity can access. Use the principle of least privilege.

Endpoint authorization matrix:

EndpointMethodRequired Role/ScopeResource ScopingNotes
/api/v1/usersGETadmin:readOrg-scopedReturns only users in the caller's organization
/api/v1/usersPOSTadmin:writeOrg-scopedCannot create users with higher privilege than caller
/api/v1/projectsGETprojects:readOrg-scoped + membershipReturns only projects the caller is a member of
/api/v1/projects/:idPUTprojects:write + ownerResource-scopedOnly project owner or Admin can update
/api/v1/projects/:idDELETEadmin:writeResource-scopedSoft-delete with 30-day recovery window
/api/v1/billingGETbilling:readOrg-scopedSeparate from user data access
/api/v1/exportsPOSTdata:exportOrg-scopedRate limited to 1 per hour
/api/v1/webhooksPOSTintegrations:writeOrg-scopedValidate webhook URL is not internal

Authorization checklist:

  • Every endpoint explicitly declares its required scope or role
  • Authorization is checked at the API layer, not just the UI
  • Resource-level scoping prevents cross-tenant data access (IDOR prevention)
  • Privilege escalation is blocked: users cannot grant roles higher than their own
  • Bulk endpoints (list, export) enforce the same authorization as single-resource endpoints
  • 403 responses do not reveal whether the resource exists (return 404 for unauthorized access)

Part 3: Rate Limiting

Define rate limits to prevent abuse, protect infrastructure, and ensure fair usage.

TierGlobal LimitPer-Endpoint LimitBurst AllowanceRetry-After HeaderScope
Free100 req/min20 req/min10 req burstYesPer API key
Standard500 req/min100 req/min50 req burstYesPer API key
Enterprise2,000 req/min500 req/min200 req burstYesPer API key
Internal10,000 req/min2,000 req/min1,000 req burstYesPer service

Endpoint-specific limits:

Endpoint PatternAdditional LimitReason
POST /auth/*10 req/min per IPBrute-force prevention
POST /exports1 req/hour per orgResource-intensive operation
POST /uploads20 req/hour per userStorage cost control
GET /search60 req/min per userDatabase query cost
Webhook deliveries3 retries, exponential backoffPrevent overwhelming receivers

Rate limiting checklist:

  • Rate limits are enforced at the API gateway, not in application code
  • Limits use a sliding window algorithm (not fixed windows that allow bursts at boundaries)
  • Rate limit headers are included in every response (X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset)
  • 429 responses include Retry-After header with seconds until next allowed request
  • Rate limits are documented in your API reference for each endpoint
  • Different limits for read vs. write operations (reads are cheaper)

Part 4: Input Validation

Define validation rules for every input your API accepts.

Validation rules by input type:

Input TypeValidation RulesSanitizationMax Length
Email addressesRFC 5322 format, lowercase normalizedHTML entity encoding on output254 chars
User namesAlphanumeric + limited special charsStrip HTML tags, trim whitespace100 chars
Free text fieldsUTF-8 onlyHTML entity encoding on output, no script tags10,000 chars
URLsValid scheme (https only), no internal IPsResolve and check against SSRF blocklist2,048 chars
File uploadsValidate MIME type + magic bytes, not just extensionVirus scan, strip metadata50 MB
Numeric IDsPositive integer, within valid rangeType coercion to integerN/A
JSON payloadsSchema validation (JSON Schema or Zod)Reject unknown properties1 MB
Query parametersAllowlist of accepted paramsType coercion, range clamping500 chars per param
Paginationpage > 0, limit between 1-100Default to limit=20 if not specifiedN/A

Validation checklist:

  • All inputs validated on the server side (never trust client-side validation alone)
  • JSON schema validation rejects payloads with unknown properties
  • SQL injection prevention: use parameterized queries exclusively (no string concatenation)
  • XSS prevention: all user-generated content is escaped on output
  • SSRF prevention: URL inputs are validated against an internal IP blocklist
  • File upload validation checks MIME type via magic bytes, not just file extension
  • Request body size limits enforced at the web server and API gateway level
  • Error messages do not expose internal implementation details or stack traces

Part 5: Monitoring and Incident Response

SignalThresholdAlert ChannelResponse
Auth failure spike> 50 failures/min from single IPPagerDuty (P2)Auto-block IP for 1 hour, investigate
Rate limit violations> 100 429s/min from single keySlack #securityReview client, consider key revocation
Unusual data export> 10x normal export volumePagerDuty (P1)Pause export, verify with account owner
500 error spike> 5% error rate sustained for 5 minPagerDuty (P1)Investigate root cause, check for attack
New API key usage patternKey used from new IP/regionSlack #securityLog and monitor, no auto-action
Schema validation failures> 20 rejections/min from single clientSlack #engineeringLikely integration bug, contact client

Monitoring checklist:

  • All API requests are logged with: timestamp, client ID, endpoint, method, status code, response time, request size
  • Logs do not contain sensitive data (tokens, passwords, PII in request bodies)
  • Anomaly detection alerts on unusual traffic patterns (volume, geography, error rates)
  • Security events are streamed to SIEM for correlation with other signals
  • Incident response runbook exists for API security incidents (see incident response template)

Filled Example: ProjectFlow REST API

Product: ProjectFlow, a B2B project management API serving 500 integration partners.

Authentication implementation:

  • Third-party integrations use OAuth 2.0 client credentials with 1-hour access tokens
  • Web application uses OAuth 2.0 + PKCE with 15-minute access tokens and 7-day refresh tokens
  • All tokens are JWT with RS256 signing. Public key published at /.well-known/jwks.json
  • API keys are SHA-256 hashed at rest. Only the first 8 characters are shown in the dashboard for identification.

Rate limiting results (Q1 2026):

  • Implemented sliding window rate limiting at the API gateway (Cloudflare Workers)
  • Average utilization: 12% of limit for Standard tier, 3% for Enterprise tier
  • Blocked 47 brute-force attempts and 3 credential stuffing attacks in January
  • Zero false-positive blocks reported by legitimate customers

Top security finding from last audit:

  • Three internal endpoints (/api/internal/health, /api/internal/metrics, /api/internal/config) were accessible without authentication due to a misconfigured route prefix. Remediated within 2 hours of discovery. Added route-level auth checks and automated tests to prevent recurrence.

Common Mistakes

  1. Trusting the Authorization header blindly. Validate JWTs on every request. Check expiration, issuer, audience, and signature. Do not just decode and trust.
  2. Inconsistent auth enforcement. Some endpoints check auth, some do not. Use middleware that applies authentication to all routes by default, with explicit opt-out for public endpoints.
  3. Logging sensitive data. Request logs should never contain access tokens, passwords, or credit card numbers. Implement structured logging with a sensitive field blocklist.
  4. Rate limiting by user ID only. Unauthenticated endpoints need IP-based rate limiting. Authenticated endpoints need both user-based and organization-based limits to prevent a single API key from consuming all quota.
  5. Ignoring SSRF in URL inputs. If your API accepts URLs (webhooks, imports, avatars), validate that they do not resolve to internal IPs or cloud metadata endpoints.

For understanding how API security fits into your overall product security strategy, the Technical PM Handbook covers the full technical decision landscape. The encryption template covers how to protect data at rest and in transit across your API infrastructure.

Frequently Asked Questions

Should we use API keys or OAuth 2.0?+
Use API keys for simple server-to-server integrations where the client is a trusted backend system. Use OAuth 2.0 for any scenario involving user delegation, third-party access, or mobile/web clients. Many products use both: OAuth for user-facing flows and API keys for backend integrations.
How should we handle API versioning from a security perspective?+
Maintain security patches across all supported API versions. When deprecating a version, give at least 6 months notice and ensure the replacement version has equal or better security. Never leave a deprecated but still-accessible version unpatched.
What is the right rate limit for a new API?+
Start conservative (100 requests/minute per key) and increase based on real usage data. It is much easier to raise limits than to lower them. Monitor P95 usage across your customer base and set the default limit above P99 usage.
How do we secure webhooks we send to customer endpoints?+
Sign every webhook payload with HMAC-SHA256 using a per-customer secret. Include a timestamp in the signed payload to prevent replay attacks. Document the verification process in your API reference and provide code samples in multiple languages.
Should internal microservice APIs have the same security as external APIs?+
Yes. Zero-trust architecture means internal services authenticate and authorize every request, even within your private network. Use mTLS or service mesh tokens for inter-service communication. The blast radius of a compromised internal service is much smaller when every service verifies identity.

Explore More Templates

Browse our full library of PM templates, or generate a custom version with AI.

Free PDF

Like This Template?

Subscribe to get new templates, frameworks, and PM strategies delivered to your inbox.

or use email

Join 10,000+ product leaders. Instant PDF download.

Want full SaaS idea playbooks with market research?

Explore Ideas Pro →