The Cleanup API triggers maintenance operations that remove expired data. Rate limited to 5 requests/min due to its destructive nature. Admin only.
POST /api/v1/cleanup
Trigger data cleanup for the tenant. Removes expired variant assignments and old audit logs based on tenant retention configuration.
Example
curl -X POST https://playground.kaireonai.com/api/v1/cleanup \
-H "X-Tenant-Id: my-tenant" \
-H "X-User-Role: admin"
Response
{
"cleaned": {
"expiredVariantAssignments": 142,
"oldAuditLogs": 3580
}
}
Cleanup runs are audit-logged. You can automate periodic cleanup by calling this endpoint from a cron job or scheduled pipeline.