Simple Print API

Peecho
Peecho logo

Simple Print API

Build your own app with this very simple REST API to place print orders.

About 99% of our customers use embedded Javascript instead. Find out what you need.

Print from source URL versus variable data

The API can be used to print by source URL, pretty much like our print button, but is also capable of merging variable data with pre-fabricated templates. This is useful to create personalized products that are based on the same design.

Asynchronous source file generation

Last but not least, the API can be used in conjunction with the print button. It allows customers to order products based on source files that are not there yet. So, you can create source files asynchronously and tell us when they are ready.

You need prepaid credit

Using the API, you can build your own user interface, including payment screens. As a result, orders through the API can only be placed if you have enough prepaid credit to cover for the production costs.

See our Plans and Prices page for wholesale prices.


 SIGN UP

peecho penguin

Discounts

For all paid plans, the following applies.

What about prepaid credit?

In order to pay for orders through the Simple Print API, you need prepaid credit. You can buy this through your dashboard. The prepaid credit is yours. In your own app, you can collect the consumer payments and charge whatever you like. For every order that you place through the API, we subtract the wholesale price from your prepaid credit before commencing with the order.

We do this, so we can allow anyone to use the API without doing a thorough credibility check and such. It makes everything simpler.

GET /rest/offering/list

Purpose

Display the list of available offerings for a certain merchant and application.

Request

Parameter Required Explanation
applicationApiKey yes Unique string identifier of the application
merchantApiKey yes Unique string identifier of the merchant
currencies no Express offering prices in various currencies. ALL returns all available currencies.

Curl command

curl -v "http://www.peecho.com/rest/offering/list?applicationApiKey={yourApplicationApiKey}&merchantApiKey={yourMerchantApiKey}"

Response

A list of offering details of the following structure:

<?xml version="1.0"?>
<root>
	<pricingExpireDate>2011-09-13T16:00:00.000+02:00</pricingExpireDate>
	<offerings>
		<offering>
			<id>1</id>
			<price>1.00</price>
			<countryShippingPrice>0.00</countryShippingPrice>
			<regionShippingPrice>0.00</regionShippingPrice>
			<worldShippingPrice>0.00</worldShippingPrice>
			<pricePerPage>1.00</pricePerPage>
			<name>boek a5</name>
			<downloadLocation>http://cloud.peecho.com/1/</downloadLocation>
			<currency>EUR</currency>
			<priceByCurrency>
				<value amount="1.00" currency="EUR"/>
				<value amount="1.37" currency="USD"/>
			</priceByCurrency>
			<pricePerPageByCurrency>
				<value amount="0.00" currency="EUR"/>
				<value amount="0.00" currency="USD"/>
			</pricePerPageByCurrency>
			<countryShippingPriceByCurrency>
				<value amount="0.00" currency="EUR"/>
				<value amount="0.00" currency="USD"/>
			</countryShippingPriceByCurrency>
			<regionShippingPriceByCurrency>
				<value amount="0.00" currency="EUR"/>
				<value amount="0.00" currency="USD"/>
			</regionShippingPriceByCurrency>
			<worldShippingPriceByCurrency>
				<value amount="0.00" currency="EUR"/>
				<value amount="0.00" currency="USD"/>
			</worldShippingPriceByCurrency>
			<vatPercentage>19</vatPercentage>
			<defaultNumberOfPages>12</defaultNumberOfPages>
			<minNumberOfPages>0</minNumberOfPages>
			<maxNumberOfPages>100</maxNumberOfPages>
			<dimensionWidth>0</dimensionWidth>
			<dimensionHeight>0</dimensionHeight>
			<minimumQuantity>1</minimumQuantity>
			<addShipping>true</addShipping>
			<recommended>false</recommended>
			<dimensionUnit>mm</dimensionUnit>
			<elements>
				<id>1</id>
				<name>content</name>
				<url/>
			</elements>
			<elements>
				<id>2</id>
				<name>cover</name>
				<url>cover</url>
			</elements>
			<catalogueItemCode>boek a5</catalogueItemCode>
			<merchantApiKey>your-merchant-api-key</merchantApiKey>
			<applicationApiKey>your-application-api-key</applicationApiKey>
			<fixedSize>false</fixedSize>
		</offering>
	</offerings>
</root>
				

GET /rest/offering/list/filtered

Purpose

Display a filtered list of available offerings for a certain application.

Request

