Getting Started
Workflow Steps
Get Access Token
In order to get download links from search you will need to use Client Credentials or Authorization Code to obtain an access_token, and then include that token in all search calls.
Search For Images with Largest Downloads field specified
Search Request
curl -X GET -H "Authorization: Bearer 123456" -H "Api-Key: exampleApiKey" https://api.gettyimages.com/v3/search/images?phrase=Kitties&fields=largest_downloads
Search Response
{
"result_count": 3662,
"images": [
{
"id": "83454804",
"largest_downloads": [
{
"product_type": "easyaccess",
"uri": "https://api.gettyimages.com/v3/downloads/images/83454804"
}
]
},
{
"id": "103131833",
"largest_downloads": [
{
"product_type": "editorialsubscription",
"uri": "https://api.gettyimages.com/v3/downloads/images/103131833"
}
]
}
]
}
Download the image using its asset id and product type
The largest_downloads array for each image in the response above gives a URI to be used to download the image, as well as the product for which you are authorized to download. To download the image file, create a POST request to the URI and indicate the product_type as a query string parameter as in the example below. The default response to that request is to return a 302 redirect, which will result in the image being downloaded. If you set the auto_download parameter to false
, the response will be a JSON payload which includes the URI where you can download the actual image.
Download Request
curl -X POST -H "Api-Key: exampleApiKey" -H "Authorization: Bearer 123456" -d '' https://api.gettyimages.com/v3/downloads/images/83454804?auto_download=false&product_type=easyaccess
Download Response
{
"uri": "https://delivery.gettyimages.com/xa/83454804.jpg?....."
}
Downloading Via the Returned URI
Your client code should follow redirect (3xx) status codes returned from the URI in the response. More information here: HTTP 1.1 protocol.
The URI returned by this call should be considered opaque and the format could change at any time. In order to get the filename, length or file type, the response headers must be inspected. An example response follows:
content-length: 33959979
content-type: image/jpeg
content-disposition: attachment; filename=GettyImages-1167612765.jpg
The content-disposition header must be parsed to get a usable filename.