Generative AI by Getty Images
Getty Images has partnered with NVIDIA to develop a commercially safe AI model that has been trained exclusively on Getty Images' best-in-class creative content and data, allowing you to rest assured that the images you generate, and license, are backed by our uncapped legal indemnification. We’ve created a model that compensates our world-class content creators for the use of their work in our AI model, allowing them to continue to create more of the high-quality pre-shot imagery you depend on. From ideation to execution, Generative AI combines perfectly with the pre-shot Getty Images content libraries and solutions to elevate your entire creative process.
Access to the image generation functionality is restricted to Getty Images customers and partners with an AI Generation license agreement.
Refer to Swagger for full AI Generation API technical documentation.
Getting Started with Generative AI using the Getty Images API
Best Practices
Due to the nature of image generation, there may be a period of time (up to 60 seconds) before the generated images 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 many of the endpoints. Response codes are documented in Swagger for each endpoint.
Example 200 and 202 responses:
HTTP status code 200 - Results are returned
{
"generation_request_id": "string",
"seed": 0,
"results": [
{
"index": 0,
"is_blocked": true,
"preview_urls": [
{
"preview_size": "string",
"image_url": "string",
"width": 0,
"height": 0
}
],
"url": "string"
}
],
"original_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} endpoint using the returned generation_request_id in the response until a HTTP status code 200 is returned.
{
"generation_request_id": "string"
}
General Recommendations:
- When polling, wait 1 second between calls.
- Avoid long lived connections on your server by polling from the user agent.
- Do not try to encapsulate all Getty Images API calls into a single call from the user agent. This will lead to timeouts.
Sequence Diagram
Basic Image Generation Workflow Example
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.
Generate images using a prompt
Use a prompt to generate images. Use our prompt guide to learn more about writing prompts.
Image Generation Request
curl -X POST \
"https://api.gettyimages.com/v3/ai/image-generations" \
-H "accept: application/json" \
-H "Api-Key: <YOUR_API_KEY>" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d "{
'prompt': 'Prompt Text',
'aspect_ratio': '4:3'
}"
Image Generation Response
The response code can be either HTTP status code 200 or 202. Examples can be found in this section.
HTTP Status Codes
General guidelines on HTTP status codes can be found in this section.
429 - Too Many Requests
A 429 status code indicates the client has sent too many requests in a
given amount of time. This may be due to the client’s rate limit (information in this section)
or the number of concurrent pending generations.
If the number of queries per second (QPS) sent by the client is less than the client’s rate limit and the 429 status code is
returned on any of the ai/image-generations/*
endpoints it may be due to concurrent generations rather than rate limit.
There are limits to how many concurrent generations can be pending. When the client goes over their alloted limit, the calls will return HTTP status code 429. We suggest handling a 429 status code by waiting for 1 second and calling again.
HTTP/2 429
content-type: application/json
content-length: 31
{"message":"Too Many Requests"}
The easiest way to handle 429 status responses is to use a fault-handling library such as Polly for .NET or Tenacity for Python. Libraries for other languages can be found on GitHub.