REST API v1
API reference
All requests go to https://api.cache.bz over HTTPS with JSON bodies. Every request needs a bearer token with the scope shown on each endpoint.
| Method | Path | Description |
|---|---|---|
| GET | /v1/sites | List the sites in your account, newest first. |
| POST | /v1/sites | Create a site for a hostname and origin. |
| GET | /v1/sites/{site_id} | Retrieve one site with its current configuration version. |
| DELETE | /v1/sites/{site_id} | Delete a site. Traffic stops being served after DNS is moved away. |
| POST | /v1/sites/{site_id}/config/validate | Validate a configuration without deploying it. |
| POST | /v1/sites/{site_id}/deploys | Deploy a configuration to every location. |
| POST | /v1/sites/{site_id}/rollback | Roll back to an earlier configuration version. |
| POST | /v1/sites/{site_id}/purge | Purge by URLs, prefixes, tags or everything. |
| GET | /v1/purges/{purge_id} | Check purge progress per location. |
| GET | /v1/sites/{site_id}/certificates | List managed and custom certificates for a site. |
| POST | /v1/sites/{site_id}/certificates | Upload a custom certificate and private key (Business and above). |
| GET | /v1/sites/{site_id}/analytics | Time series of requests, bandwidth, hit ratio and latency. |
| GET | /v1/sites/{site_id}/logs | Query up to 7 days of raw request logs. |
| POST | /v1/tokens | Create a scoped API token. The secret is returned once. |
| DELETE | /v1/tokens/{token_id} | Revoke a token. Takes effect within five seconds. |
Sites
A site is one or more hostnames served with the same configuration.
/v1/sitesScope: sites:readList the sites in your account, newest first.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
page_size | query | integer | 1–100, default 25. |
cursor | query | string | Cursor from the previous page's next. |
Response
{
"data": [
{"id": "site_7Hq2xK", "hostname": "www.example.com", "plan": "business", "status": "active"}
],
"next": "c_9fK2"
}/v1/sitesScope: account:adminCreate a site for a hostname and origin.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
hostname required | body | string | Public hostname, e.g. www.example.com. |
origin required | body | string | Origin host or URL. |
shield | body | string | auto, a shield code, or off. |
Response
{
"id": "site_7Hq2xK",
"hostname": "www.example.com",
"edge_target": "www.example.com.edge.cache.bz",
"certificate": {"status": "pending_validation"}
}/v1/sites/{site_id}Scope: sites:readRetrieve one site with its current configuration version.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
site_id required | path | string | Site ID. |
Response
{
"id": "site_7Hq2xK",
"hostname": "www.example.com",
"config_version": 142,
"shield": "FRA",
"created_at": "2025-03-11T08:14:02Z"
}/v1/sites/{site_id}Scope: account:adminDelete a site. Traffic stops being served after DNS is moved away.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
site_id required | path | string | Site ID. |
Response
204 No Content: the response has no body.
Configuration
Validate, deploy and roll back cachebz.toml. Deploys are atomic and versioned.
/v1/sites/{site_id}/config/validateScope: config:writeValidate a configuration without deploying it.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
config required | body | string | The cachebz.toml contents. |
Response
{
"valid": false,
"errors": [
{"line": 14, "field": "rules[2].ttl", "message": "unknown duration unit \"mins\""}
]
}/v1/sites/{site_id}/deploysScope: config:writeDeploy a configuration to every location.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
config required | body | string | The cachebz.toml contents. |
message | body | string | Shown in the deploy history. |
Response
{
"id": "dep_01JE40B7K2",
"version": 143,
"status": "rolling_out",
"locations_done": 0,
"locations_total": 52
}/v1/sites/{site_id}/rollbackScope: config:writeRoll back to an earlier configuration version.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
version required | body | integer | Version number to restore. |
Response
{
"id": "dep_01JE40D1MZ",
"version": 144,
"restored_from": 141,
"status": "rolling_out"
}Purge
Remove content from every location. Median propagation is about 150 ms.
/v1/sites/{site_id}/purgeScope: purge:writePurge by URLs, prefixes, tags or everything.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
urls | body | string[] | Up to 500 absolute URLs. |
prefixes | body | string[] | Up to 50 path prefixes. |
tags | body | string[] | Up to 100 cache tags. |
all | body | boolean | Purge everything. Once per minute. |
soft | body | boolean | Mark stale instead of deleting. |
Response
{
"id": "prg_01JD8M3Q2V",
"status": "in_progress",
"locations_acknowledged": 0,
"locations_total": 52
}/v1/purges/{purge_id}Scope: purge:writeCheck purge progress per location.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
purge_id required | path | string | Purge ID. |
Response
{
"id": "prg_01JD8M3Q2V",
"status": "completed",
"locations_acknowledged": 52,
"duration_ms": 162
}Certificates
Managed certificates are issued automatically; custom ones can be uploaded.
/v1/sites/{site_id}/certificatesScope: sites:readList managed and custom certificates for a site.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
site_id required | path | string | Site ID. |
Response
{
"data": [
{"id": "cert_4Lm8Q", "type": "managed", "key": "ecdsa-p256", "not_after": "2027-02-27T00:00:00Z"}
]
}/v1/sites/{site_id}/certificatesScope: certs:writeUpload a custom certificate and private key (Business and above).
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
certificate required | body | string | PEM chain, leaf first. |
private_key required | body | string | PEM private key. Never returned. |
Response
{
"id": "cert_9JkR2",
"type": "custom",
"names": ["www.example.com"],
"not_after": "2027-09-30T23:59:59Z"
}Analytics
Aggregated metrics with one-minute resolution for the last 7 days.
/v1/sites/{site_id}/analyticsScope: analytics:readTime series of requests, bandwidth, hit ratio and latency.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
from required | query | RFC 3339 | Start of the range. |
to required | query | RFC 3339 | End of the range. |
interval | query | string | 1m, 1h or 1d. |
group_by | query | string | pop, country, status or cache. |
Response
{
"interval": "1h",
"series": [
{"ts": "2026-12-03T09:00:00Z", "requests": 1843221, "bytes": 96211442113, "hit_ratio": 0.951, "ttfb_p50_ms": 18.4}
]
}Logs
Raw request logs. For continuous export, configure log streaming instead.
/v1/sites/{site_id}/logsScope: analytics:readQuery up to 7 days of raw request logs.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
filter | query | string | Expression, e.g. status >= 500. |
limit | query | integer | Up to 10,000 lines. |
Response
{
"data": [
{"ts": "2026-12-03T09:41:22Z", "pop": "FRA", "path": "/api/cart", "status": 502, "cache": "MISS"}
],
"next": null
}Tokens
Manage API tokens programmatically.
/v1/tokensScope: account:adminCreate a scoped API token. The secret is returned once.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
name required | body | string | A label for the token. |
scopes required | body | string[] | See the scopes table in the docs. |
expires_in | body | string | Duration such as 90d. |
Response
{
"id": "tok_2Pq8V",
"name": "ci-deploy",
"token": "cbz_live_****************",
"expires_at": "2027-03-04T00:00:00Z"
}/v1/tokens/{token_id}Scope: account:adminRevoke a token. Takes effect within five seconds.
Parameters
| Parameter | In | Type | Description |
|---|---|---|---|
token_id required | path | string | Token ID. |
Response
204 No Content: the response has no body.
Errors
Errors use HTTP status codes and a JSON body with a stable code and a request_id to quote to support.
| Status | Code | Meaning |
|---|---|---|
400 | invalid_request | The body or parameters are malformed. |
401 | token_missing | No or an unknown bearer token. |
403 | token_scope_missing | The token lacks a required scope or site. |
404 | not_found | The resource does not exist or is not visible to this token. |
409 | conflict | A concurrent deploy or a duplicate hostname. |
422 | config_invalid | The configuration failed validation. |
429 | rate_limited | Too many requests; see retry-after. |
5xx | internal | Our problem. Safe to retry idempotent requests. |