Skip to main content

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

NameRequiredDescription
chat_idYesThe ID of the chat session to update

Headers

NameRequiredDescription
X-API-KeyYesYour unique API Key provided by ZeroinAI
Content-TypeYesMust be set to application/json

Request Body

{
"additional_tokens": 500.0
}
FieldTypeRequiredDescription
additional_tokensfloatYesThe 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 CodeDescription
401 UnauthorizedInvalid or missing API Key
404 Not Foundchat_id not found
422 Unprocessable EntityIf additional_tokens is missing or invalid
500 Internal Server ErrorIf 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
}'