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

There may be a period of time (up to 60 seconds) before the URLs for a generated image are available. Because of this, polling will need to be built in to the client’s process. The client needs to handle both HTTP status code 200 and 202 for successful responses on the PUT /v3/ai/image-generations/{generationRequestId}/images/{index}/download endpoint.

HTTP status code 200 - Results are returned
{
  "url": "string",
  "generated_asset_id": "string"
}
HTTP status code 202 - Results are still pending and polling is required

If a HTTP status code 202 is returned, the client will need to poll the GET /v3/ai/image-generations/{generationRequestId}/images/{index}/download endpoint until a HTTP status code 200 is returned.