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.

MethodPathDescription
GET/v1/sitesList the sites in your account, newest first.
POST/v1/sitesCreate 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/validateValidate a configuration without deploying it.
POST/v1/sites/{site_id}/deploysDeploy a configuration to every location.
POST/v1/sites/{site_id}/rollbackRoll back to an earlier configuration version.
POST/v1/sites/{site_id}/purgePurge by URLs, prefixes, tags or everything.
GET/v1/purges/{purge_id}Check purge progress per location.
GET/v1/sites/{site_id}/certificatesList managed and custom certificates for a site.
POST/v1/sites/{site_id}/certificatesUpload a custom certificate and private key (Business and above).
GET/v1/sites/{site_id}/analyticsTime series of requests, bandwidth, hit ratio and latency.
GET/v1/sites/{site_id}/logsQuery up to 7 days of raw request logs.
POST/v1/tokensCreate 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.

GET/v1/sitesScope: sites:read

List the sites in your account, newest first.

Parameters

ParameterInTypeDescription
page_sizequeryinteger1–100, default 25.
cursorquerystringCursor from the previous page's next.

Response

Response 200
{
  "data": [
    {"id": "site_7Hq2xK", "hostname": "www.example.com", "plan": "business", "status": "active"}
  ],
  "next": "c_9fK2"
}
POST/v1/sitesScope: account:admin

Create a site for a hostname and origin.

Parameters

ParameterInTypeDescription
hostname requiredbodystringPublic hostname, e.g. www.example.com.
origin requiredbodystringOrigin host or URL.
shieldbodystringauto, a shield code, or off.

Response

Response 201
{
  "id": "site_7Hq2xK",
  "hostname": "www.example.com",
  "edge_target": "www.example.com.edge.cache.bz",
  "certificate": {"status": "pending_validation"}
}
GET/v1/sites/{site_id}Scope: sites:read

Retrieve one site with its current configuration version.

Parameters

ParameterInTypeDescription
site_id requiredpathstringSite ID.

Response

Response 200
{
  "id": "site_7Hq2xK",
  "hostname": "www.example.com",
  "config_version": 142,
  "shield": "FRA",
  "created_at": "2025-03-11T08:14:02Z"
}
DELETE/v1/sites/{site_id}Scope: account:admin

Delete a site. Traffic stops being served after DNS is moved away.

Parameters

ParameterInTypeDescription
site_id requiredpathstringSite ID.

Response

204 No Content: the response has no body.

Configuration

Validate, deploy and roll back cachebz.toml. Deploys are atomic and versioned.

POST/v1/sites/{site_id}/config/validateScope: config:write

Validate a configuration without deploying it.

Parameters

ParameterInTypeDescription
config requiredbodystringThe cachebz.toml contents.

Response

Response 200
{
  "valid": false,
  "errors": [
    {"line": 14, "field": "rules[2].ttl", "message": "unknown duration unit \"mins\""}
  ]
}
POST/v1/sites/{site_id}/deploysScope: config:write

Deploy a configuration to every location.

Parameters

ParameterInTypeDescription
config requiredbodystringThe cachebz.toml contents.
messagebodystringShown in the deploy history.

Response

Response 202
{
  "id": "dep_01JE40B7K2",
  "version": 143,
  "status": "rolling_out",
  "locations_done": 0,
  "locations_total": 52
}
POST/v1/sites/{site_id}/rollbackScope: config:write

Roll back to an earlier configuration version.

Parameters

ParameterInTypeDescription
version requiredbodyintegerVersion number to restore.

Response

Response 202
{
  "id": "dep_01JE40D1MZ",
  "version": 144,
  "restored_from": 141,
  "status": "rolling_out"
}

Purge

Remove content from every location. Median propagation is about 150 ms.

POST/v1/sites/{site_id}/purgeScope: purge:write

Purge by URLs, prefixes, tags or everything.

Parameters

ParameterInTypeDescription
urlsbodystring[]Up to 500 absolute URLs.
prefixesbodystring[]Up to 50 path prefixes.
tagsbodystring[]Up to 100 cache tags.
allbodybooleanPurge everything. Once per minute.
softbodybooleanMark stale instead of deleting.

Response

Response 202
{
  "id": "prg_01JD8M3Q2V",
  "status": "in_progress",
  "locations_acknowledged": 0,
  "locations_total": 52
}
GET/v1/purges/{purge_id}Scope: purge:write

Check purge progress per location.

Parameters

ParameterInTypeDescription
purge_id requiredpathstringPurge ID.

Response

Response 200
{
  "id": "prg_01JD8M3Q2V",
  "status": "completed",
  "locations_acknowledged": 52,
  "duration_ms": 162
}

Certificates

Managed certificates are issued automatically; custom ones can be uploaded.

GET/v1/sites/{site_id}/certificatesScope: sites:read

List managed and custom certificates for a site.

Parameters

ParameterInTypeDescription
site_id requiredpathstringSite ID.

Response

Response 200
{
  "data": [
    {"id": "cert_4Lm8Q", "type": "managed", "key": "ecdsa-p256", "not_after": "2027-02-27T00:00:00Z"}
  ]
}
POST/v1/sites/{site_id}/certificatesScope: certs:write

Upload a custom certificate and private key (Business and above).

Parameters

ParameterInTypeDescription
certificate requiredbodystringPEM chain, leaf first.
private_key requiredbodystringPEM private key. Never returned.

Response

Response 201
{
  "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.

GET/v1/sites/{site_id}/analyticsScope: analytics:read

Time series of requests, bandwidth, hit ratio and latency.

Parameters

ParameterInTypeDescription
from requiredqueryRFC 3339Start of the range.
to requiredqueryRFC 3339End of the range.
intervalquerystring1m, 1h or 1d.
group_byquerystringpop, country, status or cache.

Response

Response 200
{
  "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.

GET/v1/sites/{site_id}/logsScope: analytics:read

Query up to 7 days of raw request logs.

Parameters

ParameterInTypeDescription
filterquerystringExpression, e.g. status >= 500.
limitqueryintegerUp to 10,000 lines.

Response

Response 200
{
  "data": [
    {"ts": "2026-12-03T09:41:22Z", "pop": "FRA", "path": "/api/cart", "status": 502, "cache": "MISS"}
  ],
  "next": null
}

Tokens

Manage API tokens programmatically.

POST/v1/tokensScope: account:admin

Create a scoped API token. The secret is returned once.

Parameters

ParameterInTypeDescription
name requiredbodystringA label for the token.
scopes requiredbodystring[]See the scopes table in the docs.
expires_inbodystringDuration such as 90d.

Response

Response 201
{
  "id": "tok_2Pq8V",
  "name": "ci-deploy",
  "token": "cbz_live_****************",
  "expires_at": "2027-03-04T00:00:00Z"
}
DELETE/v1/tokens/{token_id}Scope: account:admin

Revoke a token. Takes effect within five seconds.

Parameters

ParameterInTypeDescription
token_id requiredpathstringToken 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.

StatusCodeMeaning
400invalid_requestThe body or parameters are malformed.
401token_missingNo or an unknown bearer token.
403token_scope_missingThe token lacks a required scope or site.
404not_foundThe resource does not exist or is not visible to this token.
409conflictA concurrent deploy or a duplicate hostname.
422config_invalidThe configuration failed validation.
429rate_limitedToo many requests; see retry-after.
5xxinternalOur problem. Safe to retry idempotent requests.