API Authentication
All programmatic requests to the Elept API must contain a valid API key in the authorization header. Elept hashes these keys in the database using sha256 to ensure maximum protection.
The Authorization Header
To authenticate, pass your API key as a Bearer token in the Authorization header:
Authorization: Bearer el_live_8f3d0a2f9c8e7b6d5c4b3a21
Authentication Error Response
If your API key is invalid, revoked, or expired, the API will return a 401 Unauthorized response in standard JSON format:
{
"error": true,
"code": "unauthorized",
"message": "Invalid API key."
}
Code Examples
cURL Request:
curl -X GET https://elept.com/api/v1/usage \
-H "Authorization: Bearer YOUR_API_KEY"
JavaScript Fetch:
fetch('https://elept.com/api/v1/usage', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(data => console.log(data));