Authentication
Obtain and manage API tokens, understand scopes, and secure server-to-server calls.
The OpenHost API uses Bearer token authentication. Every request must include a valid token in the Authorization header.
Obtaining a token
Generate in client area
Client area → Profile → API Credentials → Generate new token.
Set scopes
Choose which resources the token can access:
Scope Allows client:readList and view client accounts client:writeCreate, update, suspend clients service:readView hosting services and plans service:writeCreate, upgrade, cancel services support:readView tickets support:writeCreate and reply to tickets invoice:readView invoices invoice:writeGenerate invoices, mark paid Grant only the scopes your integration needs (principle of least privilege).
Store securely
The token is shown once. Store it in a secrets manager or environment variable — never commit it to version control.
Using the token
Include it as a Bearer token on every request:
curl -s https://billing.openhost.one/api/admin/client/get_list \
-H "Authorization: Bearer oh_live_abc123..." \
-H "Accept: application/json"Token format
Tokens are prefixed for identification:
| Prefix | Type |
|---|---|
oh_live_ | Production admin token |
oh_client_ | Client-scoped token (limited to own account) |
Token rotation
Rotate tokens periodically and immediately after any suspected compromise:
- Client area → API Credentials
- Click Regenerate on the token
- Update the token in your integration
- Old token is invalidated immediately
Error responses
| Status | Meaning | Action |
|---|---|---|
401 | Invalid or missing token | Check token value; regenerate if expired |
403 | Token lacks required scope | Add the needed scope or use a different token |
429 | Rate limit exceeded | Back off and retry after Retry-After header seconds |
Example error body:
{
"error": {
"message": "Authentication Failed",
"code": 401
}
}IP restrictions (optional)
For additional security, restrict a token to specific source IPs:
- API Credentials → Edit token → Allowed IPs
- Enter one IP or CIDR range per line
- Requests from other IPs receive a
403
Recommended for production integrations running from a known server.
Client tokens vs. admin tokens
| Admin token | Client token | |
|---|---|---|
| Access level | All accounts | Own account only |
| Use case | Staff automation, reseller integrations | Customer self-service scripts |
| Prefix | oh_live_ | oh_client_ |
| Scopes | All available | Limited subset |
Best practices
- One token per integration — if one is compromised, revoke without breaking others
- Environment variables — store in
OPENHOST_API_TOKEN, never hardcode - Rotate on schedule — every 90 days minimum
- IP-restrict production tokens
- Log usage — monitor API calls for unexpected patterns
- Never expose tokens in frontend code, logs, or error messages