remagicaDocs home
API referenceGenerations

Cancel a generation

POST
/generations/{generationId}/cancel

Needs a key withgenerations:cancel

Cancels a generation that hasn't finished, as a workflow's Stop does. One still queued, here or at its provider (which then drops it), is cancelled and its credits come back. One its provider is already rendering (or may have started: a request on its way) can't be stopped without being billed, so it's kept: it finishes, is charged, and comes back with stopRequested: true and its status unchanged. Nothing more is sent for it either way.

Requires scope generations:cancel.

Authorization

apiKey
headerx-api-key<token>

An API key of your workspace (rmg_…), created in the web app. It acts for that workspace, not for a person, and keeps working when its creator leaves.

Path Parameters

generationId*string
Length1 <= length <= 128

Response Body

The generation: cancelled and refunded, or kept (stopRequested), to finish and be charged.

application/json
  1. response

One generation request and its results.

completedAt*|null
createdAt*string
Formatdate-time
createdByUserId*|

Who asked for it; null when an API key did (keys belong to the workspace).

credits*integer

Credits this request costs.

creditsRefunded*boolean

Its credits came back: it failed or was cancelled before its provider billed anything. False while it runs, once it completed, and when a failed one kept them because its provider billed (or may still bill) what it was sent (error says so).

error*|

Why it failed, when status is failed.

id*string
input*

The request as accepted, defaults filled in and @ mentions resolved (their files added to the references, the prompt pointing at them as @Image1, @Video1, ...).

kind*string

What the model makes: image, video, speech, sound_effect, music or background_removal (a cutout of an image).

Value in"image""video""speech""sound_effect""music""background_removal"
metadata*

Extras from the model, e.g. seed, or timestamps (word timings) for speech, and the request's source when it named one.

model*string
organizationId*string

Id of the workspace that owns it (yours).

outputs*array<>
publishedAt?|

When it was made public; null while it's private.

references*array<>

The Library items the prompt mentioned, pinned to the version and files used.

status*string

queued → running → completed, or failed / cancelled.

Value in"queued""running""completed""failed""cancelled"
stopRequested*boolean

It was cancelled while its provider was already rendering it: nothing more is sent for it, and it finishes and is charged (or, should the provider stop it after all, ends cancelled).

updatedAt*string
Formatdate-time
visibility?string

private: your workspace only. public: also in Community, for every Remagica user. Always set in responses (optional only for older clients).

Value in"private""public"
Example Request
curl -X POST 'https://api.remagica.com/api/v1/generations/7a1c9e42-5b3d-4f60-8e2a-1d9c6b4f7e05/cancel'
Example Response
{  "completedAt": "2026-10-21T12:00:00.000Z",  "createdAt": "2026-09-30T12:00:00.000Z",  "createdByUserId": "f3656abb-5b3d-4f60-8e2a-1d9c6b4f7e05",  "credits": 12,  "creditsRefunded": true,  "error": null,  "id": "7a1c9e42-5b3d-4f60-8e2a-1d9c6b4f7e05",  "input": {    "prompt": "A lighthouse on a cliff at dusk, cinematic"  },  "kind": "image",  "metadata": {    "seed": 42  },  "model": "google/nano-banana-pro",  "organizationId": "9a863583-5b3d-4f60-8e2a-1d9c6b4f7e05",  "outputs": [    {      "contentType": "image/png",      "durationSeconds": 5,      "exportOf": {        "format": "string",        "index": 1      },      "height": 1280,      "key": "generations/e661f4c9-5b3d-4f60-8e2a-1d9c6b4f7e05/0.png",      "kind": "image",      "previews": [        {          "height": 1280,          "url": "https://files.remagica.com/generations/e661f4c9-5b3d-4f60-8e2a-1d9c6b4f7e05/0.png",          "width": 1024        }      ],      "previewUrl": "https://files.remagica.com/generations/e661f4c9-5b3d-4f60-8e2a-1d9c6b4f7e05/0.png",      "role": "output",      "sizeBytes": 2457600,      "url": "https://files.remagica.com/generations/e661f4c9-5b3d-4f60-8e2a-1d9c6b4f7e05/0.png",      "width": 1024    }  ],  "publishedAt": "2026-10-21T12:00:00.000Z",  "references": [    {      "fileIds": [        "string"      ],      "itemId": "59c47fe8-5b3d-4f60-8e2a-1d9c6b4f7e05",      "label": "string",      "version": 3,      "versionId": "772c657e-5b3d-4f60-8e2a-1d9c6b4f7e05"    }  ],  "status": "queued",  "stopRequested": true,  "updatedAt": "2026-10-21T12:00:00.000Z",  "visibility": "private"}