Authentication

Every Bot API request sends the bot's token in the Authorization header:

http

GET /api/bot/v1/me HTTP/1.1Host: yuva.exampleAuthorization: Bot yb_3q2-…

The scheme word is Bot (not Bearer). Tokens start with yb_.

Public metadata endpoints (GET /api/bot/v1, GET /api/bot/v1/meta, and GET /api/bot/v1/openapi.json) do not require authentication.

Getting a token#

In Yuva: Ayarlar → Geliştirici → Yeni bot. The token appears once, right after the bot is created or a new token is minted. Yuva keeps only a SHA-256 hash of it, so it can't show it again: store it in a secret store or an environment variable (YUVA_BOT_TOKEN), never in source control.

Scoped and labelled tokens#

Each bot can hold up to 5 active tokens at the same time (for example "üretim" and "test"). Under Ayarlar → Geliştirici → Anahtarlar, each token can optionally be restricted to:

  • Scopes: read, write, and/or voice. Calling an endpoint outside the token's scopes returns 403 with code: "SCOPE_MISSING".

  • Expiration: optional lifetime (or no expiry). Expired tokens fail with 401 INVALID_TOKEN.

Existing single-token bots keep a default "Varsayılan" token with all three scopes and no expiration.

Rotating and revoking#

  • Anahtarı yenile revokes all active tokens and issues one fresh full-scope token.

  • Tüm anahtarları iptal et (or İptal et on a single token) disables access immediately.

  • Botu sil removes the bot from every lodge and disables it for good.

Revoking all tokens (or revoking the last active voice-scoped token) also drops the bot from any voice room it is in.

Failures#

A missing, malformed, revoked, expired or replaced token answers 401 with code: "INVALID_TOKEN" and { "error": "Geçersiz bot anahtarı." }. The same happens when the bot or its owner's account was deleted, or a site admin banned it. Don't retry a 401 in a loop: too many wrong tokens from one address are refused with 429 for a while (rate limits).

Bots have no session and no cookies; the app's own sign-in does not apply to them, and a bot token never works for the app's pages or server functions.