Authentication
The RoyaleHosting API uses API keys to authenticate requests. You can create and manage your API keys from your account settings.
API Key Authentication
Include your API key in the token header.
Organization ID Header
Most API endpoints require the x-organization-id header to specify which organization's resources you want to access.
Finding Your Organization ID
You can find your organization ID by:
- Viewing your organization settings in the dashboard
- Using the List Organizations endpoint
Required Headers
All API requests should include:
| Header | Description |
|---|---|
token | Your API key |
x-organization-id | Your organization ID (integer) |
Content-Type | application/json for POST/PUT/PATCH requests |
Endpoints Without Organization ID
Some endpoints don't require the x-organization-id header:
GET /dashboard/organizations- List your organizationsPOST /dashboard/organizations- Create a new organizationGET /dashboard/account- Get your account details
Rate Limiting
The API has rate limits to ensure fair usage. If you exceed the rate limit, you'll receive a 429 Too Many Requests response.
Error Handling
The API returns standard HTTP status codes and JSON error responses:
200 Success 401 Unauthorized - Invalid or missing API key 403 Forbidden - No access to this resource 404 Not Found - Resource doesn't exist 429 Too Many Requests - Rate limit exceeded Example Request
curl https://api.royalehosting.net/dashboard/services \
-H "token: YOUR_API_KEY" \
-H "x-organization-id: 42"JavaScript
const response = await fetch(
"https://api.royalehosting.net/dashboard/services",
{
headers: {
"token": "YOUR_API_KEY",
"x-organization-id": "42",
},
}
);
const data = await response.json();Python
import requests
response = requests.get(
"https://api.royalehosting.net/dashboard/services",
headers={
"token": "YOUR_API_KEY",
"x-organization-id": "42",
}
)
data = response.json()Error Response
{
"success": false,
"error": "Unauthorized",
"message": "Invalid or expired API key"
}