Loading…
Loading documentation...
How the API counts requests, what a 429 means, and how to build a client that stays inside its limits.
Each API route has its own request limit, counted separately for each token, and the route limits are the same for every account. An organization API key can also have a limit of its own, which counts every route.
A request with a valid token counts against that token's allowance for the route it calls. Two tokens have separate allowances, and so do two routes. Reading allows more requests than changing, and a change that touches a server or costs money allows the fewest:
| Request | Limit for each token |
|---|---|
GET /api/v1/instances |
60 a minute |
GET /api/v1/networks |
30 a minute |
POST /api/v1/instances/{id}/power |
20 a minute |
POST /api/v1/instances/{id}/snapshots |
5 a minute |
POST /api/v1/instances/{id}/backups |
5 every 5 minutes |
POST /api/v1/instances/{id}/rebuild |
2 every 10 minutes |
Purchases through POST /api/v1/orders and its POST /api/v1/deploy alias share one purchase limit; keep the same Idempotency-Key when you retry a purchase. POST /api/v1/instances is not a purchase endpoint. A request without a valid token is refused with 401, and too many of those from one address are refused with 429.
An organization API key also has a Rate Limit of its own, set when the key is created in your organization's settings: a number of requests a minute, 100 unless you change it. Every request the key makes counts against it, on every route. Once the key has made that many requests in the last minute, its next request is refused with 429, even where the route's own limit has room. Personal access tokens have only the route limits.
A response to a request with a valid token says where that token stands: on the route's limit or, for an organization key, on the key's own limit when fewer requests are left under it:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 42
| Header | Meaning |
|---|---|
X-RateLimit-Limit |
The limit for one window: the route's, or the organization key's own |
X-RateLimit-Remaining |
Requests left in the current window |
X-RateLimit-Reset |
Seconds until the window starts again |
When a token has used its allowance, the API answers 429 with a Retry-After header, in seconds, and this body:
{
"error": "Too many requests",
"code": "RATE-1001",
"retryAfter": 42
}
async function apiRequest(url, options, maxRetries = 3) {
for (let attempt = 0; attempt <= maxRetries; attempt++) {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = Number.parseInt(
response.headers.get('Retry-After') || '60'
);
console.log(`Rate limited. Retrying in ${retryAfter}s...`);
await new Promise(r => setTimeout(r, retryAfter * 1000));
continue;
}
return response;
}
throw new Error('Max retries exceeded');
}
import time
import requests
def api_request(url, headers, max_retries=3):
for attempt in range(max_retries + 1):
response = requests.get(url, headers=headers)
if response.status_code == 429:
retry_after = int(response.headers.get('Retry-After', 60))
print(f'Rate limited. Retrying in {retry_after}s...')
time.sleep(retry_after)
continue
return response
raise Exception('Max retries exceeded')
Keep a list you read often for 30 to 60 seconds instead of asking for it again on every page view.
GET /api/v1/instances returns up to 200 servers at a time. Page through more with limit and offset:
GET /api/v1/instances?limit=25&offset=0
Instead of listing your servers in a loop to notice one being created or deleted:
# Polling: one request every 5 seconds
while true; do
curl https://serversareup.com/api/v1/instances \
-H "Authorization: Bearer $SAU_API_KEY"
sleep 5
done
register a webhook and receive those events as they happen:
POST /api/v1/webhooks
{"name":"server-events","url":"https://example.com/webhooks/sau","events":["instance.created","instance.deleted"]}
Scopes do not change a limit, but a leaked token with fewer scopes can do less.
To start, stop or restart several servers, send one POST /api/v1/bulk/power request with up to 50 actions instead of one request for each server:
POST /api/v1/bulk/power
{"actions":[{"id":"SERVER_ID","action":"restart"},{"id":"OTHER_SERVER_ID","action":"restart"}]}
The limits are the same for every account, and support cannot raise them for one account.
Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.