SmakeSmake API Docs
EndpointsVariants

Design a variant

POST
/variants/{id}/design

Designing a product variant is made possible by placing customizations on the corresponding view (e. g. front or back). Send the design as described in the request body below.

Background processing

When you design a product variant, this happens asynchronously. You can use Polling or Webhooks for status updates. A new product variant is created implicitly. Therefore, you will already receive the new product variant id in the header for later reference.

The current state of the asynchronous process is represented due the following states:

StateMeaning
draftThe initial state of a new variant
checkingVariant is processed automatically in background. For example images will be generated or downloaded.
failedSomething went wrong during the checking process. The reason can be found in the failure_message attribute. For example an image could not be downloaded.
completedAll automatic processes were successful. The variant is ready to use.

It is not possible to order this product variant before state completed.

Response

The response is 202 Accepted with the headers Location (e.g. https://api.smake.io/jobs/1) and X-Identifier (e.g. 137). The X-Identifier is the new generated product variant id for later reference.

Further design examples

You can combine the usage of id and url on different models — see the request examples Design with media id, Design with logo id, Design with logo id and resize logo, Design with media id and mockup with url and Adopt design from another variant.

AuthorizationbearerAuth

Authorization

bearerAuth
AuthorizationBearer <token>

API token as bearer token — you receive a test and a live token, there is no switch between them. See Setup → Authentication and Setup → Test mode.

In: header

Path Parameters

id*integer

The ID of the resource.

Header Parameters

Accept*"application/json"

The API only responds with JSON — this header is mandatory on every request (see Setup → Headers).

Default"application/json"

Value in

  • "application/json"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Designing a product variant is made possible by placing customizations on the corresponding view (e. g. front or back) — see Design. Send either views with the customizations to place, or adopt_design_from_variant to copy the design of another variant.

Response Body

application/json

application/json

application/json

Request example
curl -X POST "https://example.com/variants/0/design" \  -H "Accept: application/json" \  -H "Content-Type: application/json" \  -d '{    "type": "basic",    "views": [      {        "handle": "front",        "media": [          {            "url": "https://any.link.to/image",            "collection_name": "mockup"          }        ],        "customizations": [          {            "resource_type": "logo",            "width": 200,            "height": 200,            "resource": {              "production_method": {                "handle": "dtg"              },              "media": [                {                  "url": "https://any.link.to/production-file",                  "collection_name": "production-file"                }              ]            }          },          {            "resource_type": "additional-instruction",            "resource": {              "id": 1            }          }        ]      }    ]  }'
Empty