Appearance
Templates
The template endpoints allow you to retrieve, create, update and delete templates in Printlane.
These endpoints help you to automatically synchronize externally managed template data, such as a Product Information Management system or a custom database. This integration eliminates the need without the need to manually create and update templates in Printlane Studio.
Integrating these endpoints in your software or service guarantee that new templates and updates are immediately available in Printlane.
Please take into account the best practices when implementing these API calls.
Changelog
Version 2023-10 (latest)
- You can now use api version
2023-10
- The domain name of all API endpoints has changed from
colorlab.io
toprintlane.com
. - header
X-Colorlab-Shop
has changed toX-Printlane-Store
(notice the change fromShop
toStore
) - header
X-Colorlab-Api-Key
has changed toX-Printlane-Api-Key
- header
X-Colorlab-Api-Signature
has changed toX-Printlane-Api-Signature
- Please find the overview of all URL changes below:
New URL Old URL https://api.printlane.com/2023-10/templates
https://api.colorlab.io/2022-08/templates
https://api.printlane.com/2023-10/templates/:templateId
https://api.colorlab.io/2022-08/templates/:templateId
Version 2022-08
- You can now use api version
2022-08
- all properties of the template object are now required. Empty properties should be sent as an empty string or
null
.
Version v1 (deprecrated)
Initial API version. Will be deprecated in August 2023. Please update your implementation to point to the latest API version.
Retrieving templates
To retrieve a list of templates currently in the store, use the GET
http method to the following endpoint:
GET https://api.printlane.com/2023-10/templates
Verification string for API Signature
The verification string to generate the signature is Store ID
.
Read here how to generate the X-Printlane-Api-Signature
header with this verification string.
Example output
json
{
"count": 2,
"results": [
{
"_id": "62c7ef6cdb61038d8d79b67b",
"name": "Smartphone Case",
"productId": "smartphone-case",
"shopify": null,
"static": false,
"_created": "2022-07-08T08:48:44.384Z",
"_updated": "2022-10-18T09:50:53.434Z",
"template": {
"_id": "62c7ef61fe092a42b5bb83b3",
"token": "6abc2b56-4b85-449c-85a3-3927d273568e"
}
},
{
"_id": "628de8e044954ccab38212d5",
"name": "Business Card",
"productId": "business-card",
"shopify": null,
"static": false,
"_created": "2022-05-25T08:29:20.618Z",
"_updated": "2022-05-25T13:44:47.071Z",
"template": {
"_id": "628de8e044954ccab38212d6",
"token": "41d45422-10a2-40ba-b644-1a867e007aec"
}
},
],
"total": 2
}
To navigate to the next page, use the skip
query parameter:
GET https://api.printlane.com/2023-10/templates?skip=20
Retrieving a template
To retrieve a single template, use the following endpoint:
GET https://api.printlane.com/2023-10/templates/:templateId
And replace :id
with the ID of the template.
Verification string for API Signature
The verification string to generate the signature is Store ID
+ Template ID
.
Read here how to generate the X-Printlane-Api-Signature
header with this verification string.
Creating a template
To create an template, use the POST
http method to send a JSON
payload to the following endpoint:
POST https://api.printlane.com/2023-10/templates
Verification string for API Signature
The verification string to generate the signature is Store ID
.
Read here how to generate the X-Printlane-Api-Signature
header with this verification string.
Example JSON payload
json
{
"name": "Test template",
"productId": "test-template",
"shop": "589adada754c20089ed6cfd8",
"shopify": null,
"static": false,
"synchronization": [],
"views":[
{
"active": true,
"addArtwork": {
"active": false,
"area": null,
"export": true,
"id": "view-front-add-illustration",
"name": {
"en": "Artwork"
},
"order": 2,
"removable": true,
"required": false,
"section": 0,
"selectable": true,
"type": "illustration",
"weight": 2,
"allColors": true,
"allowTransparent": true,
"autoResize": "fit",
"colorize": false,
"colors": [],
"draggable": true,
"groups": [],
"positionX": 600,
"positionY": 1000,
"resizable": true,
"rotatable": true,
"rotation": 0,
"scale": 1,
"scaleArea": null,
"value": null
},
"addPicture": {
"active": false,
"area": null,
"export": true,
"id": "view-front-add-picture",
"name": {
"en": "Picture"
},
"order": 2,
"removable": true,
"required": false,
"section": 0,
"selectable": true,
"type": "picture",
"weight": 2,
"allowedExtensions": [],
"autoResize": "fill",
"colorize": false,
"colorizeToColor": null,
"custom": [],
"draggable": true,
"fx": [],
"positionX": 600,
"positionY": 1000,
"resizable": true,
"rotatable": true,
"rotation": 0,
"scale": 1,
"scaleArea": null,
"value": null
},
"addText": {
"active": false,
"area": null,
"export": true,
"id": "view-front-add-text",
"name": {
"en": "Text"
},
"order": 2,
"readOnly": false,
"removable": true,
"required": false,
"section": 0,
"selectable": true,
"type": "text",
"weight": 2,
"align": "center",
"allColors": true,
"allFonts": true,
"bold": false,
"charSpacing": 0,
"colors": [
{
"name": {
"en": "Black"
},
"color": "#000000",
"default": true
},
{
"name": {
"en": "White"
},
"color": "#ffffff",
"default": false
},
{
"name": {
"en": "Red"
},
"color": "#fe5a49",
"default": false
},
{
"name": {
"en": "Blue"
},
"color": "#40bdff",
"default": false
},
{
"name": {
"en": "Yellow"
},
"color": "#ffe459",
"default": false
},
{
"name": {
"en": "Green"
},
"color": "#2dcc70",
"default": false
}
],
"curveRadius": 0,
"curvable": false,
"defaultFont": "6242d653ab7fe50011fee7f2",
"draggable": true,
"fonts": [],
"fontsize": 225,
"italic": false,
"lineHeight": 1,
"maxCharacters": 0,
"maxFontsize": 450,
"minFontsize": 45,
"multiline": true,
"origin": "cc",
"positionX": 600,
"positionY": 1000,
"resizable": true,
"rotatable": true,
"rotation": 0,
"value": {
"en": "Your text"
}
},
"allowRearrangeElements": true,
"areas": [
{
"height": 500,
"id": "area-1",
"name": "Area 1",
"width": 500,
"x": 0,
"y": 0
}
],
"cutOutMask": null,
"elements": [
{
"active": false,
"area": null,
"export": true,
"id": "picture",
"name": {
"en": "Picture"
},
"order": 1,
"removable": true,
"required": false,
"section": 0,
"selectable": true,
"type": "picture",
"weight": 0,
"allowedExtensions": [],
"autoResize": "fill",
"colorize": false,
"colorizeToColor": null,
"custom": [],
"draggable": true,
"fx": [],
"positionX": 600,
"positionY": 1000,
"resizable": true,
"rotatable": true,
"rotation": 0,
"scale": 1,
"scaleArea": null,
"value": null
},
{
"active": true,
"area": null,
"export": true,
"id": "text",
"name": {
"en": "Text"
},
"order": 0,
"readOnly": false,
"removable": true,
"required": false,
"section": 0,
"selectable": true,
"type": "text",
"weight": 1,
"align": "center",
"allColors": true,
"allFonts": true,
"bold": false,
"charSpacing": 0,
"colors": [
{
"name": {
"en":"Black"
},
"color": "#000000",
"default": false
},
{
"name": {
"en":"White"
},
"color": "#ffffff",
"default": true
},
{
"name": {
"en": "Red"
},
"color": "#fe5a49",
"default": false
},
{
"name": {
"en":"Blue"
},
"color": "#40bdff",
"default": false
},
{
"name": {
"en": "Yellow"
},
"color": "#ffe459",
"default": false
},
{
"name":{
"en": "Green"
},
"color": "#2dcc70",
"default": false
}
],
"curveRadius": 0,
"curvable": false,
"defaultFont": "6242d653ab7fe50011fee7f2",
"draggable": true,
"fonts": [],
"fontsize": 225,
"italic": false,
"lineHeight": 1,
"maxCharacters": 0,
"maxFontsize": 450,
"minFontsize": 45,
"multiline": true,
"origin": "cc",
"positionX": 600,
"positionY": 1000,
"resizable": true,
"rotatable": true,
"rotation": 0,
"value": {
"en": "Your text"
}
}
],
"export": {
"area": null,
"areaType": "template",
"custom": [],
"dpi": 300,
"exportTemplate": true,
"exportCutOutMask": true,
"filename": "[id]-[title]",
"height": 0,
"mergeDimensions": null,
"mergeInFile": null,
"mergePosition": null,
"type": "pdf",
"width": 0,
"x": 0,
"y": 0
},
"groupElements": false,
"height": 2000,
"id": "front",
"name": {
"en": "Front"
},
"required": false,
"template": "634e8c3a648cbd13c26b338a",
"weight": 0,
"width": 1200
}
]
}
Template properties
Property | Description |
---|---|
name | Name of the template which will be displayed in Printlane Studio. |
productId | Your reference to the template. This will be used to update the template later on. Must be unique per store. |
shop | Your Store ID. |
shopify | Contains links to Shopify products, leave null . |
static | Unsupported API property. Keep value false . |
synchronization | Unsupported API property. Keep value [] . |
views | Array of views in the template (e.g. Front and Back ). See View properties for each object in this array. |
View properties
Property | Description |
---|---|
active | Defines which view will be active by default in the designer. Only 1 view in the array of views can be active. |
addArtwork | Contains the same properties as the artwork layer properties. Allows the user to add his own artwork layer based on the defaults in this property |
addPicture | Contains the same properties as the picture layer properties. Allows the user to add his own picture layer based on the defaults in this property |
addText | Contains the same properties as the text layer properties. Allows the user to add his own text layers based on the defaults in this property |
allowRearrangeElements | Allow the user to rearrange layers in a layer modal |
areas | See view areas properties below. |
cutOutMask | Unsupported API property. Keep value null . |
elements | Array of layers to be displayed in the designer for this view. See Layer properties for each object in this array. |
export | See view export properties below. |
groupElements | Boolean, indicates if tabs in the designer should be grouped by type |
height | The height of the template in pixels |
id | A string representing a unique ID for this view. You can use this ID later toa access the view, e.g. to export a specific view from the designs created from this template. |
name | An object with the name of the view which will be displayed in the designer. Provide a translation for each language activated in your account. |
required | Boolean to indicate if a view is required. Marking a view as required will require the end-user to open the view in the designer before it's possible to add the design to the cart. |
template | The ID of the media object to display in the designer (see Uploading media) |
weight | The order of the views as displayed in the designer. Ascending number, starting from 0 . The lowest number will be displayed first. |
width | The width of the template in pixels |
View export properties
Property | Description |
---|---|
area | This property is required when areaType is area . A valid area id must be given here. |
areaType | Defines the export dimensions type. Could be template , custom or area . |
custom | Unsupported API property. Keep value [] . |
dpi | The export dpi. |
exportTemplate | Boolean defining if the export should contain the template. |
exportCutOutMask | Unsupported API property. Keep value null . |
filename | Default filename is [id]-[title] . You can use following tokens: [id] design id, [date] date in yyyy-mm-dd format, [title] configuration name, [product] template id` |
height | Required when areaType is custom . Defines the export height. |
mergeDimensions | Unsupported API property. Keep value null . |
mergeInFile | Unsupported API property. Keep value null . |
mergePosition | Unsupported API property. Keep value null . |
type | Could be pdf , png or pdf-simple (PNG-based PDF). |
width | Required when areaType is custom . Defines the export width. |
x | Required when areaType is custom . Defines the export x position. |
y | Required when areaType is custom . Defines the export y position. |
View areas properties
Property | Description |
---|---|
height | Area height in pixels. |
id | Unique id for this area. |
name | The human readable name for this area. |
width | Area width. |
x | X position of the area. |
y | Y position of the area. |
Layer properties
Property | Description |
---|---|
active | Defines which layer will be active by default in the view. Only 1 layer in the array of layers can be active. |
area | Define the area this layer is visible in. Only a valid area id from the areas property is allowed. |
export | Defines if the layer should be included in design exports. |
id | Your unique ID for this layer. This can be used to access the layer later. |
name | An object with the name of the layer which will be displayed in the designer. Provide a translation for each language activated in your account. |
removable | Allows the user to delete this pre-defined layer. |
required | Marks a layer required, which will trigger a message in the designer if the end user doesn't have a value selected for this layer. |
section | Determines where the layer is rendered. -1 = footer, 0 = body, 1 = header. |
selectable | Defines if the user is able to edit this layer. |
type | Defines the layer type. This can be text , picture , illustration or background . |
weight | The order of the layers as displayed in the designer. Ascending number, starting from 0 . The lowest number will be displayed below all other layers, just like layers in Photoshop. |
Layer (text) properties
Property | Description |
---|---|
align | Default alignment of the text if multiple lines are used (left , center (default) or right ) |
allColors | Allows the user to add and use all colors. |
bold | Boolean indicating if the bold version of the font should be used. |
colors | An array of the colors displayed in the designer. Each color is defined as an object containing a name (object with translations for each language in your account), default (one color can be the default in the array) and the color (a hex string defining the color to be used). |
draggable | Allows the user to change the position of the layer. |
italic | Boolean indicating if the italic version of the font should be used. When combined with bold , the boldItalic version of the font is used |
maxCharacters | Defines the maximum amount of characters that can be entered. Set to 0 to allow unlimited characters. |
maxFontsize | The maximum font size of the text. |
minFontsize | The minimum font size of the text. |
multiline | Allow the user to enter multiple lines |
resizable | Allows the user to change the size of the layer. |
rotatable | Allows the user to rotate the layer. |
positionX | The horizontal position of the text in pixels. Calculated from the top left corner of the view. |
positionY | The vertical position of the text in pixels. Calculated from the top left corner of the view. |
rotation | The initial rotation of the layer (0 - 360). |
value | An object with the default text value which will initially be displayed in the designer. Provide a translation for each language activated in your account. |
Layer (picture) properties
Property | Description |
---|---|
autoResize | Resize options how the picture should behave inside an area. Allowed values are none , fill and fit |
draggable | Allows the user to change the position of the layer. |
positionX | The horizontal position of the picture in pixels. Calculated from the top left corner of the view. |
positionY | The vertical position of the picture in pixels. Calculated from the top left corner of the view. |
resizable | Allows the user to change the size of the layer. |
rotatable | Allows the user to rotate the |
. | |
rotation | The initial rotation of the |
(0 - 360). | |
scale | The initial scale of the picture (if a value is set) |
scaleArea | Define the area this |
is scaled to. Only a valid area from the areas property is allowed. | |
value | The ID of the Media object which is used as default value when opening the designer (see Uploading media). |
Layer (illustration) properties
Property | Description |
---|---|
autoResize | Resize options how the picture should behave inside an area. Allowed values are none , fill and fit |
draggable | Allows the user to change the position of the layer. |
positionX | The horizontal position of the picture in pixels. Calculated from the top left corner of the view. |
positionY | The vertical position of the picture in pixels. Calculated from the top left corner of the view. |
resizable | Allows the user to change the size of the layer. |
rotatable | Allows the user to rotate the layer. |
rotation | The initial rotation of the layer (0 - 360). |
scale | The initial scale of the picture (if a value is set) |
scaleArea | Define the area this layer is scaled to. Only a valid area from the areas property is allowed. |
value | The ID of the Media object which is used as default value when opening the designer. |
Layer (background) properties
Property | Description |
---|---|
allColors | Allows the user to add and use all colors. |
allowTransparant | Allows the user to select no color (transparent). |
colors | An array of the colors displayed in the app. Each color is defined as an object containing a name (object with translations for each language in your account), default (one color can be the default in the array) and the color (a hex string defining the color to be used). |
Updating a template
To update a template, use the following endpoint:
POST https://api.printlane.com/2023-10/templates/:templateId
Verification string for API Signature
The verification string to generate the signature is Store ID
+ Template ID
.
Read here how to generate the X-Printlane-Api-Signature
header with this verification string.
And replace :id
with the productId
property that was used used when creating the template. The endpoint uses the exact same JSON
payload as the create
endpoint.
Deleting a template
To delete a template, use the following endpoint:
DELETE https://api.printlane.com/2023-10/templates/:templateId
Verification string for API Signature
The verification string to generate the signature is Store ID
+ Template ID
.
Read here how to generate the X-Printlane-Api-Signature
header with this verification string.
Deleting a template does not delete designs
Created designs based on this template won't be deleted. Referenced media documents are deleted automatically.