API Reference
Complete REST API documentation for SitemapHost with authentication, endpoints, and error handling
The SitemapHost REST API lets you programmatically manage domains, upload sitemaps, and monitor status. All API access is over HTTPS and uses JSON request and response bodies.
Base URL
All API requests are made to:
https://dash.sitemaphost.app/api
Authentication
Every API request requires authentication via an API key. You can send your key using either method:
| Method | Header | Format |
|---|---|---|
| API Key header | X-API-Key | sk_live_xxxxxxxxxxxxxxxx |
| Bearer token | Authorization | Bearer sk_live_xxxxxxxxxxxxxxxx |
# Using X-API-Key header
curl https://dash.sitemaphost.app/api/domains \
-H "X-API-Key: sk_live_xxxxxxxxxxxxxxxx"
# Using Authorization header
curl https://dash.sitemaphost.app/api/domains \
-H "Authorization: Bearer sk_live_xxxxxxxxxxxxxxxx"API keys are created in the dashboard. See Authentication for details on key management and security best practices.
Content Type
All requests with a body must use Content-Type: application/json. Responses are always JSON.
curl -X POST https://dash.sitemaphost.app/api/sitemap/generate \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_live_xxxxxxxxxxxxxxxx" \
-d '{ ... }'Rate Limits
API rate limits are based on your plan:
| Plan | Requests per Minute |
|---|---|
| Free | 5 |
| Starter | 20 |
| Pro | 100 |
| Business | 500 |
| Enterprise | 1,000 |
When you exceed your rate limit, the API returns a 429 Too Many Requests response with a Retry-After header indicating how many seconds to wait:
HTTP/1.1 429 Too Many Requests
Retry-After: 30
Content-Type: application/json
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded. Please retry after 30 seconds."
}
}
Response Format
All API responses follow a consistent structure.
Success responses
{
"success": true,
"data": {
// Response payload
}
}Error responses
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "A human-readable error description."
}
}Common error codes
| HTTP Status | Error Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Invalid request body or parameters |
| 401 | UNAUTHORIZED | Missing or invalid API key |
| 403 | FORBIDDEN | API key does not have access to this resource |
| 404 | NOT_FOUND | Resource not found |
| 409 | CONFLICT | Resource already exists (e.g., duplicate domain) |
| 413 | PAYLOAD_TOO_LARGE | Request body exceeds maximum size |
| 422 | VALIDATION_ERROR | Request body failed validation |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests |
| 500 | INTERNAL_ERROR | Server error (please report these) |
API Endpoints
| Method | Endpoint | Description | Docs |
|---|---|---|---|
POST | /api/sitemap/generate | Upload URLs and generate sitemap | Upload |
POST | /api/domains | Add a new domain | Domains |
GET | /api/domains | List all domains | Domains |
POST | /api/domains/:id/verify | Verify domain DNS | Domains |
DELETE | /api/domains/:id | Delete a domain | Domains |
Pagination
List endpoints that may return many results support cursor-based pagination:
# First page
curl https://dash.sitemaphost.app/api/domains \
-H "X-API-Key: sk_live_xxxxxxxxxxxxxxxx"
# Next page (using cursor from previous response)
curl "https://dash.sitemaphost.app/api/domains?cursor=abc123" \
-H "X-API-Key: sk_live_xxxxxxxxxxxxxxxx"Paginated responses include a pagination object:
{
"success": true,
"data": [ ... ],
"pagination": {
"hasMore": true,
"cursor": "abc123"
}
}SDKs and Libraries
SitemapHost provides a REST API that works with any HTTP client. Here are examples in common languages:
cURL
curl -X POST https://dash.sitemaphost.app/api/sitemap/generate \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_live_xxxxxxxxxxxxxxxx" \
-d '{"domain": "sitemap.yoursite.com", "urls": [{"loc": "https://yoursite.com/"}]}'JavaScript (fetch)
const response = await fetch(
"https://dash.sitemaphost.app/api/sitemap/generate",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "sk_live_xxxxxxxxxxxxxxxx",
},
body: JSON.stringify({
domain: "sitemap.yoursite.com",
urls: [{ loc: "https://yoursite.com/" }],
}),
}
);
const result = await response.json();Python (requests)
import requests
response = requests.post(
"https://dash.sitemaphost.app/api/sitemap/generate",
headers={
"Content-Type": "application/json",
"X-API-Key": "sk_live_xxxxxxxxxxxxxxxx",
},
json={
"domain": "sitemap.yoursite.com",
"urls": [{"loc": "https://yoursite.com/"}],
},
)
result = response.json()PHP
$response = wp_remote_post(
'https://dash.sitemaphost.app/api/sitemap/generate',
[
'headers' => [
'Content-Type' => 'application/json',
'X-API-Key' => 'sk_live_xxxxxxxxxxxxxxxx',
],
'body' => json_encode([
'domain' => 'sitemap.yoursite.com',
'urls' => [['loc' => 'https://yoursite.com/']],
]),
]
);Next Steps
- Authentication -- API key creation and security
- Upload Endpoint -- Sitemap generation API
- Domains Endpoint -- Domain management API