Auth & API keys
Primary HTTP authentication is API Gateway API keys in the X-Api-Key header. The repo does not use OAuth, Cognito, or JWT for the shared public API surface.
The private flag
Serverless HTTP events control API Gateway key enforcement with private:
events:
- http:
path: /marketplace/colours/
method: post
private: true| Flag | Gateway behavior | Use |
|---|---|---|
private: true | Requires a valid API key associated with the method/stage | Internal callers, partner integrations, cost-incurring handlers |
private: false | No API key check at API Gateway | Public browser endpoints and third-party webhooks |
Set private: false explicitly for public endpoints. Omitting it under a provider that declares API keys can leave the route key-required.
API keys and usage plans
The shared provider config creates two named keys per service per stage:
| Key | Intended caller |
|---|---|
${stage}-${service}-api-key | Internal Drive callers |
${stage}-${service}-api-key-external | External partners |
Terraform owns usage plans, throttling, quotas, and API Gateway stage wiring. A missing or invalid key on a private: true method fails before Lambda invocation and usually returns { "message": "Forbidden" }.
Handler-level checks
Public at API Gateway does not always mean unauthenticated:
POST /leads/bot/queueperforms an additional bearer-token check in the handler and returns401on failure.- Facebook leadgen verification uses
hub.verify_tokenforGET /leads/in/fb/queue; Facebook POST handling is public at API Gateway but still constrained by webhook-specific checks and WAF controls. - Marketing callback proxy requires
X-Ins-Authto be present before forwarding callback payloads.
Use the per-operation OpenAPI schema and owning handler when you need the full auth contract.
Request headers
The primary auth header is X-Api-Key. Authorization and X-Amz-* headers are allowed because some callers use SigV4/IAM-style request signing, but they are not the standard drive-apig auth path.
See Headers for the shared CORS allow-list.