Cache API Endpoints
API endpoints for cache management.
GET /api/cache/clear
Get cache statistics.
Response:
{
"success": true,
"stats": {
"type": "redis",
"size": 42,
"available": true
}
}
POST /api/cache/clear
Clear cache entries.
Query Parameters:
all=true- Clear all cache (requires auth)pattern=content:*- Clear matching pattern
Headers:
Authorization: Bearer <token>
Example:
curl -X POST https://your-domain.com/api/cache/clear?all=true \
-H "Authorization: Bearer your-secret-token"
POST /api/cache/invalidate
Invalidate cache for specific document types.
Body:
{
"type": "document",
"documentType": "hero",
"locale": "en"
}
Headers:
Authorization: Bearer <token>
POST /api/webhooks/sanity
Sanity webhook endpoint for automatic cache invalidation.
Headers:
Authorization: Bearer <token>
Body: Sanity webhook payload