HTTP API Reference
Authentication
Authenticate with the SweatHost HTTP API using API keys
Authentication
All API requests (except GET /api/v1/regions) require an API key passed in the Authorization header.
Getting an API key
- Log in to your SweatHost Dashboard
- Navigate to API Keys in the sidebar
- Click Create API Key
- Select the scopes your application needs
- Copy the API key — it is only shown once
Required headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <your-api-key> |
Content-Type | POST/PATCH only | application/json |
Example request
curl -X GET "https://api.sweathost.com/api/v1/game-servers" \
-H "Authorization: Bearer YOUR_API_KEY"POST/PATCH requests
curl -X POST "https://api.sweathost.com/api/v1/game-servers" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "My Server", "gameType": "cs2", "region": "us-west-1", "configuration": {...}}'API key scopes
| Scope | Allows |
|---|---|
servers:read | List, get, getStatus servers; read matches, deathmatch sessions, regions |
servers:write | Create, update, delete servers; start sessions, RCON, retry provisioning |
servers:control | Start, stop, restart servers |
matches:read | Read match data and statistics |
matches:write | Create and update matches |
regions:read | Read region information |
Auth errors
| HTTP | Cause |
|---|---|
401 Unauthorized | Missing or invalid API key |
403 Forbidden | API key lacks the required scope, or resource belongs to another organization |
# Test your API key
curl -X GET "https://api.sweathost.com/api/v1/game-servers?page=1&pageSize=1" \
-H "Authorization: Bearer YOUR_API_KEY"A successful response (even with 0 servers) confirms your key is valid.