Customizations

The customization endpoints allow you to get and export customizations created by end-users.

These endpoints are available to retrieve customization details such as texts the end-user entered in your external software, or to export files needed in your print production workflow.

Please take into account the best practices when implementing these API calls.

How customizations are referenced

When your application or online store retrieves an order which contains one or more customizations, every customization consists of a unique reference, e.g.:

1
45.3618204e-f166-4a53-8a7f-0ce2828b17ca

This reference breaks down in two parts, separated by a point (.):

The id and token are necessary to access the customization endpoints.

Exporting print production files

Endpoint

Use following endpoint to retrieve customization exports:

1
https://api.colorlab.io/v1/configuration/:id/:token/export

Replace :id and :token with the ID and Token of the customization. If the customization contains multiple views (e.g. front and back), you can export a specific view by referencing it in the endpoint:

1
https://api.colorlab.io/v1/configuration/:id/:token/view/:viewId/export

Replace :viewId with the internal ID of the view defined in the template.

The response of this endpoint has a Content-Disposition header equal to attachment and sends the raw data of the export to the client.

Generating the signature

Create a verification string containing this data:
shop_id + customization_id + configuration_token

If you exporting a specific view, please add the :viewId to the verification string:
shop_id + customization_id + configuration_token + viewId

Now use your API secret to compute a sha256 HMAC signature. You can test the output using online generators like https://www.freeformatter.com/hmac-generator.html.

Use the resulting value in the X-Colorlab-Api-Signature header when requesting the API.

Retrieving customization details

Endpoint

Use following endpoint to retrieve customization exports:

1
https://api.colorlab.io/v1/configuration/:id/:token

Replace :id and :token with the ID and Token of the customization.

Generating the signature

Create a verification string containing this data:
shop_id + customization_id + configuration_token

Use your API secret to compute a sha256 HMAC signature. You can test the output using online generators like https://www.freeformatter.com/hmac-generator.html.

Use the resulting value in the X-Colorlab-Api-Signature header when requesting the API.

