Cache Invalidation
Re-render cached prerendered pages for domains you own. A page keeps serving its current snapshot until the new render replaces it, so a refresh never leaves a page without a snapshot.
To force a fresh render and get the rendered HTML back in a single request, pass cache_invalidate=1 to the Render API. The endpoints below render out-of-band and return status, not HTML.
When nothing is queued the response is still HTTP 200, with ok: false and an error code saying why. Common codes: render_limit_reached, origin_not_reachable, origin_host_not_reachable, path_not_reachable. Check ok, not the status code.
A refreshed page can still serve its previous copy for up to 5 minutes, and each location caches separately.
Invalidate Single Page#
POST /api/prerender/cache/invalidate-page-cache#
Re-render the snapshot for a single page path.
Request Body#
| Parameter | Type | Description |
|---|---|---|
domain (required) |
string | Domain name (e.g., "your-app.com") |
path (required) |
string | Page path to re-render (e.g., "/pricing") |
prewarm |
boolean | Re-render the page. Set false to make the call a no-op. Default: true |
Response Body#
{
"ok": true,
"prewarmed": 1
}
Example#
const response = await fetch(
'https://encited.com/api/prerender/cache/invalidate-page-cache',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-lovablehtml-api-key': '<API_KEY>'
},
body: JSON.stringify({
domain: 'your-app.com',
path: '/pricing',
prewarm: true
})
}
);
const result = await response.json();
// { "ok": true, "prewarmed": 1 }
curl -X POST \
"https://encited.com/api/prerender/cache/invalidate-page-cache" \
-H "Content-Type: application/json" \
-H "x-lovablehtml-api-key: <API_KEY>" \
-d '{"domain":"your-app.com","path":"/pricing","prewarm":true}'
Invalidate Multiple Paths#
POST /api/prerender/cache/invalidate-paths-cache#
Re-render the snapshots for several page paths in one request.
Request Body#
| Parameter | Type | Description |
|---|---|---|
domain (required) |
string | Domain name |
paths (required) |
string[] | Array of paths to re-render (min 1 item) |
prewarm |
boolean | Re-render the paths. Set false to make the call a no-op. Default: true |
Response Body#
{
"ok": true,
"prewarmed": 3
}
Example#
const response = await fetch(
'https://encited.com/api/prerender/cache/invalidate-paths-cache',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-lovablehtml-api-key': '<API_KEY>'
},
body: JSON.stringify({
domain: 'your-app.com',
paths: ['/', '/pricing', '/blog/post'],
prewarm: true
})
}
);
const result = await response.json();
// { "ok": true, "prewarmed": 3 }
curl -X POST \
"https://encited.com/api/prerender/cache/invalidate-paths-cache" \
-H "Content-Type: application/json" \
-H "x-lovablehtml-api-key: <API_KEY>" \
-d '{"domain":"your-app.com","paths":["/","/pricing","/blog/post"],"prewarm":true}'
Invalidate Entire Site#
POST /api/prerender/cache/invalidate-site-cache#
Re-render every page in a domain's sitemap. Use sparingly.
Request Body#
| Parameter | Type | Description |
|---|---|---|
domain (required) |
string | Domain name |
sitemapUrl |
string (URL) | Custom sitemap URL for path discovery. Falls back to the domain's stored sitemap if omitted. |
prewarm |
boolean | Re-render every sitemap page. Set false to make the call a no-op. Default: true |
This queues a render for every page in your sitemap, and each one counts against your render usage.
The work runs in the background. batchGroupId identifies the batch.
Response Body#
{
"ok": true,
"accepted": true,
"batchGroupId": "bg_01J8..."
}
Example#
const response = await fetch(
'https://encited.com/api/prerender/cache/invalidate-site-cache',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-lovablehtml-api-key': '<API_KEY>'
},
body: JSON.stringify({
domain: 'your-app.com',
prewarm: true,
sitemapUrl: 'https://your-app.com/sitemap.xml'
})
}
);
const result = await response.json();
// { "ok": true, "accepted": true, "batchGroupId": "bg_01J8..." }
curl -X POST \
"https://encited.com/api/prerender/cache/invalidate-site-cache" \
-H "Content-Type: application/json" \
-H "x-lovablehtml-api-key: <API_KEY>" \
-d '{"domain":"your-app.com","prewarm":true}'
Invalidate Updated Paths#
POST /api/prerender/cache/invalidate-updated-paths#
Re-render only the pages whose sitemap lastmod is newer than the cached snapshot.
Request Body#
| Parameter | Type | Description |
|---|---|---|
domain (required) |
string | Domain name (e.g., "your-app.com") |
sitemapUrl |
string (URL) | Custom sitemap URL. Falls back to the domain's stored sitemap if omitted. |
prewarm |
boolean | Re-render the updated paths. Set false to make the call a no-op. Default: true |
A path is considered "updated" if its sitemap <lastmod> date is more recent than the cached snapshot's creation time, or if the path has never been cached. Paths without a <lastmod> entry are always included.
Response Body#
{
"ok": true,
"accepted": true,
"batchGroupId": "bg_01J8..."
}
Example#
const response = await fetch(
'https://encited.com/api/prerender/cache/invalidate-updated-paths',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-lovablehtml-api-key': '<API_KEY>'
},
body: JSON.stringify({
domain: 'your-app.com',
prewarm: true,
sitemapUrl: 'https://your-app.com/sitemap.xml'
})
}
);
const result = await response.json();
// { "ok": true, "accepted": true, "batchGroupId": "bg_01J8..." }
curl -X POST \
"https://encited.com/api/prerender/cache/invalidate-updated-paths" \
-H "Content-Type: application/json" \
-H "x-lovablehtml-api-key: <API_KEY>" \
-d '{"domain":"your-app.com","prewarm":true}'
