API

Bot API index

This page is the API directory. JWT methods below include params/returns; open a topic for runtime methods. See “How to call” for auth headers.

How to call

  1. Quickstart : apply → approval → copy Bot Token.
  2. Auth : console APIs use account JWT; runtime APIs use Authorization: Bearer sbot_…
  3. API prefix like https://api.sochatlive.com/api/v1 (use your gateway; point SDK baseUrl here).
  4. Node SDK / Java SDK wrap HTTP; or call with curl.
# Runtime (Bot Token)
curl -X POST "$API/bots/sendMessage" \
  -H "Authorization: Bearer $SOCHAT_BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":"<chat_id>","text":"hello"}'

# Console (account JWT)
curl -X GET "$API/bots/my" \
  -H "Authorization: Bearer $SOCHAT_USER_JWT"

Webhook verify & polling: Webhook · Polling · Files

Developer console APIs (JWT)

Applications, tokens, webhooks, deliveries — each entry lists params/returns; auth is account JWT.

POST/api/v1/bots/applications
JWT

applicationsSubmit bot application

Submit a create application; token is issued only after approval.

  • Auth: Authorization: Bearer <account JWT> (console login; not sbot_ token)
  • Required: name (≤100), username (lowercase letter start, a-z0-9_, 3–64, unique)
  • Optional: description, avatar (https URL), scopes[] (default send/receive)
  • Returns: bot object with review_status=pending
GET/api/v1/bots/my
JWT

myList my bots

List bots for the signed-in account (review/runtime status, token prefix).

  • Auth: account JWT
  • Returns: { items: [{ id, name, username, review_status, status, has_token, token_prefix, … }] }
GET/api/v1/bots/my/:id
JWT

:idBot details

First read after approval may return one_time_token (destroyed after read, Redis TTL 7d).

  • Path: id
  • Returns: profile, redacted webhook, command_menus, has_token / token_prefix
  • May include one_time_token (shown once, then destroyed—save immediately)
PATCH/api/v1/bots/my/:id
JWT

:idUpdate bot profile

Update name, avatar, descriptions, links, inline/friend/privacy settings after approval.

  • Path: id; only when review_status=approved
  • Optional body: name, avatar, description, short_description, about, cover_url, links, contact
  • Optional: supports_inline_queries, friend_request_mode, group_privacy, …
  • username is not self-editable; returns updated bot
POST/api/v1/bots/my/:id/webhook
JWT

webhookConfigure webhook

Register an HTTPS webhook with account JWT (no Bot Token).

  • Path: id
  • Required: url (https; SSRF-checked)
  • Strongly required for delivery: secret_token
  • Optional: allowed_updates[], allowed_ips[], max_connections, drop_pending_updates
  • Sets delivery_mode=webhook; equivalent Token API: POST /bots/setWebhook
DELETE/api/v1/bots/my/:id/webhook
JWT

webhookDelete webhook

Removes webhook; delivery mode becomes polling (getUpdates).

  • Path: id
  • Optional: drop_pending_updates
  • Returns delivery_mode=polling; then use POST /bots/getUpdates
GET/api/v1/bots/my/:id/deliveries
JWT

deliveriesDelivery logs

Paginated webhook delivery status including failed / dead_letter.

  • Path: id
  • Query: page (default 1), limit (1–100, default 20)
  • Returns: { items, pagination } with delivery status fields
POST/api/v1/bots/my/:id/regenerate-token
JWT

regenerate-tokenRegenerate token

Old token dies immediately; response one_time_token is shown once.

  • Path: id; requires approved bot
  • Returns: { bot_id, one_time_token, token_prefix } — save immediately
GET/api/v1/bots/my/:id/metrics
JWT

metricsBot metrics

Recent call volume, errors, and quota summary for the developer console.

  • Path param: id (bot id)
  • Returns: metrics summary object (fields evolve with the console)
POST/api/v1/bots/my/:id/deliveries/:deliveryId/retry
JWT

retryRetry delivery

Manually retry a failed (or retriable) webhook delivery.

  • Path params: id (bot id), deliveryId (delivery id or update_id)
  • Returns: updated delivery status

Runtime APIs by topic

Open a topic for params/returns. All require Authorization: Bearer sbot_…