Перейти к содержимому

Gateway

Bots call this endpoint to get the URL for the Gateway WebSocket. User clients get the same URL from endpoints.gateway in instance discovery.

FieldTypeDescription
urlstringThe ws or wss Gateway URL
shardsintegerThe recommended shard count, one for every 2,500 guilds the bot is in, rounded up, and at least 1
session_start_limitsession start limit objectSession start values, the same on every call

Add the connection parameters to url before you connect. To split a bot across more than one shard, pass shard in Identify.

{
"url": "wss://gateway.example.com",
"shards": 1,
"session_start_limit": {
"total": 1000,
"remaining": 999,
"reset_after": 14400000,
"max_concurrency": 1
}
}

The API returns the same values on every call, and the Gateway doesn’t use them. The limits the Gateway enforces are on Limits and rate limits.

FieldTypeDescription
totalintegerAlways 1000
remainingintegerAlways 999
reset_afterintegerAlways 14400000 (four hours, in milliseconds)
max_concurrencyintegerAlways 1
GET /v1/gateway/bot
Принимает токен бота.

Returns a Gateway information object. The Authorization header takes Bot <token>, Bearer <token> or the bare token. The token must be a working bot token.

StatusBodyCondition
200Gateway information objectThe token is a working bot token
401error responseMISSING_AUTHORIZATION with no token, INVALID_AUTH_TOKEN when the token is not a working bot token

The rate limit is 60 requests per minute for each bot, or for each client IP address when the request has no working Bot token, on the gateway:bot_info bucket.