Chat
Send Chat Message
Send a message to an AI agent and receive a response with optional streaming
POST
Overview
This endpoint enables text-based conversations with your AI agents. It supports both streaming and non-streaming responses, making it ideal for chatbots, customer support widgets, and interactive applications.Authentication
Your eigi.ai API key. Must be prefixed with
vk_.Request Body
The unique identifier of the agent to chat with. Example:
68ea2517dbb84c09bae1ba0aThe user’s message to send to the agent. Must be between 1 and 4000
characters. Example:
"Hello, I need help with my account"Session ID for continuing a conversation. If not provided, a new session will
be created. Example:
58a6b549-ef07-4a31-86bc-0eb0e026840aWhether to stream the response in real-time or wait for the complete response.
true: Response streams as it’s generated (recommended for chat UIs) -false: Returns complete response as JSON
Additional metadata to attach to the conversation. Useful for tracking user context.Example:
{"user_id": "user_123", "source": "website"}Response
Streaming Response (streaming=true)
Returns atext/plain stream with the agent’s response delivered word-by-word.
Response Headers:
| Header | Description |
|---|---|
X-Session-ID | The session ID to use for subsequent messages |
Content-Type | text/plain; charset=utf-8 |
Non-Streaming Response (streaming=false)
The complete response from the AI agent.
The session ID to use for subsequent messages in this conversation.
Examples
Streaming Request
Non-Streaming Request
Non-Streaming Response Example
Continuing a Conversation
Use thesession_id from previous responses to maintain conversation context:
cURL
Error Responses
| Status Code | Description |
|---|---|
| 400 Bad Request | Agent has no LLM configuration or message is invalid |
| 401 Unauthorized | Missing, invalid, inactive, or expired API key |
| 403 Forbidden | API key owner doesn’t have access to this agent |
| 404 Not Found | Agent not found |
Example Error Response
Best Practices
Authorizations
API key for authentication. Get your API key from the eigi.ai Dashboard under Settings → API Keys.
Body
application/json
The ID of the agent to chat with
Example:
"68ea2517dbb84c09bae1ba0a"
User message to send to the agent
Required string length:
1 - 4000Example:
"Hello, how can you help me?"
Session ID for continuing a conversation (created if not provided)
Example:
"58a6b549-ef07-4a31-86bc-0eb0e026840a"
If true, response streams in real-time. If false, returns complete JSON response.
Additional metadata for the conversation
Example:
{
"user_id": "user_123",
"source": "website"
}
