Cleanup Tasks

REST endpoints for cleanup tasks. Bearer-auth required.

GET /api/cleanup-tasks

List cleanup tasks.

Query parameters

  • limit (optional): Page size (1–100, default 100).
  • after (optional): Keyset cursor — return the page after this row (next page).
  • before (optional): Keyset cursor — return the page before this row (prev page).
  • ids (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
  • filter (optional): Nested filter expression (<Entity>Filter): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
  • orderBy (optional): Multi-key sort (<Entity>OrderBy[]): array of { field: direction } applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
  • status (optional): Filter by cleanup task status.
  • resource_type (optional): Filter by resource kind being cleaned up.
  • workspace_id (optional): Filter to tasks touching a specific workspace's resources.
  • parent_id (optional): Filter to children of a given parent cleanup task.
  • source_event_id (optional): Filter to tasks spawned by a specific source event.

Response

JSON
{
  "data": [
    {
      "id": "<...>",
      "parentId": "<...>",
      "workspaceId": "<...>",
      "sourceEventId": "<...>",
      "resourceType": "<...>",
      "resourceId": "<...>",
      "metadata": "<...>",
      "status": "<...>",
      "attempts": "<...>",
      "lastError": "<...>",
      "createdAt": "<...>",
      "completedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}

GET /api/cleanup-tasks/{id}

Get a cleanup task by ID.

Path parameters

  • id (required): Cleanup task to retrieve.

Response

JSON
{
  "id": "string",
  "parentId": "string",
  "workspaceId": "string",
  "sourceEventId": "string",
  "resourceType": "delete_workspace | delete_app | delete_element | delete_database",
  "resourceId": "string",
  "metadata": {},
  "status": "pending | in_progress | completed | failed",
  "attempts": "integer",
  "lastError": "string",
  "createdAt": "string",
  "completedAt": "string"
}

POST /api/cleanup-tasks/{id}/retry

Retry cleanup task

Re-queue a failed cleanup task for another attempt (admin only).

Path parameters

  • id (required): The cleanup task's prefixed ID.

Response

JSON
{
  "ok": "boolean"
}

GET /api/cleanup-tasks/{id}/tree

Get cleanup task tree

Get a cleanup task and all its descendants as a flat array (admin only).

Path parameters

  • id (required): The cleanup task's prefixed ID.

Response

JSON
[
  {
    "id": "string",
    "parentId": "string",
    "workspaceId": "string",
    "sourceEventId": "string",
    "resourceType": "<...>",
    "resourceId": "string",
    "metadata": {},
    "status": "<...>",
    "attempts": "integer",
    "lastError": "string",
    "createdAt": "string",
    "completedAt": "string"
  }
]