Download image

GET/v1/images/{image_id}/content

Download generated image content for a completed image record.

Use GET /v1/images to find the image_id. The default response is a redirect to a fresh image URL. You can also request a JSON URL response or stream the image binary through the API.

Authentication

Authorization Bearer

API key as bearer token in Authorization header.

Path and Query Parameters

image_idstringrequired

The image record ID.

formatenum<string>default:redirect

Response format. Use redirect for a 302 redirect, url for JSON, or binary to stream the image file through the API.

Available options: redirect url binary

Response

redirect302

Default mode. Redirects to an image URL.

urlobject

Returned when format=url.

url.urlstring

Image URL.

url.image_idstring

Image record ID.

url.expires_ininteger

URL lifetime hint in seconds.

binaryimage/*

Returned when format=binary. Response includes Content-Disposition attachment filename.

If the image record is not completed or has no available URL, the API returns an error object.

Request

Download Mode-1: Redirect download

Shell
1curl -L https://api.token360.ai/v1/images/your-image-id/content \
2  -H "Authorization: Bearer sk-your-api-key" \
3  -o image.png

Download Mode-2: Return an image URL

Shell
1curl "https://api.token360.ai/v1/images/your-image-id/content?format=url" \
2  -H "Authorization: Bearer sk-your-api-key"

Download Mode-3: Stream binary content

Shell
1curl "https://api.token360.ai/v1/images/your-image-id/content?format=binary" \
2  -H "Authorization: Bearer sk-your-api-key" \
3  -o image.png

Response

URL response:

JSON
1{
2  "url": "your-generated-image-url",
3  "image_id": "your-image-id",
4  "expires_in": 3600
5}

Not ready:

JSON
1{
2  "error": {
3    "message": "Image is not ready yet. Current status: failed",
4    "type": "invalid_request_error"
5  }
6}
Was this page helpful?