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.
Gateway information object
Section titled “Gateway information object”Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| url | string | The ws or wss Gateway URL |
| shards | integer | Recommended shard count, always 1 |
| session_start_limit | session start limit object | Session 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, follow sharding.
Example
Section titled “Example”{ "url": "wss://gateway.example.com", "shards": 1, "session_start_limit": { "total": 1000, "remaining": 999, "reset_after": 14400000, "max_concurrency": 1 }}Session start limit object
Section titled “Session start limit object”The API returns the same values on every call, and the Gateway doesn't use them. The limits it enforces are under Session lifecycle.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| total | integer | Always 1000 |
| remaining | integer | Always 999 |
| reset_after | integer | Always 14400000 (four hours, in milliseconds) |
| max_concurrency | integer | Always 1 |
Get Gateway information
Section titled “Get Gateway information”GET/v1/gateway/botReturns a Gateway information object. The Authorization header takes Bot <token>, Bearer <token> or the bare token. The API only checks that the token looks like a bot token, and it returns 200 for a revoked or wrong one. To test whether a token works, call Get bot application.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | Gateway information object | The token looks like a bot token |
| 401 | error response | MISSING_AUTHORIZATION with no token, INVALID_AUTH_TOKEN when the token doesn't look like a 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.