Parameter Required Explanation
applicationApiKey yes Unique string identifier of the application
numberOfPages yes Filters the available offerings based on minimum and maximum number of pages needed to print the document.
fileType yes Should be PDF, JPG, JPEG, GIF, or PNG. When specifying PDF the width and height are in mm, otherwise it is in pixels.
width no Filters the available offerings based on size and aspect ratio. You should set both width and height when using this.
height no Filters the available offerings based on size and aspect ratio. You should set both width and height when using this.
recipientCountry no Filters the available offerings based on the recipient country. Not all products can be send to all countries. Use this to know for sure we can send to order to the recipient country.
currencies no Express offering prices in various currencies. ALL returns all available currencies.

Curl command

curl -v "http://www.peecho.com/rest/offering/list/filtered?applicationApiKey={yourApplicationApiKey}&numberOfPages=40&fileType=PDF"

Response

The response is exactly the same to the response for /rest/offering/list

<?xml version="1.0"?>
<root>
	<pricingExpireDate>2011-09-13T16:00:00.000+02:00</pricingExpireDate>
	<offerings>
		<offering>
			<id>1</id>
			<price>1.00</price>
			<countryShippingPrice>0.00</countryShippingPrice>
			<regionShippingPrice>0.00</regionShippingPrice>
			<worldShippingPrice>0.00</worldShippingPrice>
			<pricePerPage>1.00</pricePerPage>
			<name>boek a5</name>
			<downloadLocation>http://cloud.peecho.com/1/</downloadLocation>
			<currency>EUR</currency>
			<priceByCurrency>
				<value amount="1.00" currency="EUR"/>
				<value amount="1.37" currency="USD"/>
			</priceByCurrency>
			<pricePerPageByCurrency>
				<value amount="0.00" currency="EUR"/>
				<value amount="0.00" currency="USD"/>
			</pricePerPageByCurrency>
			<countryShippingPriceByCurrency>
				<value amount="0.00" currency="EUR"/>
				<value amount="0.00" currency="USD"/>
			</countryShippingPriceByCurrency>
			<regionShippingPriceByCurrency>
				<value amount="0.00" currency="EUR"/>
				<value amount="0.00" currency="USD"/>
			</regionShippingPriceByCurrency>
			<worldShippingPriceByCurrency>
				<value amount="0.00" currency="EUR"/>
				<value amount="0.00" currency="USD"/>
			</worldShippingPriceByCurrency>
			<vatPercentage>19</vatPercentage>
			<defaultNumberOfPages>12</defaultNumberOfPages>
			<minNumberOfPages>0</minNumberOfPages>
			<maxNumberOfPages>100</maxNumberOfPages>
			<dimensionWidth>0</dimensionWidth>
			<dimensionHeight>0</dimensionHeight>
			<minimumQuantity>1</minimumQuantity>
			<addShipping>true</addShipping>
			<recommended>false</recommended>
			<dimensionUnit>mm</dimensionUnit>
			<elements>
				<id>1</id>
				<name>content</name>
				<url/>
			</elements>
			<elements>
				<id>2</id>
				<name>cover</name>
				<url>cover</url>
			</elements>
			<catalogueItemCode>boek a5</catalogueItemCode>
			<merchantApiKey>your-merchant-api-key</merchantApiKey>
			<applicationApiKey>your-application-api-key</applicationApiKey>
			<fixedSize>false</fixedSize>
		</offering>
	</offerings>
</root>

POST /rest/order

Purpose

Create a new order.

Request

Parameter Required Explanation
merchantApiKey yes Unique string identifier of the merchant
offeringId yes Unique integer identifier of your offering
emailAddress no Customer email address for order reference
merchantReference no Use your own internal id as a reference to couple this order to your internal systems
paymentReference no Reference for the payment provider, this should be a globally unique identifier. Use UUID
title no The on-screen title of the document visible in the admin panels
locale no The locale of the end customer. E-mails send from our systems will be in this language. Defaults to en_EN
currency no The currency used to pay with. Defaults to EUR

Curl command

curl -v -d "merchantApiKey={yourApiKey}&offeringId={yourOfferingId}" "http://www.peecho.com/rest/order"

Response

An XML representation of the new order including the policy and signature to be used when sending files to the order bucket.

<?xml version="1.0"?>
<order>
  <externalOrderId>4194</externalOrderId>
  <signedPutUrl>http://peecho-test-order.s3.amazonaws.com</signedPutUrl>
  <signedPutPath>1/4194/</signedPutPath>
  <base64EncodedPolicy>encoded-policy </base64EncodedPolicy>
  <signature>3XRuQ96XNs10porjx30=</signature>
  <apiVersion>0</apiVersion>
  <id>4194</id>
  <orderState>OPEN</orderState>
  <quantity>1</quantity>
</order>
	

POST /rest/order/create_from_source_url

Purpose

Create a new order based on a source document (either PDF or image).

Request

Parameter Required Explanation
merchantApiKey yes Unique string identifier of the merchant
offeringId yes Unique integer identifier of your offering
numberOfPages yes The total number of pages in the source document including cover pages.
sourceUrl yes The full URL to the source document
sourceWidth yes The width in mm of the source PDF document
sourceHeight yes The height in mm of the source PDF document
filetype no The filetype of the source document, can be either PDF or IMAGE. Defaults to PDF
merchantReference no Use your own internal id as a reference to couple this order to your internal systems
paymentReference no Reference for the payment provider, this should be a globally unique identifier. Use UUID
title no The on-screen title of the document visible in the admin panels
locale no The locale of the end customer. E-mails send from our systems will be in this language. Defaults to en_EN
currency no The currency used to pay with. Defaults to EUR

Curl command

curl -v -d "merchantApiKey={yourMerchantApiKey}&offeringId=70&numberOfPages=40&sourceUrl=https://dl.dropboxusercontent.com/u/5278037/mediamarkt.pdf&sourceWidth=245&sourceHeight=220" "http://www.peecho.com/rest/order/create_from_source_url"

Response

An XML representation of the new order including the policy and signature to be used when sending files to the order bucket.

<?xml version="1.0"?>
<order>
  <externalOrderId>4194</externalOrderId>
  <signedPutUrl>http://peecho-test-order.s3.amazonaws.com</signedPutUrl>
  <signedPutPath>1/4194/</signedPutPath>
  <base64EncodedPolicy>encoded-policy </base64EncodedPolicy>
  <signature>3XRuQ96XNs10porjx30=</signature>
  <apiVersion>0</apiVersion>
  <id>4194</id>
  <orderState>OPEN</orderState>
  <quantity>1</quantity>
</order>
	

POST /rest/order/details

Purpose

Supply additional details about an order, such as the customer shipping address and quantity.

Request

Parameter Required Explanation
externalOrderId yes Unique external string identifying the order
shippingAddressXml yes XML representation of the shipping address
emailAddress yes Customer email address. Used for order status updates and customer support
customerName no Name of the customer
quantity no Number of copies requested. Defaults to 1
shippingTrackingUpsell no Use track & trace shipping if available.

The shipping address must have the following structure:

<?xml version="1.0"?>
<address>
	<firstName>recipientFirstName</firstName>
	<lastName>recipientLastName</lastName>
	<addressLine1>shippingAddressLine1</addressLine1>
	<addressLine2>shippingAddressLine2</addressLine2>
	<zipCode>shippingZipCode</zipCode>
	<city>shippingCity</city>
	<country>Netherlands</country>
	<countryCode>NL</countryCode>
</address>	
	

Curl command

curl -v -d "externalOrderId={externalOrderId}&emailAddress=marcel@peecho.com&shippingAddressXml=<?xml version='1.0'?><address><firstName>recipientFirstName</firstName><lastName>recipientLastName</lastName><addressLine1>shippingAddressLine1</addressLine1><addressLine2>shippingAddressLine2</addressLine2><zipCode>shippingZipCode</zipCode><city>shippingCity</city><country>Netherlands</country><countryCode>NL</countryCode></address>" "http://www.peecho.com/rest/order/details"

Response

If all went well this service only response with the string 'OK'.

POST /rest/order/set_paid

Purpose

Mark an order as PAID. This is useful for Peecho customers who handle the customer payment themselves.

Request

Parameter Required Explanation
externalOrderId yes Unique external string identifying the order
merchantApiKey yes Unique string identifier of the merchant
secret yes Base64 encoded HMAC SHA1 Hash of merchantApiKey + externalOrderId using your merchantSecretKey as HMAC-key

Curl command

curl -v -d "externalOrderId={yourExternalOrderId}&merchantApiKey={yourMerchantApiKey}&secret={generatedSecretHash}" "http://www.peecho.com/rest/order/set_paid"

Java example

String secretKey = "merchantSecretKey";
String merchantApiKey = "merchantApiKey";
String externalOrderId = "1234";
String data = merchantApiKey + externalOrderId;
Mac m = Mac.getInstance("HmacSHA1");
m.init(new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA1"));
byte[] hash = m.doFinal(data.getBytes("UTF-8"));
String secret = new String(Base64.encodeBase64(hash));

/*
You get as result: LmzDnZGhdSI3D3aWXrQNcY0GDqI=

(using org.apache.commons.codec.binary for base64 and javax.crypto for Mac).
*/

Response

This service either returns 'ERROR' or 'OK'.

POST /rest/order/set_source_url

Purpose

Set the source URL of an order - only applicable for asynchronous source generation.

Request

Parameter Required Explanation
orderId yes The Peecho order id
sourceUrl yes The full public URL of the source document
merchantApiKey yes Your merchant public API key
secret yes Base64 encoded HMAC SHA1 Hash of externalOrderId + merchantReference + sourceUrl using your merchantSecretKey as HMAC-key. The merchantReference is a specified as a button-variable called 'data-reference' or specified in the order creation API call

Curl command

curl -v -d "orderId={yourExternalOrderId}&sourceUrl=https://dl.dropboxusercontent.com/u/5278037/mediamarkt.pdf&merchantApiKey={yourMerchantApiKey}&secret={generatedSecretHash}" "http://www.peecho.com/rest/order/set_source_url"

Java example

String secretKey = "merchantSecretKey";
String externalOrderId = "1234";
String merchantReference = "merchantReference";
String sourceUrl = "http://somesourceurl.com/a.pdf"
String data = externalOrderId + merchantReference + sourceUrl;
Mac m = Mac.getInstance("HmacSHA1");
m.init(new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA1"));
byte[] hash = m.doFinal(data.getBytes("UTF-8"));
String secret = new String(Base64.encodeBase64(hash));

/*
You get as result: MjavkJnEj5SrkHYWtO65KDWEw3M=

(using org.apache.commons.codec.binary for base64 and javax.crypto for Mac).
*/

Response

This service either returns 'OK' or an error status.

GET /rest/order/state

Purpose

Display the current order state.

Request

Parameter Required Explanation
paymentReference yes Globally unique identifier specified in the order creation API call
merchantApiKey yes Unique string Identifier of the merchant

Curl command

curl -v "http://www.peecho.com/rest/order/state?paymentReference={yourPaymentReference}&merchantApiKey={yourMerchantApiKey}"

Response

<?xml version="1.0"?>
<orderState>
  <externalOrderId>4194</externalOrderId>
  <paymentReference>payment reference</paymentReference>
  <merchantReference>some reference</merchantReference>
  <orderState>MODERATION</orderState>
  <price>0.00</price>
  <priceRetail>1.00</priceRetail>
  <priceWholesale>1.00</priceWholesale>
  <shippingRetail>0.00</shippingRetail>
  <shippingWholesale>0.00</shippingWholesale>
  <vat>0.00</vat>
  <created>2011-09-27T14:25:54.000+02:00</created>
  <quantity>1</quantity>
  <title>title</title>
  <shipping>
    <firstName>John</firstName>
    <lastName>Doe</lastName>
    <street>42 first street</street>
    <zipCode>11111</zipCode>
    <city>New York</city>
    <state>NY</state>
    <countryCode>US</countryCode>
    <country>United States</country>
  </shipping>
  <history>
    <historyEntry>
      <entryDate>2013-04-24T12:53:13.000+02:00</entryDate>
      <why>set_paid rest api call</why>
      <state>PAID</state>
    </historyEntry>
    <historyEntry>
      <entryDate>2013-04-24T13:06:46.000+02:00</entryDate>
      <state>MODERATION</state>
    </historyEntry>
  </history>
</orderState>	
				
contact@peecho.com
Peecho New York (USA)
+1 (212) 681 2574
Peecho Amsterdam (NL)
+31 (0)6 4000 4007

Peecho representative USA

228 East 45th Street, 9th floor
New York, NY 10017
United States of America

Peter Arensman, VP of business development
+1 (212) 681 2574
usa@peecho.com

Peecho HQ

Rokin 75-5
1012 KL, Amsterdam
The Netherlands

Martijn Groot, Chief Executive Officer
+31 (0)6 4000 4007
martijn@peecho.com