Using the API
The basics
- Base URL:
https://api.orbitapp.ir/v1 - Send your token with every request:
Authorization: Bot <token> - Bodies are JSON (
Content-Type: application/json) - IDs are strings. Keep them that way, they're too big for a JavaScript number.
- Times are milliseconds since 1970, in UTC
Requests from a browser are refused (anything with an Origin header), so run your bot on a server.
Errors
Errors come back as JSON:
{ "code": "forbidden", "message": "you don't have permission to do that" }| Status | code | What happened |
|---|---|---|
| 400 | invalid_request | Something in the request is wrong. field says what. |
| 401 | unauthorized | The token is missing, wrong or was replaced |
| 403 | forbidden | Your bot isn't allowed to do that |
| 403 | blocked | The server's AutoMod blocked the text |
| 403 | swearing, sexual_content, political | The text breaks Orbit's rules |
| 404 | not_found | It doesn't exist, or your bot can't see it |
| 409 | limit_reached | You hit a limit, like 50 pins in a channel |
| 413 | payload_too_large | The body is too big |
| 429 | rate_limited, slow_mode, too_new | Slow down and wait Retry-After seconds |
| 500 | internal | Our fault. Try again in a bit. |
Some endpoints are for people only. Bots get a 403 with bots can't use this. A few, like the command endpoints, are for bots only. And if your bot can't see something, you'll get a 404, never a 403.
Paging
Message lists take limit (1–100, default 50) plus before or after, which is a message ID. Results come oldest first.
Rate limits
Every bot has its own limits:
| What | Per minute | Burst |
|---|---|---|
| All requests | 1200 | 600 |
| Sending and editing messages | 60 | 20 |
| Reactions | 120 | 30 |
| Other changes: pins, roles, channels, timeouts, kicks, bans, commands | 60 | 30 |
Go over and you get a 429 with a Retry-After header. Wait that many seconds and try again. Channels in slow mode also answer 429 (slow_mode) unless your bot has Manage Messages. Sending lots of wrong tokens from one IP address gets that address rate limited too.