Update Chat Tokens
Increases the token_limit for an existing chat session. This allows for more interactions if the initial limit is reached.
Endpoint
PUT /chats/{chat_id}/tokens/
Path Parameters
| Name | Required | Description |
|---|---|---|
chat_id | Yes | The ID of the chat session to update |
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
{
"additional_tokens": 500.0
}
| Field | Type | Required | Description |
|---|---|---|---|
additional_tokens | float | Yes | The number of tokens to add to the current token_limit |
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": 1500.0,
"token_used": 150.0,
"deleted": false,
"messages": []
}
Error Responses
| Status Code | Description |
|---|---|
| 401 Unauthorized | Invalid or missing API Key |
| 404 Not Found | chat_id not found |
| 422 Unprocessable Entity | If additional_tokens is missing or invalid |
| 500 Internal Server Error | If the update fails for an unexpected reason |
Example Request
curl -X PUT 'https://api.zeroinai.com/micro-apps/for-api-providers/chat-service/chats/generated-unique-chat-id/tokens/' \
-H 'X-API-Key: YOUR_UNIQUE_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"additional_tokens": 500.0
}'