SmakeSmake API Docs
EndpointsVariants

Show a variant

GET
/variants/{id}

Returns the product variant with the id = x.

Expanding relationships

You can expand some resources to show more details — see Expanding Objects:

  • /variants/1?expand=product — show the content of the product instead of the id
  • /variants/1?expand=views.customizations.resource — show the content of the customizations' resource
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.

Query Parameters

expand?string

You can expand some resources to show more details — see Expanding Objects. Allowed values:

  • product — You can show the content of the product instead of the id.
  • views.customizations.resource — You can show the content of the customizations' resource. The type is described by the resource_type attribute of the customization.

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"

Response Body

application/json

application/json

application/json

Request example
curl -X GET "https://example.com/variants/0?expand=product" \  -H "Accept: application/json"

GET /variants/1 HTTP/1.1

{  "id": 1,  "state": "completed",  "collection_name": "catalogue",  "total": 97.37,  "price": 91,  "tax": 6.37,  "tax_rate": 7,  "option_values": [    {      "handle": "cadet-blue",      "name": "cadet blue",      "option_type": {        "handle": "color",        "name": "color"      }    },    {      "handle": "m",      "name": "medium",      "option_type": {        "handle": "size",        "name": "size"      }    }  ],  "origin": {    "sku": "0441837446362",    "external_identifier": "56879425369"  },  "product": 8,  "views": [    {      "handle": "front",      "name": "Ansicht vorne",      "media": [        {          "id": 25,          "is_test": 0,          "collection_name": "view-image",          "file_name": "view-image-front-cadetblue.png",          "size": 54738,          "mime_type": "image/png",          "download_url": "https://smake-public.s3.eu-west-1.amazonaws.com/files/e1fd546508dd484b908c5fc653f65818/view-image-front-lime.png?xyz",          "state": "completed",          "failure_message": null,          "created_at": "2022-02-21T11:10:40+00:00",          "updated_at": "2022-02-21T11:10:40+00:00"        }      ],      "customizations": [        {          "id": 2,          "hash": "f6a925c77977ab958267ad897cf7af25706c02c6",          "production_method": 1,          "resource_type": "logo",          "resource": 5,          "price": 0,          "calculation_type": "square_centimeter",          "calculation_value": 119.52,          "x": 130,          "y": 50,          "width": 144,          "height": 83,          "position": "tc",          "rotation": 0,          "created_at": "2022-02-21T11:11:33+00:00",          "updated_at": "2022-02-21T11:11:33+00:00"        }      ]    }  ],  "created_at": "2018-02-21T10:49:41+00:00",  "updated_at": "2018-02-21T10:49:41+00:00"}

List variants GET

Here you can view a product variant or design a new one from an existing product variant. When designing, information such as customizations, dimensions, files, etc. must be transferred. After that you will receive a new product variant that can be ordered. Returns a collection of variants. **Filtering** You can filter your results as follows — see [Pagination](/docs/checkout/2022-02-01/basic/pagination), [Filtering](/docs/checkout/2022-02-01/basic/filtering): - `/variants?filter[id]=1` / `/variants?filter[id]=1,2,3` — list variants for specified id(s) - `/variants?filter[origin.sku]=42443` — list variants for a specified sku (not an exact search) - `/variants?filter[origin.external_identifier]=extern-123` — list variants for external identifier - `/variants?filter[collection_name]=catalogue` — list variants for specified collection name(s) **Expanding relationships** You can expand some resources to show more details — see [Expanding Objects](/docs/checkout/2022-02-01/basic/expanding-objects): - `/variants?expand=product` — show the content of the product instead of the `id` - `/variants?expand=views.customizations.resource` — show the content of the customizations' resource

Design a variant POST

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](/docs/checkout/2022-02-01/basic/polling) or [Webhooks](/docs/checkout/2022-02-01/basic/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: | State | Meaning | |-------|---------| | `draft` | The initial state of a new variant | | `checking` | Variant is processed automatically in background. For example images will be generated or downloaded. | | `failed` | Something went wrong during the checking process. The reason can be found in the `failure_message` attribute. For example an image could not be downloaded. | | `completed` | All 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*.