API Reference

API Documentation

Complete reference for the BotRender API with examples and interactive testing.

Authentication
All API requests require authentication using your API token.

Where to Get Your API Token

Your API token is the API key you create in your Dashboard Settings. The X-Botrender-Token header should contain the full API key value.

💡 Admin and Owner roles can view existing API keys, while all roles can create new ones.

Your API Keys

API Base URL

https://api.botrender.com/v1

Authentication Header

X-Botrender-Token: your-api-key

Example Request

curl -X GET "https://api.botrender.com/v1/sites" \
  -H "X-Botrender-Token: your-api-key" \
  -H "Content-Type: application/json"
Prerender API
Manage your sites and trigger prerendering operations.
GET
/sites

Retrieve all sites in your account.

{
  "sites": [
    {
      "id": "site_123",
      "url": "https://example.com",
      "status": "active",
      "created_at": "2024-01-15T10:30:00Z",
      "renders_count": 1247,
      "cache_hit_rate": 0.943
    }
  ],
  "total": 1
}
POST
/sites

Add a new site to your account.

Request Body
{
  "url": "https://example.com",
  "name": "My Website",
  "settings": {
    "cache_ttl": 3600,
    "follow_redirects": true,
    "wait_after_load": 1000
  }
}
Response
{
  "id": "site_124",
  "url": "https://example.com",
  "name": "My Website",
  "status": "active",
  "created_at": "2024-01-15T11:00:00Z"
}
POST
/sites/{site_id}/prerender

Manually trigger prerendering for specific URLs.

{
  "urls": [
    "https://example.com/page1",
    "https://example.com/page2"
  ],
  "force_refresh": true
}
Cache Management
Control caching behavior and clear cached content.
DELETE
/sites/{site_id}/cache

Clear cache for specific URLs or entire site.

{
  "urls": [
    "https://example.com/page1",
    "https://example.com/page2"
  ]
  // Omit urls to clear entire site cache
}
Analytics
Access detailed analytics and usage statistics.
GET
/sites/{site_id}/analytics

Get analytics data for a specific time period.

Query Parameters
start_date - Start date (ISO 8601)
end_date - End date (ISO 8601)
granularity - hour, day, week, month
{
  "renders": {
    "total": 12847,
    "by_day": [
      { "date": "2024-01-15", "count": 423 },
      { "date": "2024-01-16", "count": 567 }
    ]
  },
  "cache_hit_rate": 0.943,
  "avg_response_time": 185,
  "top_user_agents": [
    { "name": "Googlebot", "percentage": 45.2 },
    { "name": "Bingbot", "percentage": 23.1 }
  ]
}
Error Codes
Common error codes and their meanings.
400
Bad Request

Invalid request parameters or malformed JSON.

401
Unauthorized

Invalid or missing API token.

403
Forbidden

Insufficient permissions or quota exceeded.

429
Rate Limited

Too many requests. Check rate limit headers.