Read a generation
curl --request GET \
--url https://api.zerogen.com/v1/generations/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.zerogen.com/v1/generations/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/generations/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"id": "<string>",
"projectId": "<string>",
"model": "<string>",
"modelVersion": "<string>",
"status": "queued",
"outputs": [
{
"index": 4503599627370495,
"status": "queued",
"asset": {
"id": "<string>",
"mimeType": "<string>",
"width": 4503599627370495,
"height": 4503599627370495,
"durationMs": 4503599627370495,
"resourceUri": "<string>"
},
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
},
"warnings": [
{
"code": "<string>",
"message": "<string>"
}
],
"draft": {
"expiresAt": "2023-11-07T05:31:56Z",
"upscalable": true,
"upscale": "upscaling",
"finalResolution": "<string>",
"finalAssetId": "<string>"
}
}
],
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
},
"billing": {
"mode": "platform",
"state": "held",
"quotedMicroUsd": 4503599627370495,
"heldMicroUsd": 4503599627370495,
"chargedMicroUsd": 4503599627370495,
"hold": {
"state": "running",
"endedAt": "2023-11-07T05:31:56Z"
}
},
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"finishedAt": "2023-11-07T05:31:56Z"
}{
"id": "<string>",
"projectId": "<string>",
"model": "<string>",
"modelVersion": "<string>",
"status": "queued",
"outputs": [
{
"index": 4503599627370495,
"status": "queued",
"asset": {
"id": "<string>",
"mimeType": "<string>",
"width": 4503599627370495,
"height": 4503599627370495,
"durationMs": 4503599627370495,
"resourceUri": "<string>"
},
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
},
"warnings": [
{
"code": "<string>",
"message": "<string>"
}
],
"draft": {
"expiresAt": "2023-11-07T05:31:56Z",
"upscalable": true,
"upscale": "upscaling",
"finalResolution": "<string>",
"finalAssetId": "<string>"
}
}
],
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
},
"billing": {
"mode": "platform",
"state": "held",
"quotedMicroUsd": 4503599627370495,
"heldMicroUsd": 4503599627370495,
"chargedMicroUsd": 4503599627370495,
"hold": {
"state": "running",
"endedAt": "2023-11-07T05:31:56Z"
}
},
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"finishedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}Generations
Read a generation
One generation and each output’s status, asset and error. Send Prefer: wait=N to hold the response until it ends. Reads never start or repeat work.
Needs the generations:read scope.
GET
/
generations
/
{id}
Read a generation
curl --request GET \
--url https://api.zerogen.com/v1/generations/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.zerogen.com/v1/generations/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/generations/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"id": "<string>",
"projectId": "<string>",
"model": "<string>",
"modelVersion": "<string>",
"status": "queued",
"outputs": [
{
"index": 4503599627370495,
"status": "queued",
"asset": {
"id": "<string>",
"mimeType": "<string>",
"width": 4503599627370495,
"height": 4503599627370495,
"durationMs": 4503599627370495,
"resourceUri": "<string>"
},
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
},
"warnings": [
{
"code": "<string>",
"message": "<string>"
}
],
"draft": {
"expiresAt": "2023-11-07T05:31:56Z",
"upscalable": true,
"upscale": "upscaling",
"finalResolution": "<string>",
"finalAssetId": "<string>"
}
}
],
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
},
"billing": {
"mode": "platform",
"state": "held",
"quotedMicroUsd": 4503599627370495,
"heldMicroUsd": 4503599627370495,
"chargedMicroUsd": 4503599627370495,
"hold": {
"state": "running",
"endedAt": "2023-11-07T05:31:56Z"
}
},
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"finishedAt": "2023-11-07T05:31:56Z"
}{
"id": "<string>",
"projectId": "<string>",
"model": "<string>",
"modelVersion": "<string>",
"status": "queued",
"outputs": [
{
"index": 4503599627370495,
"status": "queued",
"asset": {
"id": "<string>",
"mimeType": "<string>",
"width": 4503599627370495,
"height": 4503599627370495,
"durationMs": 4503599627370495,
"resourceUri": "<string>"
},
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
},
"warnings": [
{
"code": "<string>",
"message": "<string>"
}
],
"draft": {
"expiresAt": "2023-11-07T05:31:56Z",
"upscalable": true,
"upscale": "upscaling",
"finalResolution": "<string>",
"finalAssetId": "<string>"
}
}
],
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
},
"billing": {
"mode": "platform",
"state": "held",
"quotedMicroUsd": 4503599627370495,
"heldMicroUsd": 4503599627370495,
"chargedMicroUsd": 4503599627370495,
"hold": {
"state": "running",
"endedAt": "2023-11-07T05:31:56Z"
}
},
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"finishedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {}
}
}Authorizations
A ZeroGen API key: zg_ for a live key, zg_test_ for a test key.
Headers
wait=N holds the response up to N seconds (at most 60) until the generation ends.
Pattern:
^wait=\d+$Example:
"wait=30"
Path Parameters
The generation's ID
Response
The generation.
The project that holds the outputs
Maximum string length:
200Pattern:
^[a-z0-9]+(?:[.-][a-z0-9]+)*\/[a-z0-9]+(?:[.-][a-z0-9]+)*\/[a-z0-9]+(?:[.-][a-z0-9]+)*$Available options:
queued, running, succeeded, partial, failed, cancelled Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Pattern:
^(?:(?:\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))$Pattern:
^(?:(?:\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))$Pattern:
^(?:(?:\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))$