Cancel a generation
Stops a queued or running generation and releases its hold; if the provider finishes it anyway, the result is thrown away and nothing is charged. A generation that already ended comes back as it is. Two kinds can’t be stopped once started and answer 409: a run at a provider that bills it either way, and a preset run that has already shown its preview. Each runs to its end and is charged only if it succeeds.
Needs an API key with the generations:write scope.
curl --request POST \
--url https://api.tryleap.ai/v1/generations/{id}/cancel \
--header 'x-api-key: <api-key>'const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.tryleap.ai/v1/generations/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/generations/{id}/cancel"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text){
"id": "gen_7Hq2mVx9Lr4Kp8Tn3Wc6Yb1D",
"object": "generation",
"model": "google/veo-3.1-fast",
"modality": "video",
"status": "canceled",
"provider": null,
"revision": "2026-10-02",
"input": {
"prompt": "A heron lands on a still lake at dawn",
"aspect_ratio": "16:9",
"n": 1,
"duration": 4,
"resolution": "1080p",
"audio": true
},
"output": [],
"error": null,
"usage": {
"cost_usd": null
},
"source": "api",
"batch_id": null,
"created_at": "2026-10-04T18:22:41.512Z",
"started_at": null,
"completed_at": "2026-10-04T18:22:50.218Z"
}{
"error": {
"type": "invalid_request_error",
"code": "conflicting_credentials",
"message": "Send one API key.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "authentication_error",
"code": "authentication_required",
"message": "Authentication is required.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "permission_error",
"code": "permission_denied",
"message": "Permission denied.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "That generation does not exist.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "conflict_error",
"code": "conflict",
"message": "The request conflicts with the current state.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Too Many Requests",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}Authorizations
Your workspace API key, leap_.... Create one at https://app.tryleap.ai/go/api, and keep it on your server.
Path Parameters
The generation's ID, gen_....
Response
The generation, canceled, or as it was if it had already ended.
One run of a model or preset, with its status, its outputs and what it cost.
The generation's ID, gen_ and 24 letters and digits.
"generation"The model or preset it runs, with a preset's version.
What it makes: image, video, audio, 3d or text.
image, video, audio, 3d, text queued, then running, then one of succeeded, failed or canceled. Only succeeded is charged.
queued, running, succeeded, failed, canceled Which upstream ran it, once one did. Informational: the model ID and input stay the same whichever runs it.
The model's schema and price revision the run used.
^\d{4}-\d{2}-\d{2}$The input as it runs, with the defaults filled in.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Why a failed run failed, such as a refused prompt or a provider error; null otherwise. A failed run isn't charged.
Show child attributes
Show child attributes
What the run cost your workspace.
Show child attributes
Show child attributes
Where it was started: api, mcp or studio.
studio, api, mcp The batch it belongs to, bat_...; null if none.
When it was created.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$When it started running; null while queued.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$When it reached a final status; null before.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$While a preset that makes a still first is running: that still, once it exists, before the video it becomes. Absent for every other run, and for a run whose video also reads words or a photo you sent, such as a line to say or a photo the clip starts from: that still comes with the video.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.tryleap.ai/v1/generations/{id}/cancel \
--header 'x-api-key: <api-key>'const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.tryleap.ai/v1/generations/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/generations/{id}/cancel"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text){
"id": "gen_7Hq2mVx9Lr4Kp8Tn3Wc6Yb1D",
"object": "generation",
"model": "google/veo-3.1-fast",
"modality": "video",
"status": "canceled",
"provider": null,
"revision": "2026-10-02",
"input": {
"prompt": "A heron lands on a still lake at dawn",
"aspect_ratio": "16:9",
"n": 1,
"duration": 4,
"resolution": "1080p",
"audio": true
},
"output": [],
"error": null,
"usage": {
"cost_usd": null
},
"source": "api",
"batch_id": null,
"created_at": "2026-10-04T18:22:41.512Z",
"started_at": null,
"completed_at": "2026-10-04T18:22:50.218Z"
}{
"error": {
"type": "invalid_request_error",
"code": "conflicting_credentials",
"message": "Send one API key.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "authentication_error",
"code": "authentication_required",
"message": "Authentication is required.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "permission_error",
"code": "permission_denied",
"message": "Permission denied.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "That generation does not exist.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "conflict_error",
"code": "conflict",
"message": "The request conflicts with the current state.",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Too Many Requests",
"param": null,
"doc_url": null,
"request_id": "req_8kQ2vX9mR4tL6nB1cW3yZ5aD"
}
}