Skip to content

The Acme API supports multiple authentication methods depending on your use case.

The simplest authentication method. Best for server-to-server communication.

Terminal window
curl -X GET "https://api.acme.com/v2/users" \
-H "Authorization: Bearer sk_live_abc123..."
Type Prefix Use Case
Live sk_live_ Production applications
Test sk_test_ Development and testing

For applications that act on behalf of users.

Terminal window
curl -X GET "https://api.acme.com/v2/users/me" \
-H "Authorization: Bearer oauth_token_xyz..."
  1. Never expose keys in client-side code. Use a backend proxy instead.
  2. Rotate keys regularly by generating new keys periodically.
  3. Use environment variables rather than hardcoding keys in source code.
  4. Restrict key permissions to only grant necessary scopes.

Authentication errors return 401 Unauthorized:

{
"error": {
"code": "unauthorized",
"message": "Invalid or expired API key"
}
}