Generative AI Download Images
Downloading Generated Images
Preview size URLs are returned on the GET /v3/ai/image-generations/{generationRequestId} endpoint and the POST /ai/image-generations/* endpoints. If larger sizes are needed, the PUT /v3/ai/image-generations/{generationRequestId}/images/{index}/download and GET /v3/ai/image-generations/{generationRequestId}/images/{index}/download can be used to retrieve different sizes.
Get Access Token
In order to generate images you will need to use Client Credentials or Authorization Code to obtain an access token, and then include that token in all calls.
Get Available Download Sizes for Generated Image
To determine what sizes are available for a generated image, use the GET /v3/ai/image-generations/{generationRequestId}/images/{index}/download-sizes endpoint.
Download Sizes Request
curl -X GET \
"https://api.gettyimages.com/v3/ai/image-generations/{generationRequestId}images/{index}/download-sizes" \
-H "accept: application/json" \
-H "Api-Key: <YOUR_API_KEY>" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
Download Sizes Response
{
"download_sizes": [
{
"size_name": "string",
"height": 0,
"width": 0
}
]
}
Download Generated Image
A specific size for a generated image can be downloaded using the using the PUT /v3/ai/image-generations/{generationRequestId}/images/{index}/download
and GET /v3/ai/image-generations/{generationRequestId}/images/{index}/download
endpoints.
Download Request
curl -X PUT \
"https://api.gettyimages.com/v3/ai/image-generations/{generationRequestId}images/{index}/download" \
-H "accept: text/plain" \
-H "Api-Key: <YOUR_API_KEY>" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d "{
'size_name': 'size_name'
}"
Download Response
The response from the initial PUT
request will be an HTTP 202
. Then the client should poll GET /v3/ai/image-generations/{generationRequestId}/images/{index}/download
until a HTTP 200
is received. See the general details on the polling pattern in the main AI documentation.
HTTP status code 202 - Results are still pending and polling is required
If HTTP 202
is returned, the download is still processing.
HTTP status code 200 - Results are returned
When the download is complete and ready, the result will be HTTP 200
with a payload of the following form:
{
"url": "string",
"generated_asset_id": "string"
}