AI Agent API
A REST API to work with your AI agent from your own systems: website, CRM, automation services. Read conversations from Telegram, WhatsApp, VK and Instagram, get the agent's answer to any question, process the moderation queue, send messages to chats the agent knows, and manage its prompts and settings.
Updated: · v1
What the API does
The API mirrors what the agent owner does in the dashboard — but from your own program. Each token is bound to one agent and works only within the granted permissions. Typical scenarios:
- CRM and analytics. Pull the conversation feed and chat history: who wrote, what the agent answered, where it stayed silent and why.
- Answers on your website. Your server sends a visitor's question to the
askmethod and shows the agent's answer — with the same prompt, rules and site search as in messengers. - Your own moderation. With auto-send off, process the queue of prepared replies from your system: send, edit or reject.
- Customer notifications. Write to an existing chat with a customer on behalf of the connected account: order status, appointment reminder.
- Automation. Start and stop the agent, change prompts and settings from n8n, Make or your own scripts.
Quick start
- Open the agent in your dashboard and go to the API tab.
- Issue a token: give it a name, choose an expiry and permissions. Copy the token right away — it is shown only once.
- Check the token with the request below. The response contains the token name, its permissions and the agent.
export USVEREE_TOKEN="usv_agt_…" # token from the API tab
export AGENT_ID="1a2b3c4d-…" # agent ID from the same tab
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" https://usveree.ru/api/v1/me
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" https://usveree.ru/api/v1/agents/$AGENT_IDAccess token
- Tokens are issued and revoked only by the agent owner — on the API tab of the agent page. Team managers do not see this tab.
- A token looks like
usv_agt_followed by 43 characters. Only its hash is stored, so a lost token cannot be recovered — issue a new one. - A token works only with the agent it was issued for and acts on behalf of the owner.
- Expiry is 30 days, 90 days, a year or never. An agent can have up to 10 active tokens: create a separate one per integration so you can revoke them independently.
- A token stops working immediately if it is revoked, expires, the owner is blocked or the agent changes owner.
- The API tab shows when and from which address the token was last used, plus a call log: changes, agent answers, sends and all errors.
Authentication and base URL
| Parameter | Value |
|---|---|
| Base URL | https://usveree.ru/api/v1 |
| Header | Authorization: Bearer <token> (or X-API-Key: <token>) |
| Format | JSON in UTF-8; for POST and PATCH — Content-Type: application/json |
| Time | ISO-8601 in UTC, e.g. 2026-10-25T10:02:11.000Z |
| Request ID | The X-Request-Id response header — include it when contacting support |
Token permissions
Permissions are chosen at issue time and cannot be changed later: if you need others, issue a new token. Give an integration only what it needs.
| Permission | Description | |
|---|---|---|
read | Read | Agent and its status, channels, chats, conversations, stats. |
ask | Ask | The agent answers a given text using its prompt and tools. Nothing is sent to messengers; AI usage is billed as usual. |
moderate | Moderate | Queue of prepared replies: send (optionally edited) or reject. |
send | Send | Send a message to a chat the agent already knows, on behalf of the connected account. |
manage | Manage | Start, stop and restart the agent, prompts and settings. |
Limits
| Limit | Value |
|---|---|
| Read, moderation, management | 60 requests per minute per token |
Agent answer (ask) | 10 per minute per token, at most 2 at once |
| Sending messages | 10 per minute per token and 300 per day per agent |
| Message and question length | 4,000 characters |
History in ask | 20 turns |
| Prompt text | 20,000 characters |
Waiting for ask | up to 170 seconds — set a 180-second timeout |
| Active tokens per agent | 10 |
| Requests with an invalid token | 5 within 15 minutes, then the address is blocked for 15 minutes |
Every response has X-RateLimit-Limit and X-RateLimit-Remaining headers — how many requests are left in the current minute. When exceeded, the server answers 429 RATE_LIMITED with a Retry-After header (seconds until retry).
Errors
An error comes with an HTTP status and a {"error": "CODE"} body. Sometimes there are details: detail — reason from the messenger or pause deadline, field — invalid field, scope — missing permission, retryAfter — seconds until retry.
{ "error": "SCOPE_DENIED", "scope": "send" }| Code | HTTP | Meaning |
|---|---|---|
INVALID_BODY | 400 | The body is not JSON or a field is invalid. |
INVALID_FIELD | 400 | Invalid field value (see field). |
UNKNOWN_FIELD | 400 | Unknown field (see field). |
INVALID_MESSENGER | 400 | Unknown messenger. |
ACCOUNT_CHANGED_DM | 400 | The reply was prepared under the previous account: it cannot be sent as a direct message. |
ACCOUNT_CHANGED_PERSONAL | 400 | The reply was prepared under the previous account: it cannot be sent to a personal chat. |
UNAUTHORIZED | 401 | The token header is missing. |
INVALID_TOKEN | 401 | The token is unknown or no longer valid (owner blocked or changed). |
TOKEN_EXPIRED | 401 | The token has expired. |
TOKEN_REVOKED | 401 | The token was revoked by the owner. |
NO_BALANCE | 402 | There are no funds on the balance for AI usage. |
INSUFFICIENT_BALANCE | 402 | Insufficient funds to start the agent. |
AGENT_MISMATCH | 403 | The token was issued for a different agent. |
SCOPE_DENIED | 403 | The token lacks the permission for this method (see the scope field). |
NOT_FOUND | 404 | Not found. |
CHAT_NOT_FOUND | 404 | The agent does not know this chat: you can only write to chats from the chat list or conversations. |
REPLY_NOT_FOUND | 404 | The reply is not in the queue. |
REPLY_ALREADY_DECIDED | 409 | The reply has already been sent or rejected. |
AI_NOT_CONNECTED | 409 | AI is not connected for the agent. |
AGENT_OUTDATED | 409 | The agent runs an old version — restart it (stop, then start). |
INSTANCE_BUSY | 409 | The agent is already starting. |
INSTANCE_LIMIT_REACHED | 409 | The limit of concurrently running agents is reached. |
CHAT_NOT_JOINED | 412 | The account is not a member of this group. |
TARGET_OFF | 423 | Sending to this recipient is switched off (anti-ban protection). |
ACCOUNT_PAUSED | 423 | The messenger restricted the account — sending is paused until the time in detail. |
COMMENT_TOO_FREQUENT | 429 | Comments under posts cannot be published this often — wait detail seconds. |
TOO_MANY_ATTEMPTS | 429 | Too many failed authorization attempts from this address. |
RATE_LIMITED | 429 | Per-minute request limit exceeded — retry after Retry-After seconds. |
DAILY_LIMIT | 429 | The daily limit of messages sent via the API is reached. |
INTERNAL_ERROR | 500 | Internal error. Report the requestId to support. |
SEND_FAILED | 502 | The messenger rejected the message (reason in detail). |
START_FAILED | 502 | The agent failed to start. |
COMMENTS_GLOBALLY_DISABLED | 503 | Publishing comments is temporarily stopped by the service. |
INSTANCE_NOT_RUNNING | 503 | The agent is not running — start it (POST /instance). |
AGENT_UNAVAILABLE | 503 | The agent is starting or not responding — retry later. |
CHANNEL_UNAVAILABLE | 503 | The messenger is not connected or the account is not logged in. |
NOT_AVAILABLE | 503 | The API is temporarily unavailable. |
Pagination and new messages
- The feed (
/conversations) returns entries from newest to oldest. For the next page, passnextCursorfrom the response asbefore.nextCursor: nullmeans there are no more entries. - Chat history (
/messages) returns messages in chronological order. For older ones, passnextBeforeasbefore. - New messages. There are no webhooks yet: every minute or two request the first page of the feed and process entries until you reach an
idyou have already seen.
Method reference
In all examples the token and agent ID are in the USVEREE_TOKEN and AGENT_ID environment variables. Method paths are relative to the base URL.
Token and agent
Check the token
GET /api/v1/meReturns the token name, permissions and expiry, and the agent it is bound to. Use it to check an integration: works with any permission.
Permission: any
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/meResponse
{
"token": {
"id": "6f1c2a9e-4b7d-4f0e-9a51-0c3d2e8b7a10",
"name": "CRM",
"prefix": "usv_agt_Ab3x",
"scopes": ["read", "ask"],
"createdAt": "2026-10-25T09:12:44.000Z",
"expiresAt": "2027-01-23T09:12:44.000Z"
},
"agent": { "id": "1a2b3c4d-…", "name": "Store assistant" }
}Agent and its channels
GET /api/v1/agents/{agentId}Agent name, instance state and connected messengers. Channel statuses come from the database without polling the agent, so the call is fast.
Permission: read
Response fields
| Field | Type | Description |
|---|---|---|
instanceStatus | string | NOT_RUNNING, STARTING, RUNNING or ERROR |
channels[].messenger | string | TELEGRAM, WHATSAPP, VK, INSTAGRAM |
channels[].status | string | CONNECTED, NOT_CONNECTED or ERROR (login failure) |
channels[].account | string | null | Account or community of the channel, if known |
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/agents/$AGENT_IDResponse
{
"id": "1a2b3c4d-…",
"name": "Store assistant",
"status": "ACTIVE",
"instanceStatus": "RUNNING",
"channels": [
{ "messenger": "TELEGRAM", "status": "CONNECTED", "account": null, "updatedAt": "2026-10-20T08:00:00.000Z" }
]
}Channels with a live login check
GET /api/v1/agents/{agentId}/channelsLike the channels above, but a running agent also verifies that the messenger account is actually logged in. Slower — use it when you need the exact status.
Permission: read
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/agents/$AGENT_ID/channelsResponse
{ "channels": [ { "messenger": "VK", "status": "CONNECTED", "account": null, "updatedAt": "…" } ] }Agent state
GET /api/v1/agents/{agentId}/instanceWhether the agent instance is running. Messenger replies, ask and sending work only in the RUNNING state.
Permission: read
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/agents/$AGENT_ID/instanceResponse
{ "status": "RUNNING", "error": null }Start, stop or restart
POST /api/v1/agents/{agentId}/instanceAgent uptime is billed at the rate shown in your account: starting checks the owner's balance. The agent takes 1–3 minutes to come up — poll the state until it is RUNNING.
Permission: manage
Request body (JSON)
| Field | Type | Description |
|---|---|---|
action | string | start, stop, restart |
Request
curl -s -X POST -H "Authorization: Bearer $USVEREE_TOKEN" -H "Content-Type: application/json" \
-d '{"action":"start"}' https://usveree.ru/api/v1/agents/$AGENT_ID/instanceResponse
{ "status": "STARTING" }Possible errors: INSUFFICIENT_BALANCE, INSTANCE_BUSY, INSTANCE_LIMIT_REACHED, START_FAILED
Statistics
GET /api/v1/agents/{agentId}/statsTotal uptime, number of starts, start/stop log, message volume for 7 and 30 days, and AI usage (tokens and charges in kopecks).
Permission: read
messages.out7dandout30dcount only the agent's replies — not manual messages or messages sent via the API.
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/agents/$AGENT_ID/statsResponse
{
"instance": { "status": "RUNNING", "totalUptimeSeconds": 864000, "starts": 4 },
"messages": { "in7d": 312, "out7d": 280, "in30d": 1290, "out30d": 1144, "chats": 87 },
"events": [ { "kind": "START", "detail": null, "at": "2026-10-20T08:00:00.000Z" } ],
"ai": {
"keySource": "SERVICE",
"tokens": {
"today": { "prompt": 41000, "completion": 5200, "calls": 38 },
"d7": { "prompt": 302000, "completion": 39000, "calls": 290 },
"d30": { "prompt": 1250000, "completion": 160000, "calls": 1180 }
},
"costKop": { "today": 210, "d7": 1580, "d30": 6400 }
}
}Chats and conversations
Messenger chats
GET /api/v1/agents/{agentId}/chatsChats visible to the account plus chats the agent knows from history. The chatId from here works for chat history and for sending a message.
Permission: read
Query parameters
| Field | Type | Description |
|---|---|---|
messenger | string | Required: TELEGRAM, WHATSAPP, VK or INSTAGRAM |
Response fields
| Field | Type | Description |
|---|---|---|
chats[].autoReply | string | ALLOW — the agent replies, DENY — it does not, AUTO — per prompt setting (autoReplyDefault) |
chats[].pausedUntil | string | null | The chat is under manual control until this time |
chats[].sendBlocked | boolean | Sending to this recipient is switched off by anti-ban protection |
chats[].available | boolean | The account currently sees the chat (false — history only) |
liveAvailable | boolean | false — the agent is not running; the list comes from history only |
- The call queries the messenger account and may take up to 30 seconds.
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
"https://usveree.ru/api/v1/agents/$AGENT_ID/chats?messenger=TELEGRAM"Response
{
"chats": [
{
"chatId": "512345678",
"userId": "512345678",
"title": "Anna",
"type": "PERSONAL",
"url": "https://t.me/anna_example",
"messages": 14,
"autoReply": "AUTO",
"autoReplyDefault": true,
"pausedUntil": null,
"sendBlocked": false,
"available": true,
"leftAt": null
}
],
"liveAvailable": true
}Conversation feed
GET /api/v1/agents/{agentId}/conversationsAll agent messages across chats, newest first — like the Conversations tab: incoming messages with their outcome, agent replies, manual messages, messages sent via the API and comments under posts.
Permission: read
Query parameters
| Field | Type | Description |
|---|---|---|
show | string | all (default), answered, unanswered, agent, incoming, manual, comments |
messenger | string | A single messenger only |
q | string | Text search, up to 100 characters |
before | string | Cursor: nextCursor from the previous response |
limit | number | 1–100, default 30 |
Response fields
| Field | Type | Description |
|---|---|---|
entries[].kind | string | MESSAGE, COMMENT (under a channel post) or TREND |
entries[].direction | string | IN — incoming, OUT — outgoing |
entries[].author | string | null | For outgoing: AGENT, MANUAL (sent manually) or API |
entries[].reply | string | null | For incoming: ANSWERED, PENDING (awaiting moderation), SILENT (the agent chose not to reply), HANDOVER, OFF_HOURS and others |
entries[].chatId | string | null | Chat for history and sending; null for comments |
nextCursor | string | null | Pass it as before to get older entries |
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
"https://usveree.ru/api/v1/agents/$AGENT_ID/conversations?show=unanswered&limit=20"Response
{
"entries": [
{
"id": "0b9e…",
"kind": "MESSAGE",
"direction": "IN",
"at": "2026-10-25T10:02:11.000Z",
"messenger": "TELEGRAM",
"chatId": "512345678",
"chatTitle": "Anna",
"chatType": "PERSONAL",
"chatUrl": "https://t.me/anna_example",
"senderName": "Anna",
"text": "Hi! Do you deliver to Kazan?",
"author": null,
"reply": "PENDING",
"context": null,
"deleted": false
}
],
"nextCursor": "2026-10-25T10:02:11.123456Z|0b9e…"
}Chat history
GET /api/v1/agents/{agentId}/messagesMessages of one chat in chronological order (oldest first). Messenger service messages are not returned.
Permission: read
Query parameters
| Field | Type | Description |
|---|---|---|
messenger | string | Required |
chatId | string | Required: chatId from the chat list or the feed |
before | string | ISO time: nextBefore from the previous response |
limit | number | 1–50, default 20 |
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
"https://usveree.ru/api/v1/agents/$AGENT_ID/messages?messenger=TELEGRAM&chatId=512345678&limit=20"Response
{
"messages": [
{ "id": "…", "direction": "IN", "author": null, "senderId": "512345678", "senderName": "Anna", "text": "Hi! Do you deliver to Kazan?", "at": "2026-10-25T10:02:11.000Z" },
{ "id": "…", "direction": "OUT", "author": "AGENT", "senderId": null, "senderName": null, "text": "Hi Anna! Yes, we deliver to Kazan in 2–3 days. Shall I check the price?", "at": "2026-10-25T10:02:48.000Z" }
],
"hasMore": true,
"nextBefore": "2026-10-24T18:40:05.000Z"
}Agent answers
Get the agent's answer to a text
POST /api/v1/agents/{agentId}/askThe agent answers the same way as in a live chat: using its prompt, behaviour rules and tools (site search, catalog). Nothing is sent to messengers or saved to conversations. Works even with auto-replies off; the agent must be running. AI usage is counted and billed as usual.
Permission: ask
Request body (JSON)
| Field | Type | Description |
|---|---|---|
text | string | Required, up to 4,000 characters |
messenger | string | Which prompt to use, default TELEGRAM |
chatType | string | personal (default) or group |
history | array | Up to 20 previous turns: {"role": "user" | "assistant", "text": "…"} |
Response fields
| Field | Type | Description |
|---|---|---|
shouldRespond | boolean | Whether the agent would reply in a live chat (it may stay silent in groups) |
message | string | The answer text |
reason | string | Short explanation of the decision |
action | string | null | Triggered behaviour rule: handoff or block_user |
deliverTo | string | chat or dm — where the agent would reply |
toolCalls | array | Tools called: tool, status, durationMs |
- The answer may take up to 170 seconds when the agent calls tools. Set a client timeout of at least 180 seconds.
- Keep the dialogue history on your side and pass it in history — the server does not store it.
Request
curl -s -X POST -H "Authorization: Bearer $USVEREE_TOKEN" -H "Content-Type: application/json" \
--max-time 180 \
-d '{"text":"How much is delivery to Kazan?","history":[{"role":"user","text":"Hello"}]}' \
https://usveree.ru/api/v1/agents/$AGENT_ID/askResponse
{
"shouldRespond": true,
"message": "Delivery to Kazan is 390 ₽, free over 5,000 ₽.",
"reason": "delivery question",
"action": null,
"deliverTo": "chat",
"toolCalls": [ { "tool": "search_site", "status": "OK", "errorCode": null, "durationMs": 820 } ]
}Possible errors: NO_BALANCE, AI_NOT_CONNECTED, AGENT_OUTDATED, INSTANCE_NOT_RUNNING, AGENT_UNAVAILABLE
Moderation and sending
When auto-send is off in the agent settings, replies accumulate in the moderation queue. The API lets you process them from your own system and write to chats the agent already knows.
Moderation queue
GET /api/v1/agents/{agentId}/pending-repliesReplies awaiting a decision: the incoming message and the reply prepared by the agent.
Permission: moderate
Query parameters
| Field | Type | Description |
|---|---|---|
messenger | string | A single messenger only |
Response fields
| Field | Type | Description |
|---|---|---|
replies[].kind | string | MESSAGE — chat reply, COMMENT — comment under a post |
replies[].suggestedDeliverTo | string | chat or dm — suggested by the agent |
replies[].reason | string | Why it is queued: MANUAL, RATE_LIMIT, HANDOVER, COMMENT, PAUSED |
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/agents/$AGENT_ID/pending-repliesResponse
{
"replies": [
{
"id": "c7d1…",
"messenger": "TELEGRAM",
"chatId": "512345678",
"chatTitle": "Anna",
"chatType": "PERSONAL",
"chatUrl": "https://t.me/anna_example",
"messageUrl": null,
"sender": { "id": "512345678", "name": "Anna" },
"incomingText": "Hi! Do you deliver to Kazan?",
"replyText": "Hi Anna! Yes, we deliver to Kazan in 2–3 days. Shall I check the price?",
"suggestedDeliverTo": "chat",
"reason": "MANUAL",
"kind": "MESSAGE",
"createdAt": "2026-10-25T10:02:12.000Z",
"fromPreviousAccount": false
}
]
}Send a queued reply
POST /api/v1/agents/{agentId}/pending-replies/{replyId}/sendSends the prepared reply — as is or edited. Without deliverTo it goes where the agent suggested.
Permission: moderate
Request body (JSON)
| Field | Type | Description |
|---|---|---|
deliverTo | string | chat or dm (direct message to the author) |
text | string | Edited text, up to 4,000 characters |
Request
curl -s -X POST -H "Authorization: Bearer $USVEREE_TOKEN" -H "Content-Type: application/json" \
-d '{"text":"Hi Anna! Yes, we deliver to Kazan in 2–3 days. Shall I check the price?"}' \
https://usveree.ru/api/v1/agents/$AGENT_ID/pending-replies/$REPLY_ID/sendResponse
{ "sent": true }Possible errors: REPLY_NOT_FOUND, REPLY_ALREADY_DECIDED, CHAT_NOT_JOINED, TARGET_OFF, ACCOUNT_PAUSED, SEND_FAILED, CHANNEL_UNAVAILABLE
Reject a queued reply
POST /api/v1/agents/{agentId}/pending-replies/{replyId}/ignoreThe reply is not sent and leaves the queue.
Permission: moderate
Request
curl -s -X POST -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/agents/$AGENT_ID/pending-replies/$REPLY_ID/ignoreResponse
{ "ok": true }Possible errors: REPLY_NOT_FOUND, REPLY_ALREADY_DECIDED
Send a message to a chat
POST /api/v1/agents/{agentId}/messagesThe message is sent on behalf of the connected account to a chat the agent already knows: it is in the chat list or in the conversations. In the Conversations tab it is labelled API and becomes part of the agent's context as its own turn.
Permission: send
Request body (JSON)
| Field | Type | Description |
|---|---|---|
messenger | string | Required |
chatId | string | Required: chatId from the chat list or the feed |
text | string | Required, up to 4,000 characters |
pauseAi | boolean | true — pause AI in this chat as after a manual reply (duration from the handover settings) |
- Anti-ban protection applies as for agent replies: a switched-off recipient or a paused messenger blocks sending.
- Messages sent via the API count towards the agent's replies-per-hour limit.
Request
curl -s -X POST -H "Authorization: Bearer $USVEREE_TOKEN" -H "Content-Type: application/json" \
-d '{"messenger":"TELEGRAM","chatId":"512345678","text":"Your order #1024 has been shipped."}' \
https://usveree.ru/api/v1/agents/$AGENT_ID/messagesResponse
{ "sent": true, "messageId": "5e0f…" }Possible errors: CHAT_NOT_FOUND, DAILY_LIMIT, CHAT_NOT_JOINED, TARGET_OFF, ACCOUNT_PAUSED, SEND_FAILED, CHANNEL_UNAVAILABLE, AGENT_OUTDATED, INSTANCE_NOT_RUNNING
Prompts and settings
Prompts
GET /api/v1/agents/{agentId}/promptsPrompts by messenger (ALL — shared) and chat type: PERSONAL — direct chats, GROUP — groups, COMMENT — comments under posts. The trigger describes when the agent should react, the reaction — how to answer.
Permission: manage
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/agents/$AGENT_ID/promptsResponse
{
"prompts": [
{
"id": "…",
"messenger": "ALL",
"scope": "PERSONAL",
"triggerText": "Answer questions about products and delivery.",
"reactionText": "Polite and short. Offer to place an order.",
"allowDm": false,
"autoRespond": true,
"enabled": true,
"replyAsQuote": true,
"updatedAt": "2026-10-20T08:00:00.000Z"
}
]
}Update a prompt
PATCH /api/v1/agents/{agentId}/promptsCreates or updates the prompt of one messenger + chat type pair. Omitted fields keep their values. The agent picks up changes immediately.
Permission: manage
Request body (JSON)
| Field | Type | Description |
|---|---|---|
scope | string | Required: PERSONAL, GROUP or COMMENT |
messenger | string | ALL (default) or a specific messenger |
triggerText | string | Trigger, up to 20,000 characters |
reactionText | string | Reaction, up to 20,000 characters |
autoRespond | boolean | Reply in all chats of this type, not only allowed ones |
allowDm | boolean | May reply to the author in a direct message |
replyAsQuote | boolean | Reply as a quote (Telegram, WhatsApp) |
enabled | boolean | The prompt is enabled |
Request
curl -s -X PATCH -H "Authorization: Bearer $USVEREE_TOKEN" -H "Content-Type: application/json" \
-d '{"scope":"PERSONAL","reactionText":"Answer briefly and kindly."}' \
https://usveree.ru/api/v1/agents/$AGENT_ID/promptsResponse
{ "prompt": { "id": "…", "messenger": "ALL", "scope": "PERSONAL", "…": "…" } }Possible errors: UNKNOWN_FIELD, INVALID_FIELD
Agent settings
GET /api/v1/agents/{agentId}/settingsAuto-send, reply delay and limit, schedule, operator handover, behaviour rules and anti-ban protection.
Permission: manage
Request
curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
https://usveree.ru/api/v1/agents/$AGENT_ID/settingsResponse
{
"settings": {
"autoSend": true,
"maxRepliesPerHour": 40,
"replyDelaySeconds": 30,
"scheduleEnabled": false,
"scheduleMode": "SILENT",
"scheduleDays": [1, 2, 3, 4, 5, 6, 7],
"scheduleStart": "09:00",
"scheduleEnd": "21:00",
"scheduleTz": "Europe/Moscow",
"offHoursPolicy": "IGNORE",
"handoverEnabled": true,
"handoverPauseMinutes": 60,
"ruleHideInternals": true,
"ruleFactsOnly": true,
"ruleAbuseBlock": true,
"ruleBotQuestion": "DEFLECT",
"ruleHumanHandoff": true,
"rulePromptGuard": true,
"ruleStopTopics": true,
"botDisplayName": "",
"burstWaitSeconds": 15,
"memoryEnabled": true,
"strikeAutoBlock": true,
"accountGuard": true
}
}Update settings
PATCH /api/v1/agents/{agentId}/settingsSend only the fields you change. An out-of-range value is rejected with an error rather than silently adjusted.
Permission: manage
Request body (JSON)
| Field | Type | Description |
|---|---|---|
autoSend | boolean | Send replies without moderation |
maxRepliesPerHour | number | 0–1000, 0 — unlimited |
replyDelaySeconds | number | 0–600 |
scheduleEnabled / scheduleMode | boolean / string | SILENT, STOP |
scheduleDays | number[] | Weekdays 1–7 (1 — Monday) |
scheduleStart / scheduleEnd | string | HH:MM |
scheduleTz | string | A Russian time zone, e.g. Europe/Moscow |
offHoursPolicy | string | IGNORE, ACCUMULATE |
handoverEnabled / handoverPauseMinutes | boolean / number | 1–1440 |
ruleBotQuestion | string | DEFLECT, ADMIT, HANDOFF |
botDisplayName | string | Up to 64 characters |
burstWaitSeconds | number | 0–120 |
rule… / memoryEnabled / strikeAutoBlock / accountGuard | boolean | Behaviour rule, memory and anti-ban toggles |
Request
curl -s -X PATCH -H "Authorization: Bearer $USVEREE_TOKEN" -H "Content-Type: application/json" \
-d '{"autoSend":false,"replyDelaySeconds":20}' \
https://usveree.ru/api/v1/agents/$AGENT_ID/settingsResponse
{ "settings": { "autoSend": false, "replyDelaySeconds": 20, "…": "…" } }Possible errors: UNKNOWN_FIELD, INVALID_FIELD
Avoiding messenger bans
Messages sent via the API go out on behalf of your account, so the same protections apply as for the agent's replies:
- You can only write to chats the agent already knows — the API does not send to unknown numbers (
CHAT_NOT_FOUND). - If a recipient blocked the account or removed it from a group, sending to them is switched off (
TARGET_OFF). You can switch it back on in the Delivery tab. - If the messenger restricted the account, sending is paused until the restriction ends (
ACCOUNT_PAUSED). - At most 300 messages per day per agent can be sent via the API. Sends also count towards the agent's replies-per-hour limit.
Security
- Keep the token on the server only: in environment variables or a secret store. Never put it into website page code or a mobile app — it gives access to conversations and to messaging your customers.
- The API does not send CORS headers, so a browser will not run the request from a web page. This is deliberate: call the API from your server.
- Grant minimal permissions, limit the expiry and remove revoked tokens from integration settings. After 5 requests with an invalid token within 15 minutes, the address is blocked for 15 minutes (
TOO_MANY_ATTEMPTS). - If a token may have leaked, revoke it on the API tab — it stops working immediately.
API versions
The current version is v1 and it is part of the URL. Within it, new methods and new response fields may appear: do not treat an unknown field as an error. Breaking changes will ship in a new version, and v1 will keep working.
FAQ
How much does API access cost?
There is no separate fee for the API. You pay the same as without it: agent uptime and AI usage at the rates shown in your dashboard. Each ask call uses AI just like a reply in a chat.
Can I call the API directly from a web page?
No. The token gives access to conversations and to sending messages, so it must never reach a browser. The API does not send CORS headers: make requests from your server and show the visitor the finished answer.
How is the ask method different from the agent's auto-replies?
The ask method only returns the answer text: it sends nothing to messengers and saves nothing to conversations. It works even with auto-replies off, and you pass the dialogue history yourself in the history field.
Why does sending return CHAT_NOT_FOUND?
You can only write via the API to a chat the agent already knows: it is in the chat list or in the conversations. This keeps the API from becoming a mass mailing to strangers, which gets accounts banned by messengers.
How do I find out about new messages?
There are no webhooks yet. Request the first page of the conversation feed every minute or two and process entries until you reach an id you have already handled.
Can a team manager issue a token?
No. Only the agent owner issues and revokes tokens. A token acts on behalf of the owner and stops working if the agent changes owner or the owner is blocked.
How many tokens can I issue?
Up to 10 active tokens per agent. It is convenient to create a separate token for each integration: then you can revoke it without touching the others.