Authentication
Learn how to authenticate your API requests using API keys.
API Keys
The Acme API uses API keys to authenticate requests. You can view and manage your API keys in your dashboard.
Keep your keys secure
Your API keys carry many privileges, so be sure to keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, etc.
Making Authenticated Requests
Include your API key in the Authorization header:
curl https://api.acme.com/v1/users \
-H "Authorization: Bearer YOUR_API_KEY"Using the SDK
If you're using our SDK, authentication is handled automatically:
app.js
import { Acme } from '@acme/sdk';
// The SDK automatically includes your API key
const acme = new Acme({
apiKey: process.env.ACME_API_KEY,
});
// All requests are now authenticated
const user = await acme.users.retrieve('user_123');API Key Types
| Type | Prefix | Use Case |
|---|---|---|
| Live | aq_live_ | Production requests |
| Test | aq_test_ | Development & testing |
Test Mode
Test API keys allow you to make API calls without affecting live data. Use test keys during development and switch to live keys for production.
Error Responses
If authentication fails, you'll receive one of these errors:
{
"error": {
"code": "invalid_api_key",
"message": "The API key provided is invalid.",
"status": 401
}
}