Create Chat
Creates a new chat session. A chat_id is generated and returned, which is required for adding messages and other chat-specific operations.
Endpoint
POST /chats/
Headers
| Name | Required | Description |
|---|---|---|
X-API-Key | Yes | Your unique API Key provided by ZeroinAI |
Content-Type | Yes | Must be set to application/json |
Request Body
{
"token_limit": 1000.0
}
| Field | Type | Required | Description |
|---|---|---|---|
token_limit | float | Yes | The maximum number of tokens this chat session can consume |
Response
Success Response (200 OK)
{
"chat_id": "generated-unique-chat-id",
"created_at": "2023-10-28T14:30:00Z",
"agent_name": "Support Pro Agent",
"creator_company_name": "Your Company Inc.",
"token_limit": 1000.0,
"token_used": 0.0,
"deleted": false,
"messages": []
}
Error Responses
| Status Code | Description |
|---|---|
| 401 Unauthorized | Invalid or missing API Key |
| 404 Not Found | Chat configuration associated with the API Key not found |
| 422 Unprocessable Entity | If token_limit is missing or invalid |
Example Request
curl -X POST 'https://api.zeroinai.com/micro-apps/for-api-providers/chat-service/chats/' \
-H 'X-API-Key: YOUR_UNIQUE_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"token_limit": 1000.0
}'