Secure API Design#
Every API exposed to any network — public or internal — is an attack surface. The difference between a secure API and a vulnerable one is not exotic cryptography. It is consistent application of known patterns: authenticate every request, authorize every action, validate every input, and limit every resource.
Authentication Schemes#
API Keys#
The simplest scheme. The client sends a static key in a header:
GET /api/v1/data HTTP/1.1
Host: api.example.com
X-API-Key: sk_live_abc123def456API keys are appropriate for: