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 ask method 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

  1. Open the agent in your dashboard and go to the API tab.
  2. Issue a token: give it a name, choose an expiry and permissions. Copy the token right away — it is shown only once.
  3. 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_ID

Access 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

ParameterValue
Base URLhttps://usveree.ru/api/v1
HeaderAuthorization: Bearer <token> (or X-API-Key: <token>)
FormatJSON in UTF-8; for POST and PATCH — Content-Type: application/json
TimeISO-8601 in UTC, e.g. 2026-10-25T10:02:11.000Z
Request IDThe 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.

PermissionDescription
readReadAgent and its status, channels, chats, conversations, stats.
askAskThe agent answers a given text using its prompt and tools. Nothing is sent to messengers; AI usage is billed as usual.
moderateModerateQueue of prepared replies: send (optionally edited) or reject.
sendSendSend a message to a chat the agent already knows, on behalf of the connected account.
manageManageStart, stop and restart the agent, prompts and settings.

Limits

LimitValue
Read, moderation, management60 requests per minute per token
Agent answer (ask)10 per minute per token, at most 2 at once
Sending messages10 per minute per token and 300 per day per agent
Message and question length4,000 characters
History in ask20 turns
Prompt text20,000 characters
Waiting for askup to 170 seconds — set a 180-second timeout
Active tokens per agent10
Requests with an invalid token5 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" }
CodeHTTPMeaning
INVALID_BODY400The body is not JSON or a field is invalid.
INVALID_FIELD400Invalid field value (see field).
UNKNOWN_FIELD400Unknown field (see field).
INVALID_MESSENGER400Unknown messenger.
ACCOUNT_CHANGED_DM400The reply was prepared under the previous account: it cannot be sent as a direct message.
ACCOUNT_CHANGED_PERSONAL400The reply was prepared under the previous account: it cannot be sent to a personal chat.
UNAUTHORIZED401The token header is missing.
INVALID_TOKEN401The token is unknown or no longer valid (owner blocked or changed).
TOKEN_EXPIRED401The token has expired.
TOKEN_REVOKED401The token was revoked by the owner.
NO_BALANCE402There are no funds on the balance for AI usage.
INSUFFICIENT_BALANCE402Insufficient funds to start the agent.
AGENT_MISMATCH403The token was issued for a different agent.
SCOPE_DENIED403The token lacks the permission for this method (see the scope field).
NOT_FOUND404Not found.
CHAT_NOT_FOUND404The agent does not know this chat: you can only write to chats from the chat list or conversations.
REPLY_NOT_FOUND404The reply is not in the queue.
REPLY_ALREADY_DECIDED409The reply has already been sent or rejected.
AI_NOT_CONNECTED409AI is not connected for the agent.
AGENT_OUTDATED409The agent runs an old version — restart it (stop, then start).
INSTANCE_BUSY409The agent is already starting.
INSTANCE_LIMIT_REACHED409The limit of concurrently running agents is reached.
CHAT_NOT_JOINED412The account is not a member of this group.
TARGET_OFF423Sending to this recipient is switched off (anti-ban protection).
ACCOUNT_PAUSED423The messenger restricted the account — sending is paused until the time in detail.
COMMENT_TOO_FREQUENT429Comments under posts cannot be published this often — wait detail seconds.
TOO_MANY_ATTEMPTS429Too many failed authorization attempts from this address.
RATE_LIMITED429Per-minute request limit exceeded — retry after Retry-After seconds.
DAILY_LIMIT429The daily limit of messages sent via the API is reached.
INTERNAL_ERROR500Internal error. Report the requestId to support.
SEND_FAILED502The messenger rejected the message (reason in detail).
START_FAILED502The agent failed to start.
COMMENTS_GLOBALLY_DISABLED503Publishing comments is temporarily stopped by the service.
INSTANCE_NOT_RUNNING503The agent is not running — start it (POST /instance).
AGENT_UNAVAILABLE503The agent is starting or not responding — retry later.
CHANNEL_UNAVAILABLE503The messenger is not connected or the account is not logged in.
NOT_AVAILABLE503The API is temporarily unavailable.

Pagination and new messages

  • The feed (/conversations) returns entries from newest to oldest. For the next page, pass nextCursor from the response as before. nextCursor: null means there are no more entries.
  • Chat history (/messages) returns messages in chronological order. For older ones, pass nextBefore as before.
  • 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 id you 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/me

Returns 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/me

Response

{
  "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

FieldTypeDescription
instanceStatusstringNOT_RUNNING, STARTING, RUNNING or ERROR
channels[].messengerstringTELEGRAM, WHATSAPP, VK, INSTAGRAM
channels[].statusstringCONNECTED, NOT_CONNECTED or ERROR (login failure)
channels[].accountstring | nullAccount or community of the channel, if known

Request

curl -s -H "Authorization: Bearer $USVEREE_TOKEN" \
  https://usveree.ru/api/v1/agents/$AGENT_ID

Response

{
  "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}/channels

Like 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/channels

Response

{ "channels": [ { "messenger": "VK", "status": "CONNECTED", "account": null, "updatedAt": "…" } ] }

Agent state

GET /api/v1/agents/{agentId}/instance

Whether 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/instance

Response

{ "status": "RUNNING", "error": null }

Start, stop or restart

POST /api/v1/agents/{agentId}/instance

Agent 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)

FieldTypeDescription
actionstringstart, 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/instance

Response

{ "status": "STARTING" }

Possible errors: INSUFFICIENT_BALANCE, INSTANCE_BUSY, INSTANCE_LIMIT_REACHED, START_FAILED

Statistics

GET /api/v1/agents/{agentId}/stats

Total 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.out7d and out30d count 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/stats

Response

{
  "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}/chats

Chats 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

FieldTypeDescription
messengerstringRequired: TELEGRAM, WHATSAPP, VK or INSTAGRAM

Response fields

FieldTypeDescription
chats[].autoReplystringALLOW — the agent replies, DENY — it does not, AUTO — per prompt setting (autoReplyDefault)
chats[].pausedUntilstring | nullThe chat is under manual control until this time
chats[].sendBlockedbooleanSending to this recipient is switched off by anti-ban protection
chats[].availablebooleanThe account currently sees the chat (false — history only)
liveAvailablebooleanfalse — 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}/conversations

All 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

FieldTypeDescription
showstringall (default), answered, unanswered, agent, incoming, manual, comments
messengerstringA single messenger only
qstringText search, up to 100 characters
beforestringCursor: nextCursor from the previous response
limitnumber1–100, default 30

Response fields

FieldTypeDescription
entries[].kindstringMESSAGE, COMMENT (under a channel post) or TREND
entries[].directionstringIN — incoming, OUT — outgoing
entries[].authorstring | nullFor outgoing: AGENT, MANUAL (sent manually) or API
entries[].replystring | nullFor incoming: ANSWERED, PENDING (awaiting moderation), SILENT (the agent chose not to reply), HANDOVER, OFF_HOURS and others
entries[].chatIdstring | nullChat for history and sending; null for comments
nextCursorstring | nullPass 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}/messages

Messages of one chat in chronological order (oldest first). Messenger service messages are not returned.

Permission: read

Query parameters

FieldTypeDescription
messengerstringRequired
chatIdstringRequired: chatId from the chat list or the feed
beforestringISO time: nextBefore from the previous response
limitnumber1–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}/ask

The 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)

FieldTypeDescription
textstringRequired, up to 4,000 characters
messengerstringWhich prompt to use, default TELEGRAM
chatTypestringpersonal (default) or group
historyarrayUp to 20 previous turns: {"role": "user" | "assistant", "text": "…"}

Response fields

FieldTypeDescription
shouldRespondbooleanWhether the agent would reply in a live chat (it may stay silent in groups)
messagestringThe answer text
reasonstringShort explanation of the decision
actionstring | nullTriggered behaviour rule: handoff or block_user
deliverTostringchat or dm — where the agent would reply
toolCallsarrayTools 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/ask

Response

{
  "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-replies

Replies awaiting a decision: the incoming message and the reply prepared by the agent.

Permission: moderate

Query parameters

FieldTypeDescription
messengerstringA single messenger only

Response fields

FieldTypeDescription
replies[].kindstringMESSAGE — chat reply, COMMENT — comment under a post
replies[].suggestedDeliverTostringchat or dm — suggested by the agent
replies[].reasonstringWhy 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-replies

Response

{
  "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}/send

Sends the prepared reply — as is or edited. Without deliverTo it goes where the agent suggested.

Permission: moderate

Request body (JSON)

FieldTypeDescription
deliverTostringchat or dm (direct message to the author)
textstringEdited 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/send

Response

{ "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}/ignore

The 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/ignore

Response

{ "ok": true }

Possible errors: REPLY_NOT_FOUND, REPLY_ALREADY_DECIDED

Send a message to a chat

POST /api/v1/agents/{agentId}/messages

The 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)

FieldTypeDescription
messengerstringRequired
chatIdstringRequired: chatId from the chat list or the feed
textstringRequired, up to 4,000 characters
pauseAibooleantrue — 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/messages

Response

{ "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}/prompts

Prompts 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/prompts

Response

{
  "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}/prompts

Creates 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)

FieldTypeDescription
scopestringRequired: PERSONAL, GROUP or COMMENT
messengerstringALL (default) or a specific messenger
triggerTextstringTrigger, up to 20,000 characters
reactionTextstringReaction, up to 20,000 characters
autoRespondbooleanReply in all chats of this type, not only allowed ones
allowDmbooleanMay reply to the author in a direct message
replyAsQuotebooleanReply as a quote (Telegram, WhatsApp)
enabledbooleanThe 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/prompts

Response

{ "prompt": { "id": "…", "messenger": "ALL", "scope": "PERSONAL", "…": "…" } }

Possible errors: UNKNOWN_FIELD, INVALID_FIELD

Agent settings

GET /api/v1/agents/{agentId}/settings

Auto-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/settings

Response

{
  "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}/settings

Send only the fields you change. An out-of-range value is rejected with an error rather than silently adjusted.

Permission: manage

Request body (JSON)

FieldTypeDescription
autoSendbooleanSend replies without moderation
maxRepliesPerHournumber0–1000, 0 — unlimited
replyDelaySecondsnumber0–600
scheduleEnabled / scheduleModeboolean / stringSILENT, STOP
scheduleDaysnumber[]Weekdays 1–7 (1 — Monday)
scheduleStart / scheduleEndstringHH:MM
scheduleTzstringA Russian time zone, e.g. Europe/Moscow
offHoursPolicystringIGNORE, ACCUMULATE
handoverEnabled / handoverPauseMinutesboolean / number1–1440
ruleBotQuestionstringDEFLECT, ADMIT, HANDOFF
botDisplayNamestringUp to 64 characters
burstWaitSecondsnumber0–120
rule… / memoryEnabled / strikeAutoBlock / accountGuardbooleanBehaviour 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/settings

Response

{ "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.