Cache API

Overview

The Cache API gives you programmatic control over RndrKit's render cache. You can list what is cached, purge stale pages, and warm the cache for critical paths. All endpoints require an API key (see Authentication).

List Cached Pages

Returns all cached pages for a specific domain. You must own the domain.

GET /api/cache/list/:domain

curl

curl https://rndrkit.io/api/cache/list/example.com \
  -H "X-Api-Key: rk_live_your_key_here"

JavaScript

const response = await fetch("https://rndrkit.io/api/cache/list/example.com", {
  headers: { "X-Api-Key": "rk_live_your_key_here" },
});
const data = await response.json();
console.log(`${data.cachedPages} pages cached`);

Response 200

{
  "domain": "example.com",
  "cachedPages": 3,
  "pages": [
    { "path": "/", "cacheKey": "render:example.com:/" },
    { "path": "/about", "cacheKey": "render:example.com:/about" },
    { "path": "/contact", "cacheKey": "render:example.com:/contact" }
  ]
}

Purge Cache

Purge a specific page or an entire domain's cache. This clears the render cache, sitemap cache, and redirect cache for the domain. You must own the domain.

POST /api/cache/purge

Purge a Single Page

curl -X POST https://rndrkit.io/api/cache/purge \
  -H "X-Api-Key: rk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com", "path": "/about"}'
await fetch("https://rndrkit.io/api/cache/purge", {
  method: "POST",
  headers: {
    "X-Api-Key": "rk_live_your_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ domain: "example.com", path: "/about" }),
});

Purge All Pages for a Domain

Omit the path field to purge everything:

curl -X POST https://rndrkit.io/api/cache/purge \
  -H "X-Api-Key: rk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com"}'
await fetch("https://rndrkit.io/api/cache/purge", {
  method: "POST",
  headers: {
    "X-Api-Key": "rk_live_your_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ domain: "example.com" }),
});

Response 200

{
  "message": "Cache purged",
  "keysDeleted": 5
}

Refresh Cache

Warms the cache by queuing render jobs for specific paths. Existing cache entries for those paths are deleted first, then new renders are queued at lower priority than live bot requests. You must own the domain.

POST /api/cache/refresh

curl

curl -X POST https://rndrkit.io/api/cache/refresh \
  -H "X-Api-Key: rk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com", "paths": ["/", "/about", "/pricing"]}'

JavaScript

const response = await fetch("https://rndrkit.io/api/cache/refresh", {
  method: "POST",
  headers: {
    "X-Api-Key": "rk_live_your_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    domain: "example.com",
    paths: ["/", "/about", "/pricing"],
  }),
});
const data = await response.json();
console.log(data.jobs); // Array of {path, jobId}

If you omit paths, the defaults are used: /, /about, /contact, /shop.

Response 200

{
  "message": "Cache refresh queued",
  "domain": "example.com",
  "jobs": [
    { "path": "/", "jobId": "refresh_example.com___1708300000000" },
    { "path": "/about", "jobId": "refresh_example.com__about_1708300000000" },
    { "path": "/pricing", "jobId": "refresh_example.com__pricing_1708300000000" }
  ]
}

Purge All Domains

Purges the render cache for all domains you own. No request body needed.

POST /api/cache/purge-all

curl

curl -X POST https://rndrkit.io/api/cache/purge-all \
  -H "X-Api-Key: rk_live_your_key_here"

JavaScript

const response = await fetch("https://rndrkit.io/api/cache/purge-all", {
  method: "POST",
  headers: { "X-Api-Key": "rk_live_your_key_here" },
});
const data = await response.json();
console.log(`Deleted ${data.keysDeleted} keys`);

Response 200

{
  "message": "All your domain caches purged",
  "keysDeleted": 24
}

Refresh All Domains

Queues render jobs for all your domains. You can optionally pass a paths array -- if omitted, only / is refreshed per domain. This is different from the single-domain POST /api/cache/refresh endpoint, which defaults to /, /about, /contact, and /shop when paths is omitted.

POST /api/cache/refresh-all

curl

curl -X POST https://rndrkit.io/api/cache/refresh-all \
  -H "X-Api-Key: rk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"paths": ["/", "/about"]}'

JavaScript

const response = await fetch("https://rndrkit.io/api/cache/refresh-all", {
  method: "POST",
  headers: {
    "X-Api-Key": "rk_live_your_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ paths: ["/", "/about"] }),
});
const data = await response.json();
console.log(`${data.totalJobs} jobs queued across ${data.totalDomains} domains`);

Response 200

{
  "message": "All caches refresh queued",
  "totalDomains": 3,
  "totalJobs": 6,
  "jobs": [
    { "domain": "example.com", "path": "/", "jobId": "..." },
    { "domain": "example.com", "path": "/about", "jobId": "..." },
    { "domain": "other-site.com", "path": "/", "jobId": "..." },
    { "domain": "other-site.com", "path": "/about", "jobId": "..." }
  ]
}

Cache Stats

Returns aggregate cache statistics for all your domains.

GET /api/cache/stats

curl

curl https://rndrkit.io/api/cache/stats \
  -H "X-Api-Key: rk_live_your_key_here"

JavaScript

const response = await fetch("https://rndrkit.io/api/cache/stats", {
  headers: { "X-Api-Key": "rk_live_your_key_here" },
});
const data = await response.json();
console.log(`${data.totalKeys} cached pages across ${data.domainCount} domains`);

Response 200

{
  "totalKeys": 47,
  "domainCount": 3
}