This API security checklist covers the essential protections every production API needs before handling real user traffic. Use it as a pre-launch review or periodic audit reference. Each item includes a brief explanation and, where applicable, a code snippet you can adapt to your stack.
Bookmark this page — you will want it for quick, repeated lookups rather than a single read-through.
Authentication
Item
Why It Matters
Use short-lived JWTs (15-60 min) with refresh tokens
Limits the exposure window if an attacker steals a token
Hash passwords with bcrypt (cost 12+) or Argon2
Attackers crack MD5 and SHA-256 hashes in seconds
Enforce minimum password complexity
Prevents trivially guessable credentials
Implement rate limiting on login endpoints
Blocks brute-force and credential stuffing attacks
Return generic error messages on auth failure
“Invalid credentials” — never reveal which field was wrong
Invalidate sessions/tokens on logout
Prevents reuse of stolen tokens after user logs out
Support multi-factor authentication for sensitive operations
Catches known dependency vulnerabilities before deploy
Keep dependencies updated (Dependabot, Renovate)
Patches known vulnerabilities automatically
Use non-root users in Docker containers
Limits damage if an attacker compromises the container
Disable debug mode and verbose errors in production
Prevents information leakage
Set database users to least-privilege permissions
Limits SQL injection damage
Enable automated security scanning in CI/CD
Catches vulnerabilities before they reach production
# Non-root user in Docker
FROM node:20-slim
RUN addgroup --system app && adduser --system --group app
WORKDIR /app
COPY --chown=app:app . .
RUN npm ci --omit=dev
USER app
CMD ["node", "server.js"]
Pre-Launch Quick Check
Before deploying a new API to production, verify these critical items:
All endpoints require authentication (unless explicitly public)
Every database query uses parameterized values
All request bodies and query parameters go through input validation
Rate limiting protects authentication and write endpoints
Your server sends security headers (use helmet or equivalent)
CORS specifies exact origins (not wildcards with credentials)
Secrets are in environment variables, not in code
Error responses do not expose stack traces or internal details
Logging captures authentication events and authorization failures
Dependencies have no known critical vulnerabilities
This API security checklist is not exhaustive — advanced topics like API gateway security, mTLS, and request signing apply to specific architectures. However, completing every item on this list addresses the vulnerabilities that affect the majority of production APIs. Review it before every launch, and revisit it quarterly as your API surface grows.