Authentication
All Elfa APIs require authentication using an API key. This document explains how to authenticate with our REST API.
Obtaining an API Key
You can obtain an API key by:
- Registering on the Elfa platform
- Navigating to your account settings
- Creating a new API key from the developer section
caution
Keep your API key secure! Do not share it publicly or commit it to version control systems.
API Key Permissions
API keys can have different permission levels:
- Read-only: Can only access GET endpoints
- Standard: Can access all standard API endpoints
- Premium: Can access all endpoints, including those with higher rate limits
Authenticating with the REST API
For all REST API calls, include your API key in the request header:
x-elfa-api-key: your_api_key_here
Example API Request with Authentication
cURL
curl -X GET "https://api.elfa.ai/v2/aggregations/trending-tokens" \
-H "x-elfa-api-key: your_api_key_here"
JavaScript (Fetch)
// Example API call
const fetchTrendingTokens = async () => {
const response = await fetch("https://api.elfa.ai/v2/aggregations/trending-tokens", {
headers: {
"x-elfa-api-key": "your_api_key_here",
},
});
return await response.json();
};
Python (Requests)
# Example Python API call
import requests
headers = {
"x-elfa-api-key": "your_api_key_here"
}
response = requests.get("https://api.elfa.ai/v2/aggregations/trending-tokens", headers=headers)
data = response.json()
API Key Management
Checking API Key Status
You can check the status and usage of your API key using the /v2/key-status
endpoint:
curl -X GET "https://api.elfa.ai/v2/key-status" \
-H "x-elfa-api-key: your_api_key_here"
The response will include:
- Current usage statistics
- Rate limits
- Permissions
- Expiration date (if applicable)
Revoking an API Key
If your API key is compromised, you should revoke it immediately through the Elfa platform:
- Log in to your account
- Go to the developer section
- Find the compromised key and click "Revoke"
- Create a new key to replace it
Troubleshooting
If you encounter authentication issues:
- 401 Unauthorized: Check that your API key is correct and hasn't expired
- 403 Forbidden: Your API key doesn't have permission for the requested resource
- 429 Too Many Requests: You've exceeded your rate limit