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. Note that the REST API is designed for secure server-side integration; OPTIONS / CORS preflight requests from arbitrary browser origins are not supported.
The Authorization Header
To authenticate, pass your API key as a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Authentication Error Responses
If your API key is missing, invalid, or expired, the API will return a 401 Unauthorized response with the live error message:
Missing API Key:
{
"error": true,
"code": "unauthorized",
"message": "Unauthorized: Missing API Key."
}
Invalid or Expired API Key:
{
"error": true,
"code": "unauthorized",
"message": "Unauthorized: Invalid or expired 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'
}
})
.then(res => res.json())
.then(data => console.log(data));