Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Cafepress API

Build Status

IMPORTANT: This is not an official cafepress software!

Installation instructions

It is strongly recommened to use perlbrew or carton or any other Perl environment management tool.

cpanfile and cpanm installation

Your cpanfile content:

requires 'git://';

Invoking the cpanm tool:

cpanm --installdeps .

Getting started with API

  • Sign in or register a new account with
  • Get a new app key.
  • Build cool stuff. The API puts a factory at your fingertips.
  • Use with care and creativity.

Usage example

use Cafepress::Api;

my $api = Cafepress::Api->new(key=>$CPAPIKEY);

my $token = $api->call(
    'email'    => '',
    'password' => 'P4ssW0r7'
or die $api->error;

print ' * ' . $_->{name} . $/
  @{ $api->call( 'store.listStores.cp', 'userToken' => $token )->{stores}
    ->{store} };

Core Concepts

Authentication and Authorization

Any Cafepress API method that accesses a user's data requires authentication. The CafePress API follows a model similar to other public APIs, requiring an application key to give your application access to the CafePress API methods and a user token to allow your application to access and modify the data of a particular user. User tokens grant your application temporary permission to manipulate the private data of a particular user. User tokens are not the same thing as user names and passwords, although one of the methods of obtaining a user token does use the user name and password.


Before you can use these methods, you have to have an appKey.

Main Use Cases

There are really three ways to obtain a user token:

  • Logging a user in behind the scenes using their user name and password
  • Redirecting a user to Cafepress where they enter their user name and password
  • Asking for an "anonymous" user token (mostly for one-time purchases)

Logging a user in behind the scenes

In this method, the user has trusted your application enough to give their Cafepress user name and password to you. You then (securely) store these credentials and then use them in the background to generate a user token. If you provide a valid email and password with your application key, you will receive a userToken in XML as follows:


Response: <value>017c0cf7-4135-4037-8e82-cc19f061849e</value>

Redirecting User to Login

In this scenario, the user doesn't trust your application and doesn't want to give you their user name and password. Who can blame them! But you're not lost. What you can do instead is redirect them to a Cafepress hosted login page and after they log in there Cafepress will redirect them back to your application with a user token in hand. For those familiar with OAuth, this method is very similar to (but not identical to) OAuth.

Specifically, the login steps are:

  1. Ask the Cafepress API for a loginToken and store it in a session variable
  2. Redirect the user to with that loginToken in hand
  3. User logs in on
  4. redirects user back to your application with userToken in hand

Login Token Raw HTTP

Response: <value>60f818da-e4b0-4810-bf61-15ce2fd1e268</value>

Redirect Raw HTTP


Response: After the user logs in, Cafepress will redirect back to the url you passed in, for example:

Using an "Anonymous" User Token

Anonymous user tokens can be used to upload designs and create products. These are typically only used for "one-off" products that you don't intend to be made generally available later. One example of this use is to quickly create a custom product with a user's name on it and let them purchase it without having to create a Cafepress user account for that visitor.


Response: <value>e7991ac6-a28e-4e07-952c-bd68af925f38</value>


Cafepress::Api module for Perl 5



You can’t perform that action at this time.