Skip to content

Media

Templates use media objects (e.g. a JPG or PNG file) to display images (e.g. the background image or a default image in a picture layer). You can use the API to upload these images and reference them when creating and updating templates.

Please take into account the best practices when implementing this API call.

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 to printlane.com.
  • header X-Colorlab-Shop has changed to X-Printlane-Store (notice the change from Shop to Store)
  • header X-Colorlab-Api-Key has changed to X-Printlane-Api-Key
  • header X-Colorlab-Api-Signature has changed to X-Printlane-Api-Signature
  • Please find the overview of all URL changes below:
    New URLOld URL
    https://api.printlane.com/2023-10/media/upload/:mediaTypehttps://api.colorlab.io/2022-08/media/upload/:mediaType

Version 2022-08

  • You can now use api version 2022-08
  • There are no other changes to the implementation of the media endpoints

Version v1 (deprecrated)

Initial API version. Will be deprecated in August 2023. Please update your implementation to point to the latest API version.

Create a media object

To create a media object, use the POST http method to send a JSON payload to the following endpoint:

POST https://api.printlane.com/2023-10/media/upload/:mediaType

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.

The endpoint requires a parameter mediaType which indicates where the media object will be used. Allowed values are:

  • template: for template background images
  • picture: for default values of picture layers

This parameter is used to indicate where the media object will be used.

The endpoint accepts a multipart/form-data body that accepts following keys:

  • file: the file object
  • Content-Type: the content type of the file

Example response payload

json
{
  "_id": "media-id-here",
  "meta": {
    "width": 1000, 
    "height": 1000
  },
  "mimetype": "image/jpeg",
  "name": "media-id-here",
  "originalname": "my-image.jpg",
  "size": 12345,
  "token": "38fa8a54-11ca-4ead-81fc-6cde515442d8"
}

The _id property can be used to reference media objects when creating and updating templates.