API integration
Automate CSS cleaning and Critical CSS reset via the Tuurbo API: access, authentication and the two available operations.
What it is
The Tuurbo Control Panel API lets technical teams manage the optimization of their sites without opening the dashboard. With these REST APIs you can check the status of your site, purge the cache, and regenerate the Critical CSS, integrating Tuurbo's optimization features directly into your systems and workflows.
API access is available on dedicated plans: contact our team to enable it.
Base URL and authentication
All endpoints live under a single base URL:
https://api.tuurbo.ai/api/v1
Every request must include your API key in the x-api-key header:
x-api-key: YOUR_API_KEY
Keep the key secret: anyone who has it can run these actions on your sites. Do not put it in public code or in the browser.
Rate limits
The API is rate limited to guarantee performance:
- General rate limit: 50 requests per interval (the interval is shown in the response headers)
- Critical CSS: maximum 3 regenerations per day per site
Responses include rate limit headers:
X-RateLimit-Limit: maximum number of requests allowedX-RateLimit-Remaining: requests left in the current interval
Available endpoints
1. Validate the website
Returns the current status of your website in Tuurbo, including Critical CSS details.
GET /websites/control-panel/validate
No parameters required. Example response (200 OK):
{
"websiteId": 139,
"rootDomain": "example.com",
"criticalLastUpdate": "2024-12-03T15:48:14.058+01:00",
"criticalAttempts": 0,
"maxCriticalAttempts": 3,
"remainingCriticalAttempts": 3
}
| Field | Meaning |
|---|---|
websiteId | Unique ID of the website in Tuurbo |
rootDomain | Main domain of the website |
criticalLastUpdate | Date and time of the last Critical CSS regeneration |
criticalAttempts | Critical CSS regenerations run today |
maxCriticalAttempts | Maximum Critical CSS regenerations allowed per day |
remainingCriticalAttempts | Critical CSS regenerations left today |
2. Purge the cache
Purges the Tuurbo cache for your website, forcing Tuurbo to fetch a fresh version of the files from your web server.
GET /websites/control-panel/purge-cache
No parameters required. Example response (200 OK):
{
"success": true,
"message": "Cache purged successfully"
}
Notes:
- Purging the cache may temporarily reduce your site's performance, because Tuurbo has to reload the files from the origin server.
- The origin server may see a temporary increase in load during this process.
3. Reset the Critical CSS
Restores and regenerates the Critical CSS for your website. Critical CSS are optimized stylesheets that improve page load time.
GET /websites/control-panel/reset-critical-css
No parameters required. Example response (200 OK):
{
"success": true,
"message": "Critical CSS reset successfully",
"attempts": 1,
"maxAttempts": 3,
"lastReset": "2025-04-17"
}
| Field | Meaning |
|---|---|
success | Whether the operation succeeded |
message | Description of the outcome |
attempts | Critical CSS regenerations run today (including this one) |
maxAttempts | Maximum Critical CSS regenerations allowed per day |
lastReset | Date of the last reset |
Notes:
- Critical CSS regeneration is limited to 3 attempts per day per website.
- The reset may temporarily reduce performance while Tuurbo analyzes and generates the new optimized CSS.
Error codes
The API returns standard HTTP status codes:
| Code | Meaning |
|---|---|
200 OK | The request was processed successfully |
401 Unauthorized | API key missing or not valid |
403 Forbidden | The API key does not have the required permissions |
429 Too Many Requests | Rate limit exceeded |
500 Internal Server Error | Internal server error |
Examples
cURL
# Validate the website
curl -X GET "https://api.tuurbo.ai/api/v1/websites/control-panel/validate" \
-H "x-api-key: YOUR_API_KEY"
# Purge the cache
curl -X GET "https://api.tuurbo.ai/api/v1/websites/control-panel/purge-cache" \
-H "x-api-key: YOUR_API_KEY"
# Reset the Critical CSS
curl -X GET "https://api.tuurbo.ai/api/v1/websites/control-panel/reset-critical-css" \
-H "x-api-key: YOUR_API_KEY"
JavaScript
fetch('https://api.tuurbo.ai/api/v1/websites/control-panel/validate', {
method: 'GET',
headers: { 'x-api-key': 'YOUR_API_KEY' }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Best practices
- Responsible use: reset the Critical CSS only when needed, for example after significant design changes.
- Monitoring: always check the remaining attempts before a Critical CSS reset, so you do not hit the daily limit in a critical situation.
- Cache purging: use it sparingly, only when needed, because it can temporarily increase the load on the origin server.
- Automation: you can automate these calls and integrate them into your deployment or maintenance workflows.