Introducing the Shutterstock Licensing Sandbox API

Confidently test and launch your integration with the new Shutterstock licensing sandbox.

The new Shutterstock licensing sandbox allows developers to test requests for image and video licenses without incurring licensing costs. Using the sandbox for testing speeds up the integration process and allows you to test your application more thoroughly. The sandbox API validates your licensing requests and verifies that your paid subscription works for those requests without deducting credits from your subscription.

The sandbox API is set up to make it easy to switch between the sandbox and the main API. That way, you can use the sandbox for development and testing and switch to the main API when you deploy to production.

How do I use the Shutterstock API sandbox?
How does the Shutterstock API sandbox work?
What can I do with the Shutterstock API Sandbox?

Subscribe to receive the latest product announcements.

How do I use the Shutterstock API sandbox?

Image by Visual Generation

To use the sandbox, change the base URL of your requests to https://api-sandbox.shutterstock.com. Then, send requests as usual to the image and video licensing endpoints, including the same authentication, registered application, and paid subscription that you use for main API requests. The sandbox does not support requests to the audio and editorial licensing endpoints.

If you’re using the JavaScript SDK version 1.0.11 or later, use the setSandbox() method to switch between the sandbox API and the main API, as in the following example. For code samples in cURL and PHP, visit the Shutterstock API documentation.

Here’s a code sample for testing image licensing with the sandbox and the JavaScript SDK:

const sstk = require(“shutterstock-api”);

sstk.setSandbox(true);

sstk.setAccessToken(process.env.SHUTTERSTOCK_API_TOKEN);

const imagesApi = new sstk.ImagesApi();

const body = {
“images”: [
{
“image_id”: “419235589”,
“price”: 12.50,
“metadata”: {
“customer_id”: “12345”
}
}
]
};

const queryParams = {
“format”: “jpg”,
“size”: “huge”,
“subscription_id”: process.env.SUBSCRIPTION_ID

};

imagesApi.licenseImages(body, queryParams)
.then(({ data }) => {
console.log(data);
})
.catch((error) => {
console.error(error);
});

Responses from the sandbox are the same as responses from the main API, but the links go to a sample image or video and not the full-size media:

{
“data”: [
{
“image_id”: “59656357”,
“download”: {
“url”: “https://download.shutterstock.com/gatekeeper/[random-characters]/shutterstock_59656357.jpg”
},
“allotment_charge”: 1
}
]
}

How does the Shutterstock API sandbox work?

Image by Kachka

The licensing sandbox replicates the main API’s endpoints, authentication, and subscription requirements. It also returns the same responses and HTTP status codes.

However, unlike the main Shutterstock API, the sandbox API:

Does not deduct credits from your subscription when you use the `POST/v2/images/licenses` or `POST/v2/videos/licenses` endpoints. The response includes an `allotment_charge` field as usual, but that allotment charge is not deducted from your subscription.
Responds to valid image and video licensing requests with a sample image or video clip instead of a license and a full-size image or video clip.
Returns errors for the `POST/v2/audio/licenses` and `POST/v2/editorial/licenses` endpoints because they are not supported in the sandbox.
Passes on all other requests to the main API.

What can I do with the Shutterstock API Sandbox?

Image by Andrii Symonenko

The primary function of the sandbox is to allow developers to test licensing requests without deducting credits. You can use the sandbox in manual tests, automated testing frameworks, and even in your applications themselves. When you’re done with testing all you have to do is to point your integration at the main API to enable actual licensing.

Visit our documentation and get started today

Cover image by liravega

The post Introducing the Shutterstock Licensing Sandbox API appeared first on The Shutterstock Blog.

Read more: shutterstock.com

Leave a Reply

Your email address will not be published. Required fields are marked *