Overview
The Elfa API provides access to core functionalities including user management, data storage, and analytics. All endpoints use HTTPS and require an Authorization
header with a valid API token.
Authentication
POST /auth/login
Authenticate users and retrieve an access token.
Request
{
"username": "string",
"password": "string"
}
Response
{
"token": "string",
"user_id": "string",
"exp": "datetime"
}
Data Management
POST /data
Creates a new record in the system.
Example Request
POST /data HTTP/1.1
Authorization: Bearer API_TOKEN
Content-Type: application/json
{
"key": "string",
"value": "string"
}
Response
{
"id": "string",
"created_at": "datetime"
}
GET /data/{id}
Retrieves a single record by ID.
Example Request
GET /data/550e8400-e29b-41d4-a716-446655440000 HTTP/1.1
Authorization: Bearer API_TOKEN
Response
{
"key": "string",
"value": "string",
"created_at": "datetime"
}
Advanced
Query Parameters
Filter and sort data using query parameters.
GET /data
Example with filters:
GET /data?key=example&sort=desc HTTP/1.1
Authorization: Bearer API_TOKEN
Error Responses
Common Error Codes
All errors return a JSON object with an error code and description.
{
"error_code": "invalid_token",
"error_message": "Authentication token is invalid."
}