Skip to main content

Authentication

All Elfa APIs require authentication using an API key. This document explains how to authenticate with our REST API.

Obtaining an API Key

Get your API key from the Elfa Developer Portal.

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, revoke it immediately from the Elfa Developer Portal and generate a new one.

Troubleshooting

If you encounter authentication issues:

  1. 401 Unauthorized: Check that your API key is correct and hasn't expired
  2. 403 Forbidden: Your API key doesn't have permission for the requested resource
  3. 429 Too Many Requests: You've exceeded your rate limit