Skip to content

Gateway

This endpoint returns the Gateway URL a bot connects to, together with a recommended shard count and session start values. See the Gateway overview for the WebSocket protocol itself.

Use a bot token. User clients do not call this route: they read endpoints.gateway from instance discovery and send their session token in Identify.

Gateway information object

Every field is always present.

Structure

Field Type Description
url string The ws or wss URL of the Gateway. On a deployment with a configured public Gateway URL it is the same value as endpoints.gateway in instance discovery
shards integer Recommended shard count, always 1
session_start_limit session start limit object Fixed session start values

TEBHOS appends no query string. The client appends the connection parameters itself, for example ?v=1&encoding=json. A client MUST NOT rewrite a published ws value to wss.

Example

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

Session start limit object

These are fixed compatibility values, not live usage counters.

Structure

Field Type Description
total integer Reported session starts allowed, always 1000
remaining integer Reported session starts remaining, always 999
reset_after integer Reported reset interval in milliseconds, always 14400000 (four hours)
max_concurrency integer Reported concurrent Identify buckets, always 1

The limits the Gateway actually enforces are described in Gateway limits and rate limits. They are not reported here.

A remaining session start does not guarantee admission

These values reserve no capacity. The Gateway can still reject or close a connection under its own limits.

Get Gateway information

GET /gateway/bot

Returns a Gateway information object.

The route requires Authorization: Bot <token>. TEBHOS verifies the token completely (the application must exist, have a bot account, and the secret must match), so a successful response also confirms that the token is live. Any other credential, including a user session token, a malformed value, or a revoked bot token, returns 401.

Response

Status Body Condition
200 Gateway information object The bot token is valid
401 error response The credential is missing, is not a bot token, or does not verify (UNAUTHORIZED, message invalid_token)
429 error response The route bucket or the global limit denied the request

Rate limit

60 requests per minute for each client, on the gateway:bot_info bucket. The client is identified by its Authorization header.

Example

curl https://tebhos.com/api/v1/gateway/bot \
  -H "Authorization: Bot 1501314428688998182.<secret>"

Not supported on TEBHOS

There is no unauthenticated GET /gateway route. Read endpoints.gateway from instance discovery instead.