View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Brian Phillips > WebService-Shutterstock-0.001 > WebService::Shutterstock



Annotate this POD


View/Report Bugs
Module Version: 0.001   Source   Latest Release: WebService-Shutterstock-0.006


WebService::Shutterstock - Easy access to Shutterstock's public API


version 0.001


        my $shutterstock = WebService::Shutterstock->new(
                api_username => 'justme',
                api_key      => 'abcdef1234567890'

        # perform a search
        my $search = $shutterstock->search( searchterm => 'hummingbird' );

        # retrieve results of search
        my $results = $search->results;

        # details about a specific image (lookup by ID)
        my $image = $shutterstock->image( 59915404 );

        # certain actions require credentials for a specific customer account
        my $customer = $shutterstock->auth( username => $customer, password => $password );


This module provides an easy way to interact with the Shutterstock, Inc. API. You will need an API username and key from Shutterstock with the appropriate permissions in order to use this module.

While there are some actions you can perform with this object (as shown under the "METHODS" section), many API operations are done within the context of a specific user/account or a specific subscription. Below are some additional examples of how to use this set of API modules. You will find more examples and documentation in the related modules as well as the examples directory in the source of the distribution.

Licensing and Downloading

Licensing images happens in the context of a WebService::Shutterstock::Customer object. For example:

        my $licensed_image = $customer->license_image(
                image_id => 59915404,
                size     => 'medium'

If you have more than one active subscription, you will need to specify which subscription to license the image under. Please see "license_image" in WebService::Shutterstock::Customer for more details.

Once you have a licensed image, you can then download the image:

        $licensed_image->download(file => '/my/photos/hummingbird.jpg');

Every image licensed under your account (whether through or the API) can be retrieved using the customer object as well:

        my $downloads = $customer->downloads;


Lightbox retrieval starts with a customer as well but most methods are documented in the WebService::Shutterstock::Lightbox module. Here's a short example:

        my $lightboxes = $customer->lightboxes;
        my($favorites) = grep {$_->name eq 'Favorites'} @$lightboxes;

        my $favorite_images = $favorite->images;


new( api_username => $api_username, api_key => $api_key )

Constructor method, requires both the api_username and api_key parameters be passed in. If you provide invalid values that the API doesn't recognize, the first API call you make will throw an exception

auth(username => $username, password => $password)

Authenticate for a specific customer account. Returns a WebService::Shutterstock::Customer object. If authentication fails, an exception is thrown (see WebService::Shutterstock::Exception and "ERRORS" section for more information).

This is the main entry point for any operation dealing with subscriptions, image licensing, download history or lightboxes.


Returns a list of photo categories (useful for specifying a category_id when searching).


Perform a search. Accepts any params documented here: Returns a WebService::Shutterstock::SearchResults object.


Performs a lookup on a single image. Returns a WebService::Shutterstock::Image object (or undef if the image doesn't exist).


If an API call fails in an unexpected way, an exception object (see WebService::Shutterstock::Exception) will be thrown. This object should have all the necessary information for you to handle the error if you choose but also stringifies to something informative enough to be useful as well.


Brian Phillips <>


This software is copyright (c) 2012 by Brian Phillips and Shutterstock, Inc. (

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: