Retrieve a batch
A batch with every generation in it, each as GET /v1/generations/{id} would return it. Send Prefer: wait=60 to hold the read until every run is final or 60 seconds pass. While any run isn’t final, Retry-After says how many seconds to wait before the next read.
Needs an API key with the generations:read scope.
curl --request GET \
--url https://api.tryleap.ai/v1/batches/{id} \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.tryleap.ai/v1/batches/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/batches/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"id": "bat_5Tq8Lm2Xv9Kr4Wn7Bc1Yd3Hp",
"object": "batch",
"data": [
{
"id": "gen_2Pk7Wd4Qx9Lm1Tn6Vb3Rc8Hy",
"object": "generation",
"model": "black-forest-labs/flux-2-pro",
"modality": "image",
"status": "queued",
"provider": null,
"revision": "2026-10-02",
"input": {
"prompt": "A fox in the snow, watercolor",
"aspect_ratio": "1:1",
"n": 1
},
"output": [],
"error": null,
"usage": {
"cost_usd": null
},
"source": "api",
"batch_id": "bat_5Tq8Lm2Xv9Kr4Wn7Bc1Yd3Hp",
"created_at": "2026-10-04T18:22:41.512Z",
"started_at": null,
"completed_at": null
},
{
"id": "gen_9Rb3Hy6Tc1Vn8Lm4Qx7Wd2Pk",
"object": "generation",
"model": "black-forest-labs/flux-2-pro",
"modality": "image",
"status": "queued",
"provider": null,
"revision": "2026-10-02",
"input": {
"prompt": "A fox in the snow, linocut print",
"aspect_ratio": "1:1",
"n": 1
},
"output": [],
"error": null,
"usage": {
"cost_usd": null
},
"source": "api",
"batch_id": "bat_5Tq8Lm2Xv9Kr4Wn7Bc1Yd3Hp",
"created_at": "2026-10-04T18:22:41.512Z",
"started_at": null,
"completed_at": null
}
]
}{
"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 batch does not exist.",
"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.
Headers
wait=N holds the request open for up to N seconds (at most 60) until the generation finishes, and Preference-Applied echoes the wait used. Most images finish inside the wait. If the run is still going when it ends, you get it back queued or running; poll it from there. Without this header the generation comes back queued at once.
"wait=60"
Path Parameters
The batch's ID, bat_....
curl --request GET \
--url https://api.tryleap.ai/v1/batches/{id} \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.tryleap.ai/v1/batches/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/batches/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"id": "bat_5Tq8Lm2Xv9Kr4Wn7Bc1Yd3Hp",
"object": "batch",
"data": [
{
"id": "gen_2Pk7Wd4Qx9Lm1Tn6Vb3Rc8Hy",
"object": "generation",
"model": "black-forest-labs/flux-2-pro",
"modality": "image",
"status": "queued",
"provider": null,
"revision": "2026-10-02",
"input": {
"prompt": "A fox in the snow, watercolor",
"aspect_ratio": "1:1",
"n": 1
},
"output": [],
"error": null,
"usage": {
"cost_usd": null
},
"source": "api",
"batch_id": "bat_5Tq8Lm2Xv9Kr4Wn7Bc1Yd3Hp",
"created_at": "2026-10-04T18:22:41.512Z",
"started_at": null,
"completed_at": null
},
{
"id": "gen_9Rb3Hy6Tc1Vn8Lm4Qx7Wd2Pk",
"object": "generation",
"model": "black-forest-labs/flux-2-pro",
"modality": "image",
"status": "queued",
"provider": null,
"revision": "2026-10-02",
"input": {
"prompt": "A fox in the snow, linocut print",
"aspect_ratio": "1:1",
"n": 1
},
"output": [],
"error": null,
"usage": {
"cost_usd": null
},
"source": "api",
"batch_id": "bat_5Tq8Lm2Xv9Kr4Wn7Bc1Yd3Hp",
"created_at": "2026-10-04T18:22:41.512Z",
"started_at": null,
"completed_at": null
}
]
}{
"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 batch does not exist.",
"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"
}
}