This version of the tutorial walks you through the steps using the Postman API client. For other API clients, see the tutorial overview.
Instead of using your shutterstock.com username and password, the API uses an access token that is tied to your account and to an application. This application represents the application or program that you're using to access the API. That application can be a big, complicated program, or some simple commands like the examples in this tutorial.
Here's how to get an application and a token:
Create an account at https://www.shutterstock.com if you don't already have one.
Create an application at https://www.shutterstock.com/account/developers/apps with these settings:
localhost
example.com
Read and agree to the Shutterstock terms of service. The application settings look like this:
Click Save. The new app appears on your Developers page. It looks like this:
Later, you can create other apps to keep different API projects separate.
On the application page, click Generate token.
On the Select Scopes page, select the check box next to every scope. These scopes are permissions that control what you can do with the token. In this case, you need the token to be able to license images, and you can also enable the Collections scope to work with your custom collections.
Click Continue.
In the popup window, sign in to your Shutterstock account and click Allow to allow applications with the token to access your account.
On the Token generated! page, copy the token and save it somewhere on your computer.
Note: This token is shown only once, so make sure to save a copy before closing the page. Keep the token private, because other people could use it to access your account. The token is valid until you change your Shutterstock account password.
Now that you have an application and a token, you can set up an API client to make API requests on your behalf.
Postman is a full-featured client that helps you create, send, and save HTTP requests. The Shutterstock API provides a collection of commands for Postman, so you can import the collection and have all of the Shutterstock API commands ready to use.
Follow these steps to install Postman, import the Shutterstock commands, and set up Postman:
Install Postman.
Go to the Overview section of the Shutterstock API reference.
In the Overview section, click the Run in Postman button and follow the steps in the pop-up window to fork the collection of Shutterstock commands into your Postman application.
If the collection imported successfully, you can see the Shutterstock commands on the Postman Collections tab, as in the following picture. The commands are organized into groups based on how they are organized in the API reference.
Apply your authentication token to all commands in the collection by following these steps:
The properties for the collection look like this:
Now all of your API requests in Postman include your authentication token.
Test Postman by running a command that gets information about your account:
{{baseUrl}}/v2/user
, click Send.
This button sends the request to the Shutterstock API.The response from the API appears at the bottom of the Postman window, as in the following image. In this case, the response includes information about your account.
Now you can use Postman with your application and free subscription to make API requests. For information about the commands in the Postman collection, see the API reference. This reference page shows the commands in the same groups that are in the Postman collection, along with an example of each command and information about its parameters.
If you're familiar with searching for images on shutterstock.com, searching with the REST API is similar.
The GET /v2/images/search
endpoint is the main way to find images based on keywords, categories, and sizes.
This command is available in the Postman collection under the Images > Search > GET Search
command, as shown in the following image:
Search for one or more images with the GET /v2/images/search
endpoint.
Here's an example that searches for photos with kites in them:
In Postman, in the Images > Search > GET Search
command, set these parameters:
query
: kitesimage_type
: photopage
: 1per_page
: 5sort
: popularview
: minimalThe Postman window looks like this:
Click Send.
This search example uses the keyword "kites" and selects the first 5 results, sorted by popularity.
You can change the parameters to adjust your search; you can add any of the parameters that are shown in the API reference for the GET /v2/images/search
endpoint.
The response from the API includes info about the search results, including links to thumbnail images and the dimensions of the full images. Most importantly, the results include the IDs of the images, which you'll need to download full images.
Here's an abbreviated example of what the search results look like:
{ "page": 1, "per_page": 5, "total_count": 116, "search_id": "edc213ae-d968-47e5-8cb0-9b16f3a7fbae", "data": [ { "id": "1851475780", "aspect": 1.5, "assets": { "small_thumb": { "height": 67, "url": "https://thumb1.shutterstock.com/thumb_small/250738318/1851475780/stock-photo-wide-shot-of-a-multi-generation-family-walking-with-a-kite-on-a-sunny-beach-with-a-yellow-van-in-1851475780.jpg", "width": 100 }, "large_thumb": { "height": 100, "url": "https://thumb1.shutterstock.com/thumb_large/250738318/1851475780/stock-photo-wide-shot-of-a-multi-generation-family-walking-with-a-kite-on-a-sunny-beach-with-a-yellow-van-in-1851475780.jpg", "width": 150 }, "preview_1000": { "url": "https://ak.picdn.net/shutterstock/photos/1851475780/watermark_1000/bb93b8277668a1c8c1e612bc3925e2b8/preview_1000-1851475780.jpg", "width": 1000, "height": 667 } }, "contributor": { "id": "250738318" }, "description": "Wide shot of a multi-generation family walking with a kite on a sunny beach with a yellow van in background.", "image_type": "photo", "has_model_release": true, "media_type": "image" }, { "id": "1851471952", "aspect": 1.5017, "assets": { "small_thumb": { "height": 67, "url": "https://thumb9.shutterstock.com/thumb_small/250738318/1851471952/stock-photo-full-shot-of-a-multi-generation-family-running-with-a-kite-on-a-sunny-beach-with-the-sea-in-1851471952.jpg", "width": 100 }, "large_thumb": { "height": 100, "url": "https://thumb9.shutterstock.com/thumb_large/250738318/1851471952/stock-photo-full-shot-of-a-multi-generation-family-running-with-a-kite-on-a-sunny-beach-with-the-sea-in-1851471952.jpg", "width": 150 }, "preview_1000": { "url": "https://ak.picdn.net/shutterstock/photos/1851471952/watermark_1000/b8aa144b31c26f4690aa16157ae6c65a/preview_1000-1851471952.jpg", "width": 1000, "height": 666 } }, "contributor": { "id": "250738318" }, "description": "Full shot of a multi-generation family running with a kite on a sunny beach with the sea in background.", "image_type": "photo", "has_model_release": true, "media_type": "image" } ], "spellcheck_info": {} }
Most programming languages have libraries for working with JSON code like this and putting it into usable objects. From there, you can grab the URLs and use the preview images or thumbnails. Here's a thumbnail image from the results:
Get information about the image, including the sizes that the image is available in. For example, the image with the thumbnail in the previous step has the ID 1851471952.
Open the Images > Details > Get details
command.
Set the ids
parameter to 1851471952.
Click Send.
This image shows the command:
The full details contain links to thumbnails and previews of multiple sizes, information about the models in the image, and the dimensions and DPI of the different sizes that the image is available in.
You'll need those sizes later to make sure that you download the size of the image that you want.
In this case, the image is availale in the sizes small (500x333px), medium (1000x666), and huge (5172x3444), denoted by the small_jpg
, medium_jpg
and huge_jpg
fields in the response.
Different images are available in different sizes and formats, but all images are available in at least small and medium JPGs.
Here are some abbreviated details about the image:
{ "id": "1851471952", "added_date": "2020-11-10", "aspect": 1.5017, "assets": { "medium_jpg": { "display_name": "Med", "dpi": 300, "file_size": 732305, "format": "jpg", "height": 666, "is_licensable": true, "width": 1000 }, "small_jpg": { "display_name": "Small", "dpi": 300, "file_size": 204811, "format": "jpg", "height": 333, "is_licensable": true, "width": 500 }, "huge_jpg": { "display_name": "Huge", "dpi": 300, "file_size": 13290693, "format": "jpg", "height": 3444, "is_licensable": true, "width": 5172 }, "preview": { "height": 299, "url": "https://image.shutterstock.com/display_pic_with_logo/250738318/1851471952/stock-photo-full-shot-of-a-multi-generation-family-running-with-a-kite-on-a-sunny-beach-with-the-sea-in-1851471952.jpg", "width": 450 }, "small_thumb": { "height": 67, "url": "https://thumb9.shutterstock.com/thumb_small/250738318/1851471952/stock-photo-full-shot-of-a-multi-generation-family-running-with-a-kite-on-a-sunny-beach-with-the-sea-in-1851471952.jpg", "width": 100 }, "large_thumb": { "height": 100, "url": "https://thumb9.shutterstock.com/thumb_large/250738318/1851471952/stock-photo-full-shot-of-a-multi-generation-family-running-with-a-kite-on-a-sunny-beach-with-the-sea-in-1851471952.jpg", "width": 150 }, "huge_thumb": { "height": 260, "url": "https://image.shutterstock.com/image-photo/full-shot-multigeneration-family-running-260nw-1851471952.jpg", "width": 391 }, "preview_1000": { "url": "https://ak.picdn.net/shutterstock/photos/1851471952/watermark_1000/b8aa144b31c26f4690aa16157ae6c65a/preview_1000-1851471952.jpg", "width": 1000, "height": 666 }, "preview_1500": { "url": "https://image.shutterstock.com/z/stock-photo-full-shot-of-a-multi-generation-family-running-with-a-kite-on-a-sunny-beach-with-the-sea-in-1851471952.jpg", "width": 1500, "height": 999 } }, "categories": [ { "id": "13", "name": "People" } ], "contributor": { "id": "250738318" }, "description": "Full shot of a multi-generation family running with a kite on a sunny beach with the sea in background.", "image_type": "photo", "is_adult": false, "is_editorial": false, "is_illustration": false, "has_model_release": true, "has_property_release": false, "keywords": [ ], "media_type": "image", "model_releases": [ {} ], "models": [ {} ], "original_filename": "38273.jpg" }
That's all you have to do to search for images with the API.
The reference for the GET /v2/images/search
endpoint has many more fields to search on, and other endpoints like GET /v2/images/{id}/similar
and GET /v2/images/recommendations
get images in different ways.
For full details, see the images resource in the API reference.
Note that you may see different results when you search through the API from when you search on shutterstock.com. Different subscriptions provide access to different Shutterstock media libraries. API requests use only the media in your subscription's library, including search, details, and licensing requests. For example, when you search with the free subscription, the results are limited to images in the Free stock photos collection.
For this reason, you might see different media by searching on the API versus searching on shutterstock.com. Before trying to license media, make sure that you can access it through the API with your API subscription.
With the free API subscription, you can license and download images from Shutterstock's free collection.
Even though the images don't cost anything to license, your use of the images is legally bound to the conditions of the license that Shutterstock provides. In this case, your API subscription provides a Shutterstock API Platform License.
This license allows you to use the images in your application, but you can't provide or resell the images to other people. Other restrictions apply. For more information about this license, see What is the Shutterstock API Platform License?.
Follow these steps to license and download an image:
Get your subscription ID. If you are using the free subscription, you can find the subscription ID on the https://www.shutterstock.com/account/developers/apps page in your application information, on the Details tab, as shown in the following image.
Take note of the subscription ID, because you will need it soon.
To get your subscription ID through Postman, use the User > GET List subscriptions
command, as in this picture:
The response includes your subscription ID and the sizes of media that you can license with that subscription. In this example response, the subscription ID is s12345678.
{ "data": [ { "id": "s12345678", "expiration_time": "2022-06-23T15:08:28-04:00", "license": "integrated_media", "description": "PS Core Free Product - Image", "asset_type": "images", "allotment": { "start_time": "2021-06-23T15:08:29-04:00", "end_time": "2021-07-23T15:08:28-04:00", "downloads_left": 500, "downloads_limit": 500 }, "formats": [ { "media_type": "image", "description": "Small", "format": "jpg", "min_resolution": 500, "size": "small" }, { "media_type": "image", "description": "Med", "format": "jpg", "min_resolution": 1000, "size": "medium" }, { "media_type": "image", "description": "Huge", "format": "jpg", "min_resolution": 4000000, "size": "huge" }, { "media_type": "image", "description": "Vector", "format": "eps", "size": "vector" } ] } ] }
Use the POST /v2/images/licenses
endpoint to request a license for the image:
Open the Images > Licensing > POST License
command.
Open the Body tab for the command, which is directly underneath the URL path, as highlghted in this picture:
Because the image licensing endpoint is a POST request, you must pass the information in the body of the request in JSON format.
To see the format for the JSON data, see the API reference for the command.
In this case, we're using the command to license an image: POST /v2/images/licenses
.
Based on the example of this command and its LicenseImageRequest
schema, the JSON data to license image 1851471952 in the medium size looks like this:
{ "images": [ { "image_id": "1851471952", "subscription_id": "s12345678", "size": "medium" } ] }
On the Body tab, make sure the raw radio button is selected and the JSON format is selected.
Paste the JSON data from the previous example into the Body tab and insert the ID of the image that you want to license.
The Body tab of the command looks like this:
Licensing requests in more complicated scenarios, such as with reseller and enterprise accounts, require more information in the JSON data. For more information about licensing requests in different scenarios, see Licensing and downloading in the API reference.
Click Send.
If the licensing request is successful, the response from the API includes the URL to the full image. Download the image now, because not all subscription types allow you to download the image again later. Here's an example licensing response:
{ "data": [ { "download": { "url": "https://download.shutterstock.com/gatekeeper/W3siZCI6ICJzaHV0dGVyc3RvY2stbWVkaWEiLCAiayI6ICJwaG90by8xODUxNDcxOTUyL21lZGl1bS5qcGciLCAiZGMiOiAiaWRsXzEyMyIsICJlIjogMTYyNTA5NjUxMCwgIm0iOiAxfSwgInMxdUVXeGVHNUd2RkRrTndZWmEwN2gycWhEOCJd/shutterstock_1851471952.jpg" }, "allotment_charge": 1, "image_id": "1851471952" } ] }
Now the image is available for your use, according to the terms of the license.
Some subscription types allow you to download the image again later by using the POST /v2/images/licenses/{id}/downloads
endpoint.
If your licensing request fails, make sure that the JSON data matches the example in the last step.
Your JSON must be properly formatted, so make sure that all the quotation marks, braces ({}
), and brackets ([]
) are in the right place.
Also make sure the image ID is an image that you found by searching the free images collection and that you have used a standard size such as medium
.
That's all you need to get started with the Shutterstock API. From here, you can use all kinds of programming languages and API clients to build applications that use Shutterstock's media and services. For more information about the API, see https://developers.shutterstock.com, and the endpoint reference and code samples in the API reference.
Lots of example code is available on GitHub at https://github.com/shutterstock, such as an example of how to authenticate with the API in JavaScript: shutterstock-oath-example.
Shutterstock.com은 2023년 11월 30일 기준 475,000,000개 이상의 자산을 보유하고 있습니다.