Skip to Content
API reference

Cancel a generation

POST
/v1/generations/{id}/cancel

Stops a queued or running generation. It ends cancelled and costs nothing. A generation that is already over is answered as it is.

Authorization

apiKey
headerAuthorizationBearer <tf_...>

Your API key from API keys, sent as Authorization: Bearer $TENSORFACTORY_API_KEY. Keep it on your server.

Path Parameters

id*string

The generation's id.

Formatuuid

Response Body

The generation after the cancel.

application/json
  1. response
id*string

The generation's id.

Formatuuid
status*string

queued and running are not over yet. done, failed and cancelled are final.

Value in"queued""running""done""failed""cancelled"
model*string

The model id.

prompt*|

The prompt as you sent it, only while the run is queued or running. It is not kept once the run ends, and is then null. Camera angle: the pose drawn, in words (camera.pose), always.

aspect_ratio*string

The shape you asked for. auto for inpaint.

seed*integer

The seed the run used: the one you sent, or the random one we drew, so you can make the same image again.

steps*integer

Denoising steps.

mode?|

The mode the run used (auto resolved to the mode it picked), custom when you sent steps, null for camera angle, inpaint and runs made before modes.

image*|

The edited upload's asset_id.

image_2*|

The second upload the edit used.

image_3*|

The third upload the edit used.

transparent_background*boolean

Whether the background was asked to be removed.

camera?

Camera angle only. The pose drawn, your three numbers each at the nearest pose the model draws.

mask?|

Inpaint only. The mask's upload asset_id, null for an outpaint.

outpaint?|

Inpaint only. The margins added, {left, top, right, bottom}, null for a mask. result.width and result.height are the image with them.

price_usd*number

What the run costs. While queued or running, the table price it will be charged; once done, the price charged; 0 for a failed or cancelled run. See Pricing.

usage*|

Once done, the run's GPU time.

result*|

Once done, the files the run made. Download them when the run is done: it is deleted after the first download, or 10 minutes after the run if nobody downloads it. TensorFactory keeps the run's settings, not its prompt or files.

error*|

When the run failed: type is model_error, timed_out, node_lost (the GPU stopped answering), expired (the result was not read in time), background_removal_failed, bad_output (the result could not be stored, or the GPU that took a camera angle or inpaint run couldn't run that model yet) or real_person (the prompt names a real, identifiable person). A failed run costs nothing. Run it again.

created_at*string
Formatdate-time
started_at*|
Formatdate-time
finished_at*|
Formatdate-time
Example Request
curl -X POST 'https://tensorfactory.ai/v1/generations/0b8c6f0e-5d1a-4a3e-9c61-2f7d8e4b9a10/cancel'
Example Response
{  "id": "0b8c6f0e-5d1a-4a3e-9c61-2f7d8e4b9a10",  "status": "cancelled",  "model": "qwen-image/text-to-image",  "prompt": null,  "aspect_ratio": "1:1",  "seed": 402117736,  "steps": 4,  "mode": "fast",  "image": null,  "image_2": null,  "image_3": null,  "transparent_background": false,  "price_usd": 0,  "usage": null,  "result": null,  "error": null,  "created_at": "2026-11-07T10:00:00.000Z",  "started_at": null,  "finished_at": "2026-11-07T10:00:02.000Z"}