Authentication
Send an API key as a Bearer token and check which user it belongs to.
Create an API key on the API keys page and send it as a Bearer token on every request. Each key belongs to one team and has an access level. A Send only key can call POST /emails, POST /sends, and GET /users/me; every other endpoint returns 403 {error: forbidden}. Use it for apps that only send. The API keys page also lists your team id, for /api/v1/teams/… paths and the SDKs, and your cluster ids, for /clusters/… paths and X-Capsule-Cluster-Id. A team id in the path that does not match the key returns 404 {error: team_mismatch}. If the team has a network policy, a request from a network it doesn't allow returns 403 {error: network_not_allowed, ip, asn}. Network restrictions don't apply to SMTP credentials. A Full access key can make every change. An OAuth token can do what its owner's team role allows today, as in the account app: Viewers read, Support can also remove suppressions, and Admins can make every change. Only Admins see webhook, inbox, and ShieldShiba secrets on show. A change the role does not allow returns 403 {error: forbidden}. While an account is suspended, reads and deletes still work, but creating or changing clusters, IP pools, domains, tenants, SMTP credentials, inboxes, webhook endpoints, and templates returns 403 {error: team_suspended}.
GET /api/v1/users/me
Check that a key works and see the user it belongs to. The response does not include a team id. Copy that from the API keys page.