The Printfection API is organized around REST to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors.
It uses built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients. JSON is returned in all responses from the API, including errors, and is expected as the body for all requests.
If you want to test our API without needing to set anything up, you can do it from our OpenAPI SwaggerUI version.
YYYY-MM-DDTHH:MM:SSZ
limit
and offset
query parameters. For example: GET /orders?offset=100&limit=50
https://api.printfection.com/v2/
Version: 2.0.3
Codename: We Have The Technology
You authenticate to the Printfection API by providing your API key in every request. You can manage your API keys from your account. You can have multiple API keys active at one time. Your API keys carry many privileges, so be sure to keep them secret!
Authentication to the API occurs via HTTP Basic Auth. Provide your API key as the basic auth username. You do not need to provide a password.
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. You must authenticate for all requests.
# Example Request
curl https://api.printfection.com/v2/campaigns -u <api_key>:
// Example Object
{
"id": 1,
"object": "item",
"name": "My Awesome T-Shirt",
"color": "Green",
"product": {
"id": 123,
"name": "American Apparel 50/50 T-Shirt"
},
"created_at": "2014-09-12T10:22:37Z",
"campaigns": [],
"sizes": [],
"stock": {},
"assets": []
}
Retrieves the details of an item in your account. Supply the unique item ID.
GET /items/:id
Returns an item object if a valid identifier was provided, and returns an error otherwise.
// Example Response
{
"id": 1,
"object": "item",
"name": "My Awesome T-Shirt",
"color": "Green",
"product": {
"id": 123,
"name": "American Apparel 50/50 T-Shirt"
},
"created_at": "2014-09-12T10:22:37Z",
"campaigns": [],
"sizes": [],
"stock": {},
"assets": []
}
Lists all items in your account.
GET /items
Returns an array of item objects, sorted by the date they were created.
// Example Response
[
{
"id": 1,
"object": "item",
"name": "My Awesome T-Shirt",
"color": "Green",
"product": {
"id": 123,
"name": "American Apparel 50/50 T-Shirt"
},
"created_at": "2014-09-12T10:22:37Z",
"campaigns": [],
"sizes": [],
"assets": []
},
{
"id": 2,
"object": "item",
"name": "Amazing Water Bottle",
"color": "Clear",
"product": {
"id": 124,
"name": "32oz Nalgene Water Bottle"
},
"created_at": "2014-09-12T10:22:37Z",
"campaigns": [],
"sizes": [],
"stock": {},
"assets": []
}
]
// Example Object
{
"id": 1,
"object": "size",
"name": "Medium",
"short_name": "M",
"stock": {}
}
// Example Object
{
"available": 10,
}
// Example Object
{
"id": 1,
"object": "asset",
"type": "display",
"name": "AA-WhiteLogo-Front.png",
"perspective": "front",
"url": "https://img.printfection.com/18/26/234234lkajsdfdsf7/AA-WhiteLogo-Front.png",
"notes": ""
}
// Example Object
{
"id": 1,
"object": "order",
"status": "open",
"code": "fkzmzzrrn",
"url": "https://get.printfection.com/customstring/4529475587/fkzmzzrrn",
"gift": false,
"gift_message": "",
"created_at": "2014-09-12T10:22:37Z",
"external_id": "",
"campaign": {
"id": 2,
"object": "campaign",
"type": "purchase",
"name": "The Best Purchase Campaign Ever",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
},
"ship_to": {
"name": "Joseph Schmo",
"address": "123 Main Street",
"address2": "Suite 101",
"company": "ACME Inc.",
"city": "Denver",
"state": "Colorado",
"zip": "80202",
"country": "United States",
"email": "joseph.schmo@example.com",
"phone": "751-166-2910"
},
"lineitems": [],
"manifest": {
"lineitems": [],
"subtotal": 0,
"tax": 0,
"shipping": 0,
"fulfillment": 0,
"total": 0,
"shipments": [
{
"carrier": "UPS",
"method": "UPS Ground",
"tracking_numbers": [
"1ZA826E90376588070"
],
"created_at": "2014-09-13T12:21:37Z"
}
],
"created_at": "2014-09-12T10:22:37Z",
"received_at": null,
"approved_at": null,
"processed_at": null,
"shipped_at": null,
"completed_at": null
}
}
Retrieves the details of an order in your account. Supply the unique order ID.
GET /orders/:id
Returns an order object if a valid identifier was provided, and returns an error otherwise.
// Example Response
{
"id": 1,
"object": "order",
"status": "open",
"code": "fkzmzzrrn",
"url": "https://get.printfection.com/customstring/4529475587/fkzmzzrrn",
"gift": false,
"gift_message": "",
"created_at": "2014-09-12T10:22:37Z",
"external_id": "",
"campaign": {
"id": 2,
"object": "campaign",
"type": "purchase",
"name": "The Best Purchase Campaign Ever",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
},
"ship_to": {
"name": "Joseph Schmo",
"address": "123 Main Street",
"address2": "Suite 101",
"company": "ACME Inc.",
"city": "Denver",
"state": "Colorado",
"zip": "80202",
"country": "United States",
"email": "joseph.schmo@example.com",
"phone": "751-166-2910"
}
"lineitems": []
}
Lists all orders in your account.
GET /orders
GET /orders?campaign_id=1
campaign_id
.
Returns an array of order objects, sorted by the date they were created.
// Example Response
[
{
"id": 1,
"object": "order",
"status": "open",
"code": "fkzmzzrrn",
"url": "https://get.printfection.com/customstring/4529475587/fkzmzzrrn",
"gift": false,
"gift_message": "",
"created_at": "2014-09-12T10:22:37Z",
"external_id": "",
"campaign": {
"id": 1,
"object": "campaign",
"type": "giveaway",
"name": "My Awesome Giveaway Campaign",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
},
"ship_to": {
"name": "Joseph Schmo",
"address": "123 Main Street",
"address2": "Suite 101",
"company": "ACME Inc.",
"city": "Denver",
"state": "Colorado",
"zip": "80202",
"country": "United States",
"email": "joseph.schmo@example.com",
"phone": "751-166-2910"
}
"lineitems": []
},
{
"id": 2,
"object": "order",
"status": "open",
"code": "zx1la90",
"url": "https://printfection.com/zx1la90",
"gift": false,
"gift_message": "",
"created_at": "2014-09-12T10:22:37Z",
"external_id": "",
"campaign": {
"id": 2,
"object": "campaign",
"type": "purchase",
"name": "The Best Purchase Campaign Ever",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
},
"ship_to": {
"name": "Frank Underwood",
"address": "1600 Pennsylvania Avenue NW",
"address2": "",
"company": "ACME Inc.",
"city": "Washington",
"state": "DC",
"zip": "20500",
"country": "United States",
"email": "frank.underwood@us.gov",
"phone": "751-166-2910"
}
"lineitems": []
}
]
To create a new order, supply the unique ID of the campaign (campaign_id
) that the order should be placed in.
For orders to be approved with Printfection they must have ship_to
and lineitems
information. The user may input this information themselves (Giveaway campaign) or you may submit it in your request (Collection campaign). It is not required that you add ship_to
and lineitems
in your POST.
POST /orders
{
"campaign_id": 1,
"external_id": "0035A00003nJleEQAS",
"ship_to": {
"name": "Joseph Schmo",
"address": "123 Main Street",
"address2": "Suite 101",
"company": "ACME Inc.",
"city": "Denver",
"state": "Colorado",
"zip": "80202",
"country": "United States",
"email": "joseph.schmo@example.com",
"phone": "751-166-2910"
},
"lineitems": [
{
"item_id": 1,
"size_id": 2,
"quantity": 3
}
]
}
a-zA-Z0-9-_.?!@#$%*();:,+
Returns the new order object if valid information was provided, and returns an error otherwise.
// Example Response
{
"id": 1,
"object": "order",
"status": "open",
"code": "fkzmzzrrn",
"url": "https://get.printfection.com/customstring/4529475587/fkzmzzrrn",
"gift": false,
"gift_message": "",
"created_at": "2014-09-12T10:22:37Z",
"external_id": "",
"campaign": {
"id": 2,
"object": "campaign",
"type": "purchase",
"name": "The Best Purchase Campaign Ever",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
},
"ship_to": {
"name": "Joseph Schmo",
"address": "123 Main Street",
"address2": "Suite 101",
"company": "ACME Inc.",
"city": "Denver",
"state": "Colorado",
"zip": "80202",
"country": "United States",
"email": "joseph.schmo@example.com",
"phone": "751-166-2910"
},
"lineitems": [
{
"id": 123,
"object": "lineitem",
"order_id": 1,
"item_id": 1,
"size_id": 2,
"quantity": 3,
"created_at": "2014-09-12T10:22:37Z"
}
]
}
To update an existing order, supply the unique ID of the order and the information to be updated.
Note that some information about an order cannot be updated, such as its campaign_id
value. Additionally, once an order has been placed, it can no longer be updated.
PATCH /orders/:id
{
"ship_to": {
"name": "Sally Schmo",
}
}
Returns the updated order object if valid information was provided, and returns an error otherwise.
// Example Response
{
"id": 1,
"object": "order",
"status": "open",
"code": "fkzmzzrrn",
"url": "https://get.printfection.com/customstring/4529475587/fkzmzzrrn",
"gift": false,
"gift_message": "",
"created_at": "2014-09-12T10:22:37Z",
"external_id": "",
"campaign": {
"id": 2,
"object": "campaign",
"type": "purchase",
"name": "The Best Purchase Campaign Ever",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
},
"ship_to": {
"name": "Sally Schmo",
"address": "123 Main Street",
"address2": "Suite 101",
"company": "ACME Inc.",
"city": "Denver",
"state": "Colorado",
"zip": "80202",
"country": "United States",
"email": "sally.schmo@example.com",
"phone": "751-166-2910"
},
"lineitems": [
{
"id": 123,
"object": "lineitem",
"order_id": 1,
"item_id": 1,
"size_id": 2,
"quantity": 3,
"created_at": "2014-09-12T10:22:37Z"
},
{
"id": 124,
"object": "lineitem",
"order_id": 1,
"item_id": 2,
"size_id": 3,
"quantity": 5,
"created_at": "2014-09-12T10:20:33Z"
}
]
}
To cancel an existing order, supply the unique ID of the order.
Note that once an order has been placed, it can no longer be cancelled.
DELETE /orders/:id
Returns the cancelled order object if the order was cancelled, and returns an error otherwise.
// Example Response
{
"id": 1,
"object": "order",
"status": "cancelled",
"code": "fkzmzzrrn",
"url": "https://get.printfection.com/customstring/4529475587/fkzmzzrrn",
"gift": false,
"gift_message": "",
"created_at": "2014-09-12T10:22:37Z",
"external_id": "",
"campaign": {
"id": 2,
"object": "campaign",
"type": "purchase",
"name": "The Best Purchase Campaign Ever",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
},
"ship_to": {
"name": "Sally Schmo",
"address": "123 Main Street",
"address2": "Suite 101",
"company": "ACME Inc.",
"city": "Denver",
"state": "Colorado",
"zip": "80202",
"country": "United States",
"email": "sally.schmo@example.com",
"phone": "751-166-2910"
},
"lineitems": [
{
"id": 123,
"object": "lineitem",
"order_id": 1,
"item_id": 1,
"size_id": 2,
"quantity": 3,
"created_at": "2014-09-12T10:22:37Z"
},
{
"id": 124,
"object": "lineitem",
"order_id": 1,
"item_id": 2,
"size_id": 3,
"quantity": 5,
"created_at": "2014-09-12T10:20:33Z"
}
]
}
// Example Object
{
"id": 123,
"object": "lineitem",
"order_id": 1,
"item_id": 1,
"size_id": 2,
"quantity": 3,
"created_at": "2014-09-12T10:22:37Z"
}
Retrieves the details of a lineitem. Supply the unique lineitem ID.
GET /orders/:order_id/lineitems/:id
Returns an lineitem object if a valid identifier was provided, and returns an error otherwise.
// Example Response
{
"id": 123,
"object": "lineitem",
"order_id": 1,
"item_id": 1,
"size_id": 2,
"quantity": 3,
"created_at": "2014-09-12T10:22:37Z"
}
To add a new lineitem to an existing order, supply the unique IDs of the order, item, size, and a quantity.
POST /orders/:order_id/lineitems
{
"item_id": 3,
"size_id": 4,
"quantity": 1
}
Returns the new lineitem object if valid information was provided, and returns an error otherwise.
// Example Response
{
"id": 125,
"object": "lineitem",
"order_id": 1,
"item_id": 3,
"size_id": 4,
"quantity": 1,
"created_at": "2014-09-12T10:22:37Z"
}
To update an existing lineitem, supply the unique ID of the lineitem.
Note that the order_id
of an existing lineitem cannot be changed.
PATCH /order/:order_id/lineitems/:id
{
"quantity": 2
}
Returns the updated lineitem object if valid information was provided, and returns an error otherwise.
// Example Response
{
"id": 125,
"object": "lineitem",
"order_id": 1,
"item_id": 3,
"size_id": 4,
"quantity": 2,
"created_at": "2014-09-12T10:22:37Z"
}
To delete an existing lineitem, supply the unique ID of the lineitem.
Note that a lineitem cannot be updated once its order has been placed.
DELETE /orders/:order_id/lineitems/:id
Returns the deleted lineitem object if it was deleted, and returns an error otherwise.
// Example Response
{
"id": 125,
"object": "lineitem",
"order_id": 1,
"item_id": 3,
"size_id": 4,
"quantity": 2,
"created_at": "2014-09-12T10:22:37Z"
}
// Example Object
{
"id": 1,
"object": "campaign",
"type": "giveaway",
"name": "My Awesome Giveaway Campaign",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z",
"giveaway_links": [
{
"status": "Redeemed",
"link": "https://get.printfection.com/xqbxg/5592122409/rykcffgxkw"
},
{
"status": "Unused",
"link": "https://get.printfection.com/xqbxg/5592122409/czqfdrqmns"
}
}
Retrieves the details of a campaign in your account. Supply the unique campaign ID.
GET /campaigns/:id
Returns a campaign object if a valid identifier was provided, and returns an error otherwise.
// Example Response
{
"id": 1,
"object": "campaign",
"type": "giveaway",
"name": "My Awesome Giveaway Campaign",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
}
Lists all campaigns in your account, sorted by the date they were created.
GET /campaigns
Returns an array of campaign objects, sorted by the date they were created.
// Example Response
[
{
"id": 1,
"object": "campaign",
"type": "giveaway",
"name": "My Awesome Giveaway Campaign",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
},
{
"id": 2,
"object": "campaign",
"type": "purchase",
"name": "The Best Purchase Campaign Ever",
"active": true,
"archived": false,
"url": "https://get.printfection.com/customstring/6651657281",
"created_at": "2014-09-12T10:22:37Z"
}
]
The Printfection API uses conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the provided information (e.g. a required parameter was missing, placing an order failed, etc.), and codes in the 5xx range indicate an error with Printfection's servers.
// Example Object
{
"object": "error",
"code": 99,
"message": "Something went wrong."
}