Using the API
Authenticate and make programmatic requests to the Elis AI backend.
1
Create an API key
Go to Settings → API Keys and create a new key (see the Settings tutorial for details). Copy the key value.
2
Make your first request
Send a request to the chat endpoint with your API key in theX-API-Key header:
curl -X POST https://your-domain/api/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"message": "Hello", "conversation_id": null}'3
Handle the streaming response
The response is a Server-Sent Events (SSE) stream. Each event contains a token chunk. Accumulate chunks to build the full response.
data: {"token": "Hello"}
data: {"token": " there"}
data: {"token": "!"}
data: [DONE]4
Continue the conversation
Pass the conversation_id from the response in subsequent requests to continue the same conversation with full context.
Tip:You can also authenticate with a JWT token in the
Authorization: Bearer header instead of an API key.