Example response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
{
"_id": "604101950c6c8660681cf90b",
"_created": "2021-03-01T15:49:41.175Z",
"_updated": "2021-03-01T15:53:12.175Z",
"configurationId": 845,
"domain": "mycustomizationwebshop.com",
"name": "iPhone XS case",
"productId": "SKU_456",
"token": "22e53b5a-cfd9-4896-8356-cffac806a5c2",
"url": "https://mycustomizationwebshop.com/collections/iphone/iphone-xs-case",
"views": [
{
"active": true,
"allowRearrangeElements": true,
"areas": [{
"id":"area-1",
"name": "Area 1",
"x": 0,
"y": 0,
"width": 100,
"height": 100
}],
"export": {
"type": "pdf",
"dpi": 300,
"filename": "[id]-[title]",
"areaType": "template",
"area": null,
"exportTemplate": true,
"x": 0,
"y": 0,
"width": 0,
"height": 0
},
"fields": [
{
"active": false,
"area": null,
"allColors": true,
"allowTransparent": true,
"colors": [
{
"color": "#000000",
"default": false,
"name": {
"en": "",
"nl": ""
}
},
{
"color": "#fe5a49",
"default": true,
"name": {
"en": "",
"nl": ""
}
}
],
"export": true,
"id": "background-color",
"name": {
"en": "Background color"
},
"order": 3,
"removable": false,
"required": false,
"section": 0,
"selectable": true,
"type": "background",
"weight": 0
},
{
"active": false,
"align": "center",
"allColors": true,
"allFonts": true,
"area": null,
"bold": false,
"colors": [
{
"color": "#000000",
"default": false,
"name": {
"en": "",
"nl": ""
}
},
{
"color": "#40bdff",
"default": true,
"name": {
"en": "",
"nl": ""
}
}
],
"curvable": false,
"curveRadius": 0,
"defaultFont": {
"_id": "603034647a8d575f5d4c66b7",
"bold": false,
"italic": false,
"name": "Arial",
"image": {
"_id": "603034647a8d575f5d4c66b5",
"meta": {
"width": 260,
"height": 80,
"space": "srgb",
"channels": 4,
"density": 72
},
"originalname": "arial.png",
"mimetype": "image/png",
"reference": "font",
"size": 691,
"token": "4fb81203-1c10-402c-afd5-6d35d853084f"
},
"file-regular": {
"_id": "603034617a8d575f5d4c66b3",
"originalname": "arial-regular.ttf",
"mimetype": "font/ttf",
"reference": "font",
"size": 22572,
"token": "6431b24b-7ef4-413d-a7b2-8739f53dfe4e"
},
"file-bold": null,
"file-italic": null,
"file-bold-italic": null
},
"draggable": true,
"export": true,
"fonts": [],
"fontsize": 150,
"id": "your-text",
"italic": false,
"lineHeight": 1,
"maxCharacters": 0,
"maxFontsize": 150,
"minFontsize": 50,
"multiline": true,
"name": {
"en": "Your text"
},
"order": 0,
"origin": "cc",
"positionX": 800,
"positionY": 800,
"readOnly": false,
"removable": false,
"resizable": true,
"required": false,
"rotatable": true,
"rotation": 0,
"section": 0,
"selectable": true,
"type": "text",
"value": "User entered text",
"weight": 1
},
{
"active": false,
"autoResize": "fill",
"area": null,
"draggable": true,
"export": true,
"id": "picture-1",
"name": {
"en": "Upload your picture"
},
"order": 1,
"positionX": 800,
"positionY": 800,
"removable": false,
"resizable": true,
"required": false,
"rotatable": true,
"rotation": 180,
"selectable": true,
"section": 0,
"scale": 0.65,
"scaleArea": null,
"type": "picture",
"value": {
"_id": "604101280c6c8660681cf8d2",
"meta": {
"channels": 3,
"density": 300,
"height": 3200,
"space": "srgb",
"width": 3200
},
"mimetype": "image/jpeg",
"originalname": "background-image.jpg",
"reference": "upload",
"size": 852805,
"token": "c887ce84-6395-49d3-9f38-c878334f7455"
},
"weight": 2
},
{
"active": true,
"allowTransparent": true,
"allColors": true,
"autoResize": "fit",
"area": null,
"colorize": false,
"colors": [],
"draggable": true,
"export": true,
"groups": [],
"id": "choose-artwork",
"name": {
"en": "Choose artwork"
},
"order": 2,
"positionX": 800,
"positionY": 200,
"removable": false,
"required": false,
"resizable": true,
"rotatable": true,
"rotation": 0,
"section": 0,
"selectable": true,
"scale": 2.55,
"scaleArea": null,
"type": "illustration",
"value": {
"_id": "5ff8216cf0712b8546b7356f",
"file": {
"_id": "5ff8216bf0712b8546b7356d",
"meta": {
"channels": 4,
"density": 72,
"height": 600,
"space": "srgb",
"width": 900
},
"mimetype": "image/svg+xml",
"originalname": "flower.svg",
"reference": "illustration",
"size": 224491,
"token": "7c000ce6-0ffc-4874-bd53-d05a62b6456a"
},
"groups": [],
"name": [
{
"language": "en",
"content": "Flower"
}
]
},
"weight": 3
}
],
"groupElements": false,
"height": 1600,
"id": "front",
"name": {
"en": "Front"
},
"required": false,
"template": {
"_id": "604101040c6c8660681cf8ce",
"meta": {
"channels": 4,
"density": 72,
"height": 1600,
"width": 1600,
"space": "srgb"
},
"mimetype": "image/hoeg",
"originalname": "iphone-xs-front.jpg",
"reference": "template",
"size": 919302,
"token": "4fe6a965-9e32-47d4-80c2-6efb387da97e"
},
"weight": 0,
"width": 1600
}
]
}