PBN.LTD API docs
View as Markdown

Redis

The Redis object cache add-on: whether it is on, and switching it on or off per site.

Redis: the add-on and your sites

GET/api/v1/redis

Scope redis:read

Whether Redis is on for the account (plan, memory per server, paid until) and its state on each of your sites. Buying, renewing and cancelling are done on the Redis page (page_url).

Example

curl -s "https://app.pbn.ltd/api/v1/redis" \
  -H "Authorization: Bearer $PBN_API_KEY"
import os
import requests

headers = {"Authorization": "Bearer " + os.environ["PBN_API_KEY"]}
r = requests.get("https://app.pbn.ltd/api/v1/redis", headers=headers, timeout=120)
print(r.status_code, r.json())
const res = await fetch("https://app.pbn.ltd/api/v1/redis", {
  method: "GET",
  headers: {Authorization: `Bearer ${process.env.PBN_API_KEY}`}
});
console.log(res.status, await res.json());

Response

200

{
  "data": {
    "active": true,
    "available": true,
    "plan": "Redis 256 MB",
    "memory_mb": 256,
    "paid_until": "2026-10-31",
    "page_url": "https://app.pbn.ltd/redis/",
    "sites": [
      {
        "site_id": 123,
        "domain": "example.com",
        "type": "Wordpress",
        "state": "on",
        "on": true,
        "detail": "",
        "automatic": true,
        "key_prefix": "zs123:"
      }
    ]
  }
}

Errors: rate_limited, scope_missing, unauthorized

Redis on one site

GET/api/v1/sites/{site_id}/redis

Scope redis:read

Whether Redis is on for this site: "queued" while a switch is being applied (up to a minute), then "on" or "off"; "error" with the reason in detail.

Parameters

NameInTypeRequiredDescription
site_idpathintegeryesThe site id (see GET /sites).

Example

curl -s "https://app.pbn.ltd/api/v1/sites/123/redis" \
  -H "Authorization: Bearer $PBN_API_KEY"
import os
import requests

headers = {"Authorization": "Bearer " + os.environ["PBN_API_KEY"]}
r = requests.get("https://app.pbn.ltd/api/v1/sites/123/redis", headers=headers, timeout=120)
print(r.status_code, r.json())
const res = await fetch("https://app.pbn.ltd/api/v1/sites/123/redis", {
  method: "GET",
  headers: {Authorization: `Bearer ${process.env.PBN_API_KEY}`}
});
console.log(res.status, await res.json());

Response

200

{
  "data": {
    "site_id": 123,
    "domain": "example.com",
    "type": "Wordpress",
    "state": "on",
    "on": true,
    "detail": "",
    "automatic": true,
    "key_prefix": "zs123:"
  }
}

Errors: not_found, rate_limited, scope_missing, unauthorized

Switch Redis on or off for a site

PUT/api/v1/sites/{site_id}/redis

Scope redis:write

The same as the site's Redis switch. WordPress sites get the object cache installed and configured for them (and removed again when switched off, the site works exactly as before); other site types get the connection settings on the Redis page. Needs Redis on the account (402 otherwise - it is bought on the Redis page).

Parameters

NameInTypeRequiredDescription
site_idpathintegeryesThe site id (see GET /sites).
onbodybooleanyestrue = on, false = off.

Example

curl -s -X PUT "https://app.pbn.ltd/api/v1/sites/123/redis" \
  -H "Authorization: Bearer $PBN_API_KEY"
import os
import requests

headers = {"Authorization": "Bearer " + os.environ["PBN_API_KEY"]}
r = requests.put("https://app.pbn.ltd/api/v1/sites/123/redis", headers=headers, timeout=120)
print(r.status_code, r.json())
const res = await fetch("https://app.pbn.ltd/api/v1/sites/123/redis", {
  method: "PUT",
  headers: {Authorization: `Bearer ${process.env.PBN_API_KEY}`}
});
console.log(res.status, await res.json());

Response

202

{
  "data": {
    "site_id": 123,
    "domain": "example.com",
    "type": "Wordpress",
    "state": "on",
    "on": true,
    "detail": "",
    "automatic": true,
    "key_prefix": "zs123:"
  }
}

Errors: conflict, not_found, payment_required, rate_limited, scope_missing, unauthorized, unavailable