Cache Invalidation
Purge cached prerendered pages for domains you own. Optionally prewarm to immediately re-render.
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 invalidate (and optionally prewarm) out-of-band and return status, not HTML.
Invalidate Single Page#
POST /api/prerender/cache/invalidate-page-cache#
Invalidate the cache 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 invalidate (e.g., "/pricing") |
prewarm |
boolean | Re-render immediately after invalidation. Default: false |
Response Body#
{
"ok": true,
"deleted": 1,
"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, "deleted": 1, "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#
Invalidate cache for multiple page paths in a single request.
Request Body#
| Parameter | Type | Description |
|---|---|---|
domain (required) |
string | Domain name |
paths (required) |
string[] | Array of paths to invalidate (min 1 item) |
prewarm |
boolean | Re-render all paths after invalidation. Default: false |
Response Body#
{
"ok": true,
"deleted": 3,
"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, "deleted": 3, "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#
Purge the entire cache for a domain. Optionally prewarm from sitemap. Use sparingly.
Request Body#
| Parameter | Type | Description |
|---|---|---|
domain (required) |
string | Domain name to purge completely |
sitemapUrl |
string (URL) | Custom sitemap URL for prewarm path discovery. Falls back to the domain's stored sitemap if omitted. |
prewarm |
boolean | Re-render all sitemap pages after invalidation. Default: false |
This will delete all cached pages for the domain. The next request to each page will trigger a fresh render.
Response Body#
{
"ok": true,
"deleted": 42,
"queued": 12,
"pathSource": "sitemap",
"totalPaths": 12
}
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, "deleted": 42, "queued": 12, "pathSource": "sitemap", "totalPaths": 12 }
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#
Invalidate cache only for pages whose sitemap lastmod is newer than the cached snapshot. Useful for surgical cache refreshes after content updates.
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 updated paths after invalidation. Default: false |
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,
"deleted": 5,
"queued": 5,
"pathSource": "sitemap",
"totalPaths": 5
}
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, "deleted": 5, "queued": 5, "pathSource": "sitemap", "totalPaths": 5 }
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}'
