Authentication
Learn how to authenticate requests with Bearer API keys and secure your Compose integration.
All API endpoints require authentication using a Bearer token.
Getting Your API Key
- Log in to the Compose Finance dashboard
- Navigate to Settings > API
- Click Create API Key
- Copy and securely store your key — it is only shown once
Making Authenticated Requests
Include your API key in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEYcURL Example:
curl -X GET 'https://compose.finance/api/v2/customers' \
-H 'Authorization: Bearer YOUR_API_KEY'JavaScript Example:
const response = await fetch('https://compose.finance/api/v2/customers', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});Python Example:
import requests
response = requests.get(
'https://compose.finance/api/v2/customers',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)Security Best Practices
- Never expose your API key in client-side code, public repositories, or logs
- Rotate keys periodically and immediately if you suspect a compromise
- Use environment variables to store API keys in your application
- If a key is compromised, revoke it immediately from Settings > API and create a new one