Sign in

Delete many generations

Delete up to 200 generations in one call. Ideal when your product removes an entity (say, a character or a project) and needs to clean up every generation tied to it — send the ids in batches.

POST /v1/generations/bulk-delete

Delete up to 200 generations by id.

Pass up to 200 `requestIds`. Deletes each by id — images and videos alike. (Note: a video id is deletable here even though `GET`/`list` on `/v1/generations` only surface images.) **Partial success — one bad id never fails the batch.** Each id ends up in one of three outcomes: deleted (terminal, removed), `conflicts` (still queued/processing — retry later), or `notFound` (matched nothing you own). Deleted ids are not echoed back: they are your de-duplicated input minus `conflicts` and `notFound`. `deleted` is the count this call actually removed — it can be lower if a concurrent call already removed some of the same ids.

A well-formed batch always returns HTTP 200 — per-id outcomes live in the body. Stored-file cleanup is best-effort; expired generations contribute 0 to `removedObjects`.

**More than 200?** Loop on your side in batches of ≤200. The call is idempotent — re-sending already-deleted ids returns them in `notFound` with `deleted: 0`, so retrying a failed batch is safe.

bash
# Delete a batch
curl -X POST 'https://api.xmode.ai/v1/generations/bulk-delete' \
  -H "Authorization: Bearer xm_live_<your-key>" \
  -H "Content-Type: application/json" \
  -d '{ "requestIds": ["req_3xN7kQ1aJpL9wDvE", "req_8kD2mP0bXtN4zHfR"] }'

# 200 OK
{
  "requested": 2,
  "deleted": 1,
  "removedObjects": 3,
  "conflicts": ["req_8kD2mP0bXtN4zHfR"],
  "notFound": []
}

# Deleting thousands? Loop in chunks of 200 (JS):
#   for (let i = 0; i < ids.length; i += 200) {
#     await fetch('/v1/generations/bulk-delete', {
#       method: 'POST',
#       headers: { Authorization: 'Bearer …', 'Content-Type': 'application/json' },
#       body: JSON.stringify({ requestIds: ids.slice(i, i + 200) }),
#     });
#   }