Skip to content

REST API

All endpoints live under /api/_action/p2lab-cache/... and require a valid admin API access token (the same token you use for Shopware’s other admin endpoints). Pass it as Authorization: Bearer <token>.

Returns the dashboard summary — total files / size, per-type counts, aggregated stats and per-type detailed stats.

Response (excerpt):

{
"totalFiles": 1842,
"totalSize": 91234567,
"totalSizeFormatted": "87.00 MB",
"byType": {
"products": 1200,
"buybox": 0,
"categories": 80,
"listings": 540,
"cms": 22
},
"aggregated": {
"totalPages": 1842,
"totalOriginalSize": 182000000,
"totalCachedSize": 91234567,
"totalSpaceSaved": 90765433,
"avgGenerationTime": 0.4217,
"avgCacheHitTime": 0.0019,
"compressionEnabled": true
},
"byTypeDetailed": {
"product": { "count": 1200, "spaceSaved": 65000000, "avgGenerationTime": 0.41, "avgCacheHitTime": 0.0018 }
}
}

Purges every cached entry. No body required.

Response:

{ "success": true, "filesDeleted": 1842 }

POST /api/_action/p2lab-cache/clear-by-type

Section titled “POST /api/_action/p2lab-cache/clear-by-type”

Purges every entry of a single type.

Body:

{ "type": "products" }

type must be one of products, categories, cms, listings, buybox.

Response:

{ "success": true, "filesDeleted": 1200, "type": "products" }

POST /api/_action/p2lab-cache/warmup/start

Section titled “POST /api/_action/p2lab-cache/warmup/start”

Discovers cacheable URLs and dispatches the warmup to the message queue.

Body:

{ "salesChannelId": null, "batchSize": 50 }

salesChannelId may be null (all channels) or a specific channel ID. batchSize defaults to 50.

Response:

{ "success": true, "progressId": "01HXY...ABC", "totalUrls": 1842 }

GET /api/_action/p2lab-cache/warmup/progress?progressId=<id>

Section titled “GET /api/_action/p2lab-cache/warmup/progress?progressId=<id>”

Poll the status of a warmup. If progressId is omitted, the latest warmup is returned.

Response:

{
"success": true,
"progress": {
"id": "01HXY...ABC",
"total_urls": 1842,
"processed_urls": 920,
"failed_urls": 3,
"remaining_urls": 922,
"checked_urls": 920,
"percentage": 49.95,
"status": "running"
},
"cacheStats": { /* same shape as /stats */ }
}

POST /api/_action/p2lab-cache/warmup/pause

Section titled “POST /api/_action/p2lab-cache/warmup/pause”

Pause a running warmup. Body: { "progressId": "..." }.

POST /api/_action/p2lab-cache/warmup/resume

Section titled “POST /api/_action/p2lab-cache/warmup/resume”

Resume a paused warmup. Body: { "progressId": "..." }.

POST /api/_action/p2lab-cache/warmup/cancel

Section titled “POST /api/_action/p2lab-cache/warmup/cancel”

Cancel a running or paused warmup. Body: { "progressId": "..." }.

GET /api/_action/p2lab-cache/reverse-proxy-stats

Section titled “GET /api/_action/p2lab-cache/reverse-proxy-stats”

Returns the 24-hour overview, hourly breakdown and top 20 tags.

Response:

{
"overview": { "totalPurges": 312, "distinctUrls": 220, "distinctTags": 95, "avgResponseTime": 0.012 },
"hourly": [ { "hour": "2026-05-20T13:00:00Z", "purges": 14 }, ... ],
"topTags": [ { "tag": "product-...", "count": 22 }, ... ]
}

GET /api/_action/p2lab-cache/reverse-proxy-stats/recent?limit=10&offset=0

Section titled “GET /api/_action/p2lab-cache/reverse-proxy-stats/recent?limit=10&offset=0”

Returns the most recent purges, paginated.

POST /api/_action/p2lab-cache/reverse-proxy-stats/clear

Section titled “POST /api/_action/p2lab-cache/reverse-proxy-stats/clear”

Truncates the reverse-proxy log.

GET /api/_action/p2lab-cache/reverse-proxy-log/urls?limit=100

Section titled “GET /api/_action/p2lab-cache/reverse-proxy-log/urls?limit=100”

Returns the unique URLs that have been purged.

GET /api/_action/p2lab-cache/reverse-proxy-log/url-flow?url=<url>&limit=100

Section titled “GET /api/_action/p2lab-cache/reverse-proxy-log/url-flow?url=<url>&limit=100”

Returns the chronological purge timeline for a single URL.

GET /api/_action/p2lab-cache/reverse-proxy-log/entity-timeline?entityType=<type>&entityId=<id>&limit=50

Section titled “GET /api/_action/p2lab-cache/reverse-proxy-log/entity-timeline?entityType=<type>&entityId=<id>&limit=50”

Returns every xkey purge a specific entity has triggered. entityType must be one of the allowed types (product, category, cms_page, …). For products you may pass entityNumber=<sku> instead of entityId.

POST /api/_action/p2lab-cache/invalidation-log/clear

Section titled “POST /api/_action/p2lab-cache/invalidation-log/clear”

Truncates the invalidation log.

  • All endpoints return 401 if the bearer token is missing / invalid.
  • Endpoints expecting a body return 400 on validation errors with { "success": false, "message": "..." }.
  • Endpoints not found in the latest warmup return null progress with 200, not 404.