latestOpenAPI 3.0.02026-08-105585620.8 KB

18e2f2e178dd

Mockup Generator API

Create a mockup generation task

Creates an asynchronous mockup generation task. Generation result can be retrieved using mockup generation task retrieval endpoint.<br> Rate limiting: Up to 10 requests per 60 seconds for established stores; 2 requests per 60 seconds for new stores. Currently available rate is returned in response headers. A 60 seconds lockout is applied if request count is exceeded. We also limit the number of files that may be generated to 20,000 files per account in a 24-hour period.

post/mockup-generator/create-task/{id}

Path parameters

idinteger required

Product ID.

Headers

X-PF-Store-Idstring

Use this to specify which store you want to use (required only for account level token).

The store IDs can be retrieved with the Get basic information about stores endpoint.

Request body

variant_idsinteger[]

List of variant ids you want to generate.

format'jpg' | 'png'

Generated file format. PNG will have a transparent background, JPG will have a smaller file size.

widthinteger

Width of the resulting mockup images (min 50, max 2000, default is 1000)

product_optionsobject

Key-value list of product options (embroidery thread, stitch colors). Product options can be found in Catalog API endpoint. See examples

option_groupsstring[]

List of option group names you want to generate. Product's option groups can be found in printfile API request.

optionsstring[]

List of option names you want to generate. Product's options can be found in printfile API request.

product_template_idinteger

Product template ID. Use instead of files parameter.

Example request

{
  "variant_ids": [
    4012,
    4013,
    4014,
    4017,
    4018,
    4019
  ],
  "format": "jpg",
  "files": [
    {
      "placement": "front",
      "image_url": "​http://your-site/path-to-front-printfile.jpg",
      "position": {
        "area_width": 1800,
        "area_height": 2400,
        "width": 1800,
        "height": 1800,
        "top": 300
      },
      "options": [
        {
          "id": "template_type",
          "value": "native"
        }
      ]
    }
  ],
  "product_template_id": 123
}

Response

OK

codeinteger

Response status code 200

Example response

{
  "code": 200,
  "result": {
    "task_key": "123456",
    "status": "completed",
    "mockups": [
      {
        "placement": "front",
        "display_name": "Front Print",
        "variant_ids": [
          4011,
          4012,
          4013
        ],
        "extra": [
          {
            "url": "​https://url-to/extra-mockup.png"
          }
        ]
      }
    ],
    "printfiles": [
      {
        "variant_ids": [
          4012,
          4013,
          4014,
          4017,
          4018,
          4019
        ],
        "placement": "front",
        "url": "​https://url-to/printfile.png"
      }
    ]
  }
}