NAV Navbar
  • Introduction
  • Media
  • Products
  • Variants
  • Checkouts
  • Orders
  • Introduction

    Introduction

    API Endpoint

    https://api.smake.io/v2/apps/{APP_ID_HERE}
    

    Welcome to the Smake Api documentation.

    The Smake API is organized around REST. The API allows you to create orders in a simple programmatic way using conventional HTTP requests.

    Basic terms

    Term Description
    Resource An object (for example, a product variant)
    Collection Listing of objects (for example, all variants of a product)

    Note about the API Endpoint

    Authentication

    Example Request

    GET /orders HTTP/1.1
    Authorization: Bearer API_KEY_HERE
    

    In order to use the API, you must authenticate each request by including your API key as a bearer token value:

    Authorization: Bearer API_KEY_HERE

    Headers

    Example Request

    GET /orders HTTP/1.1
    Accept: application/json
    Content-Type: application/json
    

    The API only supports the data format JSON.

    Therefore, make sure you have the following content type headers are set on each request, except for Upload Media and Media download:

    Accept: application/json

    Content-Type: application/json

    Testing

    Example Response

    HTTP/1.1 200 OK
    
    {
        "id": 1,
        "is_test": true,
        "external_identifier": null,
        "project_name": "et",
        "state": "delivered",
        "customer_locale": "en",
        "currency": "EUR",
        ...
    }
    

    You will get a test application which works similar to your later live application.

    To make the API as explorable as possible, you get a test and a live API key. There is no "switch" for changing between them, just use the appropriate key to perform a live or test request.

    Field Type Description
    is_test boolean Flag indicating whether the resource exists in live application or test application.

    Requests

    Any tool that is fluent in HTTP can communicate with the API simply by requesting the correct URI. The interface responds to different methods depending on the action required.

    Method Use
    GET For simple retrieval of information, you should use the GET method. The information you request will be returned to you as a JSON object. Any request using the GET method is read-only and will not affect any of the objects you are querying.
    DELETE To destroy a resource, use the DELETE method. This will remove the specified object if it is found. If it is not found, the operation will return a response indicating that the object was not found.
    PUT To update the information about a resource, the PUT method is available. The PUT request contains all attributes that are to be updated for an object.
    POST To create a new object, your request should specify the POST method. The POST request includes all of the attributes necessary to create a new object. When you wish to create a new object, send a POST request to the target endpoint.

    HTTP-Status

    Example Error Response

    HTTP/1.1 401 Unauthenticated
    
    {
      "status_code": 401,
      "message":  "API Key is invalid.",
      "errors": []
    }
    

    Example Response for Validation Errors

    HTTP/1.1 422 Unprocessable Entity
    
    {
        "status_code": 422,
        "message": "The request data you sent is not valid.",
        "errors": {
            "shipping_address": {
                "first_name": [
                    "The firstname field is required."
                ]
            },
            "items": [
                {
                    "quantity": [
                        "The items.0.quantity must be at least 1."
                    ]
                }
            ]
        }
    }
    

    Along with the HTTP methods that the API responds to, it will also return standard HTTP statuses, including error codes.

    In the case of a problem, the status contains the error code, while the body of the response will usually contain additional information about the problem that was encountered.

    Successful

    In general, if the status returned is in the 200 range, it indicates that the request was fulfilled successfully and that no error was encountered.

    Client error

    Return codes in the 400 range typically indicate that there was an issue with the request that was sent. Among other things, this could mean that you did not authenticate correctly, that you are requesting an action that you do not have authorization for, that the object you are requesting does not exist, or that your request is malformed.

    Server Error

    If you receive a status in the 500 range, this generally indicates a server-side problem. This means that we are having an issue on our end and cannot fulfill your request currently.

    The following table summarizes the typical status codes:

    Code Description
    200 - OK Everything works as expected.
    201 - Created The resource was created successfully.
    202 - Accepted The request was accepted and is processed in the background.
    204 - No Content The resource was successfully deleted.
    400 - Bad Request Valid data was specified, but the request failed.
    401 - Unauthorized No valid Api Key has been specified.
    404 - Not Found The requested resource does not exist.
    422 - Unprocessable Entity The payload has missing required parameters or invalid data.
    429 - Too Many Requests Too many requests in a short time.
    500 - Internal Server Error Request failed due to an internal error in Smake.
    503 - Service Unavailable Smake is offline for maintenance.

    Responses

    Response Body for a Collection

    {
        "data": [
            {
                "id": 1,
                "is_test": true,
                "first_name": "John",
                "last_name": "Doe",
                "company": null,
                "addresses": [],
                "created_at": "2017-09-28T08:40:44+00:00",
                "updated_at": "2017-09-28T08:40:44+00:00",
                ....
            }
        ]
    }
    

    Response Body for a Resource

    {
      "id": 1,
      "is_test": true,
      "first_name": "John",
      "last_name": "Doe",
      "company": null,
      "addresses": [],
      "created_at": "2017-09-28T08:40:44+00:00",
      "updated_at": "2017-09-28T08:40:44+00:00",
      ...
    }
    

    When a request is successfu, a response body will typically be sent back in the form of a JSON object.

    An exception to this is when a DELETE request is processed, which will result in a successful HTTP 204 status and an empty response body.

    Also an exception to this is when a request is processed asynchronously, which will result in a successful HTTP 202 status and an empty response body.

    Collections / Resourcen / Attribute

    A collection of resources will be displayed within the data object. A resource are presented directly.

    If an attribute has no value it is presented as null. (e. g. company) If an attribute is some kind of list and it is represented by an array, an array will be returned, even if empty. (e. g. adresses)

    Timestamp

    All time values presented in ISO8601 format: YYYYY-MM-DDTHH:MM:SSZ.

    Pagination

    Example Request

    GET /media?per_page=2&page=4 HTTP/1.1
    

    Example Response

    {
         "data": [
             {
                 "id": 1005,
                 "is_test": true,
                 "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",
                 "size": 42840,
                 "mime_type": "image/jpeg",
                 "download_url": "https://api.smake.io/v2/media/1005/download",
                 "created_at": "2017-09-28T08:40:44+00:00",
                 "updated_at": "2017-09-28T08:40:44+00:00"
             },
             {
                 "id": 1006,
                 "is_test": true,
                 "file_name": "5d9de455299a4c369fcf719b677cf4cd.jpeg",
                 "size": 42840,
                 "mime_type": "image/jpeg",
                 "download_url": "https://api.smake.io/v2/media/1006/download",
                 "created_at": "2017-09-28T08:46:21+00:00",
                 "updated_at": "2017-09-28T08:46:21+00:00"
             }
         ],
         "links": {
             "first": "https://api.smake.io/v2/media?page=1&per_page=2",
             "last": "https://api.smake.io/v2/media?page=9&per_page=2",
             "prev": "https://api.smake.io/v2/media?page=3&per_page=2",
             "next": "https://api.smake.io/v2/media?page=2&per_page=2"
         },
         "meta": {
             "current_page": 4,
             "from": 1,
             "last_page": 9,
             "path": "https://api.smake.io/v2/media",
             "per_page": 2,
             "to": 2,
             "total": 17
         }
     }
    

    Each collection always has a meta and links key with information about the paginator.

    Meta

    meta contains the complete information of the paginator, such as the current page or the number of results.

    links contains the direct URLs for navigating through the result set (first, last, prev and next).

    Parameter

    By default, 25 objects are returned per page.

    You can request a different pagination limit or force pagination by appending ?per_page to the request with the number of items you would like per page. For instance, to show only two results per page, you could add ?per_page=2 to the end of your query. The maximum number of results per page is 100.

    You can use the URLs listed under links to browse through the pages or directly select a page using the ?page query string parameter. With ?page=4 you can e. g. go directly to page 4.

    Filter Collection

    Example Request

    GET /orders?filter[state]=delivered HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "data": [
            {
                "id": 1,
                "is_test": true,
                "external_identifier": null,
                "project_name": "et",
                "state": "delivered",
                "customer_locale": "de",
                "currency": "EUR",
                "total": 87.76,
                "subtotal": 86.63,
                "total_tax": 1.13,
                "total_items_price": 82.98,
                "shipping_line": {
                    "title": "DHL World Business",
                    "price": 4.47,
                    "total": 4.78,
                    "tax": 0.31
                },
                "created_at": "2017-09-27T10:10:59+00:00",
                "updated_at": "2017-09-27T10:11:03+00:00",
                "cancelled_at": null,
                "items": [
                    {
                        "id": 1,
                        "quantity": 4,
                        "total": 82.98,
                        "price": 20.54,
                        "total_tax": 0.82,
                        "tax_rate": 1,
                        "variant": {
                            "id": 27,
                            "total": 186.58,
                            "price": 174.37,
                            "tax": 12.21,
                            "tax_rate": 7,
                            "attributes": [
                                {
                                    "name": "color",
                                    "value": "Khaki"
                                },
                                {
                                    "name": "size",
                                    "value": "XL"
                                }
                            ],
                            "origin": {
                                "code": "4490824589755"
                            },
                            "media_id": 251,
                            "views": [],
                            "created_at": "2017-09-27T10:10:38+00:00",
                            "updated_at": "2017-09-27T10:10:38+00:00"
                        },
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00",
                        "cancelled_at": null
                    }
                ],
                "customer": {
                    "id": 40,
                    "first_name": "John",
                    "last_name": "Doe",
                    "email": "john@example.com",
                    "phone": "12345 67890",
                    "addresses": [
                        {
                            "id":  10,
                            "default": true,
                            "company": null,
                            "first_name": "John",
                            "last_name": "Doe",
                            "city": "Anytown",
                            "street1": "123 Main St",
                            "street2": null,
                            "street3": null,
                            "zip": "12345",
                            "email": "john@example.com",
                            "phone": "12345 67890",
                            "province_code": "NW",
                            "country_code": "DE",
                            "vat_in": null,
                            "created_at": "2017-09-27T10:10:59+00:00",
                        },
                        {
                            "id":  11,
                            "default": false,
                            "company": null,
                            "first_name": "John",
                            "last_name": "Doe",
                            "city": "Anytown",
                            "street1": "123 Main St",
                            "street2": null,
                            "street3": null,
                            "zip": "12345",
                            "email": "john@example.com",
                            "phone": "12345 67890",
                            "province_code": "NW",
                            "country_code": "DE",
                            "vat_in": null,
                            "created_at": "2017-09-27T10:10:59+00:00",
                            "updated_at": "2017-09-27T10:10:59+00:00"
                        }
                    ],
                    "default_address": {
                       "id":  10,
                       "default": true,
                       "company": null,
                       "first_name": "John",
                       "last_name": "Doe",
                       "city": "Anytown",
                       "street1": "123 Main St",
                       "street2": null,
                       "street3": null,
                       "zip": "12345",
                       "email": "john@example.com",
                       "phone": "12345 67890",
                       "province_code": "NW",
                       "country_code": "DE",
                       "vat_in": null,
                       "created_at": "2017-09-27T10:10:59+00:00",
                       "updated_at": "2017-09-27T10:10:59+00:00"
                   },
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "shipping_address": {
                    "id": 45,
                    "default": true,
                    "company": null,
                    "first_name": "John",
                    "last_name": "Doe",
                    "city": "Anytown",
                    "street1": "123 Main St",
                    "street2": null,
                    "street3": null,
                    "zip": "12345",
                    "email": "john@example.com",
                    "phone": "12345 67890",
                    "province_code": "NW",
                    "country_code": "DE",
                    "vat_in": null,
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "billing_address": {
                    "id": 44,
                    "default": true,
                    "company": null,
                    "first_name": "John",
                    "last_name": "Doe",
                    "city": "Anytown",
                    "street1": "123 Main St",
                    "street2": null,
                    "street3": null,
                    "zip": "12345",
                    "email": "john@example.com",
                    "phone": "12345 67890",
                    "province_code": "NW",
                    "country_code": "DE",
                    "vat_in": null,
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "whitelabel_address": null,
                "transactions": [
                    {
                        "amount": 87.76,
                        "title": "Invoice"
                    }
                ],
                "fulfillments": [
                    {
                        "id": 1,
                        "order_id": 1,
                        "tracking_number": "2229446017085",
                        "created_at": "2017-09-27T10:11:02+00:00",
                        "updated_at": "2017-09-27T10:11:02+00:00"
                    }
                ],
                "id_tags": [
                    {
                        "id": 1,
                        "order_item_id": 1,
                        "current_state": "Goods booked in",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    },
                    {
                        "id": 2,
                        "order_item_id": 1,
                        "current_state": "Released to production stage",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    },
                    {
                        "id": 3,
                        "order_item_id": 1,
                        "current_state": "Shipped",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    },
                    {
                        "id": 4,
                        "order_item_id": 1,
                        "current_state": "Scanned on machine (DTG)",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    }
                ]
            }
        ],
        "links": {
            "first": "https://api.smake.io/v2/orders?filter%5Bitems.quantity%5D=4&filter%5Bstate%5D=delivered&filter%5Bcustomer.first_name%5D=like%3A%2Aendr%2A&page=1",
            "last": "https://api.smake.io/v2/orders?filter%5Bitems.quantity%5D=4&filter%5Bstate%5D=delivered&filter%5Bcustomer.first_name%5D=like%3A%2Aendr%2A&page=1",
            "prev": null,
            "next": null
        },
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 1,
            "path": "https://api.smake.io/v2/orders",
            "per_page": 25,
            "to": 1,
            "total": 1
        }
    }
    

    You can search within a collection using ?filter[field].

    URL Syntax

    Rate Limit

    Example Rate Limit Header

    GET /orders HTTP/1.1 200 OK
    X-RateLimit-Limit: 5000
    X-RateLimit-Remaining: 4954
    

    Example rate limit consumed

    GET /orders HTTP/1.1 429 Too Many Requests
    X-RateLimit-Limit: 5000
    X-RateLimit-Remaining: 0
    X-RateLimit-Reset: 1377013266
    
    {
        "message": "Too many attempts."
    }
    

    The number of requests that can be made through the API is currently limited to 5000 requests per hour.

    The rate limiting information is contained within the response headers of each request. The relevant headers are:

    Header Name Description
    X-RateLimit-Limit The number of requests that can be made per hour.
    X-RateLimit-Remaining The number of requests that remain before you hit your request limit.
    X-RateLimit-Reset This represents the time when the oldest request will expire. The value is given in UTC epoch seconds.

    If the X-RateLimit-Remaining 0 is reached, subsequent requests receive a 429 error code until the X-RateLimit-Reset is reached.

    Conditional Requests

    Example Response before If-None-Match

    GET /orders HTTP/1.1 200 OK
    ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
    

    Example Request

    GET /orders HTTP/1.1
    If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"
    

    Example Response after If-None-Match

    GET /orders HTTP/1.1 304 Not Modified
    

    All successful GET requests responses return an ETag header. You can use the ETag value to make subsequent requests to those resources using the If-None-Match header. If the resource has not changed, the server returns a 304 Not Modified.

    Polling

    Example Request from a request that would last longer

    POST /variant/1/design HTTP/1.1
    

    Example response from a request that would last longer

    HTTP/1.1 202 Accepted
    Location: https://api.smake.io/v2/jobs/1
    

    Example Request to check the status of the job

    GET /jobs/1 HTTP/1.1
    

    Example Response if the job is not finished yet

    HTTP/1.1 202 Accepted
    Location: https://api.smake.io/v2/jobs/1
    
    {
        "id": 1,
        "is_test": true,
        "resource_url": null,
        "state": "queued"
    }
    

    Example Response when the job is completed

    HTTP/1.1 200 OK
    
    {
        "id": 1,
        "is_test": true,
        "resource_url": "https://api.smake.io/v2/variant/2",
        "state": "finished"
    }
    

    If a task takes longer than the request timeout limit, the request is acknowledged by a 202 Accepted and treated as a background job.

    You don't get the requested resource directly, instead you get the URL of the background job in the Location header, which shows you the background job status.

    Query job status

    You need to check this URL periodically to check when the background job is finished.

    When the background job is completed, a 200 OK is returned and the response body filled the resource_url to complete the next step. If not, a 202 Accepted will still be returned and the resource_url will remain empty.

    Request-Id

    Example Response

    GET /orders HTTP/1.1 200 OK
    X-Request-Id: d312517c-7ac9-402d-87c5-0a6b9da92a4d
    

    Each API request has an associated request identifier. You can find this value in the response headers, under X-Request-Id.

    Localization

    Example Request for Display with Accept-Language Header

    GET /variants/1 HTTP/1.1
    Accept-Language: 'de'
    

    Example Response

    {
        "id": 1,
        "attributes": [
            {
                "name": "color",
                "value": "Gelb"
            }
        ]
        ...
    }
    

    Example Request for Display Without Accept-Language Header

    GET /variants/1 HTTP/1.1
    

    Example Response

    {
        "id": 1,
        "attributes": [
            {
                "name": "color",
                "value": "Yellow"
            }
        ]
        ...
    }
    

    Example Request for saving with Accept-Language

    POST /orders HTTP/1.1
    Accept-Language: 'de'
    
    {
       "email": "customer@example.com",
       "items": [
          {
             "variant_id": 1,
             "quantity": 1
          }
       ],
       "shipping_address": {
          "first_name": "John",
          "last_name": "Doe",
          "street1": "123 Main St",
          "zip": "12345",
          "city": "Anytown",
          "country_code": "DE",
          "province_code": "NW",
          "phone": "12345 67890",
          "email": "shipping@example.com"
       }
    }
    

    Example Response

    {
        "id": 1,
        "external_identifier": null,
        "project_name": null,
        "state": "incompleted",
        "customer_locale": "de",
        ...
    }
    

    Example Request for saving without Accept-Language

    POST /orders HTTP/1.1
    
    {
       "email": "customer@example.com",
       "items": [
          {
             "variant_id": 1,
             "quantity": 1
          }
       ],
       "shipping_address": {
          "first_name": "John",
          "last_name": "Doe",
          "street1": "123 Main St",
          "zip": "12345",
          "city": "Anytown",
          "country_code": "DE",
          "province_code": "NW",
          "phone": "12345 67890",
          "email": "shipping@example.com"
       }
    }
    

    Example Response

    {
        "id": 1,
        "external_identifier": null,
        "project_name": null,
        "state": "incompleted",
        "customer_locale": "en",
        ...
    }
    

    Display

    By default, a resource is presented in english. You can also display the resource in another language.

    With the Accept-Language header a resource can be localized. However, this does not affect validation messages or any errors. These are still displayed in English.

    The following locales are currently available for Accept-Language:

    en, de, nl, fr, ar, sv, pl and tk

    Saving

    In some cases, you can also save a resource localized. For example, the Checkout Api uses this to save an order in a specified language. By default it is stored in english, using the Accept-Language header you can control how it is stored.

    This is important if, for example, the delivery note is to be displayed in a specific language.

    Media

    Under Media you can store image files for different areas and reuse them several times with reference to the Media Id.

    Currently, media ids are required for the following areas:

    Area Attributes Description
    Design variant composite_media_id Product picture with customization
    Design variant production_media_id Production file for customization

    Upload media

    Example Request

    POST /media HTTP/1.1
    Content-Type: image/jpeg
    Content-Length: 42840
    
    raw content
    

    Example Response

    HTTP/1.1 201 Created
    
    {
        "id": 1,
        "is_test": true,
        "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",
        "size": 42840,
        "mime_type": "image/jpeg",
        "download_url": "https://api.smake.io/v2/media/1/download",
        "created_at": "2017-09-28T08:40:44+00:00",
        "updated_at": "2017-09-28T08:40:44+00:00"
    }
    

    The following file formats are currently supported:

    Type Options
    JPG/JPEG RGB, 300dpi
    PNG RGB, 300dpi, transparencies

    The maximum file size is 10MB.

    Sending a simple upload request

    1. Add the file's data as binary data to the request body. Here described as raw content.
    2. Add the following HTTP headers:
      • Content-Type. Set to the MIME media type of the object being uploaded.
      • Content-Length. Set to the number of bytes you are uploading.
    3. Send the request

    In PHP, for example, you can send raw content with file_get_contents('/path/to/file').

    List media

    Example Request

    GET /media HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "data": [
            {
                "id": 1005,
                "is_test": true,
                "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",
                "size": 42840,
                "mime_type": "image/jpeg",
                "download_url": "https://api.smake.io/v2/media/1005/download",
                "created_at": "2017-09-28T08:40:44+00:00",
                "updated_at": "2017-09-28T08:40:44+00:00"
            },
            {
                "id": 1006,
                "is_test": true,
                "file_name": "5d9de455299a4c369fcf719b677cf4cd.jpeg",
                "size": 42840,
                "mime_type": "image/jpeg",
                "download_url": "https://api.smake.io/v2/media/1006/download",
                "created_at": "2017-09-28T08:46:21+00:00",
                "updated_at": "2017-09-28T08:46:21+00:00"
            },
            {
                "id": 1007,
                "is_test": true,
                "file_name": "4efd66336f274163b6ef8c34a9c77570.jpeg",
                "size": 42840,
                "mime_type": "image/jpeg",
                "download_url": "https://api.smake.io/v2/media/1007/download",
                "created_at": "2017-09-28T08:46:26+00:00",
                "updated_at": "2017-09-28T08:46:26+00:00"
            },
            {
                "id": 1008,
                "is_test": true,
                "file_name": "391f3972c2bd473ba186752555b74cab.jpeg",
                "size": 42840,
                "mime_type": "image/jpeg",
                "download_url": "https://api.smake.io/v2/media/1008/download",
                "created_at": "2017-09-28T08:46:27+00:00",
                "updated_at": "2017-09-28T08:46:27+00:00"
            },
            {
                "id": 1009,
                "is_test": true,
                "file_name": "f868b1172fb74d0dbd6877f3e02f3386.jpeg",
                "size": 42840,
                "mime_type": "image/jpeg",
                "download_url": "https://api.smake.io/v2/media/1009/download",
                "created_at": "2017-09-28T08:46:28+00:00",
                "updated_at": "2017-09-28T08:46:28+00:00"
            },
           ...
        ],
        "links": {
            "first": "https://api.smake.io/v2/media?page=1",
            "last": "https://api.smake.io/v2/media?page=1",
            "prev": null,
            "next": null
        },
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 1,
            "path": "https://api.smake.io/v2/media",
            "per_page": 25,
            "to": 16,
            "total": 16
        }
    }
    

    Returns a collection of uploaded images.

    Get Media

    Example Request

    GET /media/1 HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "id": 1,
        "is_test": true,
        "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",
        "size": 42840,
        "mime_type": "image/jpeg",
        "download_url": "https://api.smake.io/v2/media/1/download",
        "created_at": "2017-09-28T08:40:44+00:00",
        "updated_at": "2017-09-28T08:40:44+00:00"
    }
    

    Returns the resource for the uploaded image with id = x.

    Media download

    Example Request

    GET /media/1/download HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    Content-Type: image/jpeg
    
    raw content
    

    Returns the image data for the uploaded image with the id = x as download.

    For example, in PHP you can read the raw content with file_get_contents('php://input');.

    Products

    List products

    Example Request

    GET /products HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "data": [
            {
                "is_test": false,
                "id": 1,
                "title": "qui ut nemo",
                "description": "Autem nesciunt ipsam excepturi non distinctio quas ullam placeat. Quam quidem rerum veniam corrupti velit aperiam non. Repudiandae rem incidunt atque optio vero et voluptatem. Fuga et quos in ipsa.",
                "created_at": "2017-11-15T08:07:48+00:00",
                "updated_at": "2017-11-15T08:07:48+00:00",
                "variants": [
                    {
                        "id": 90,
                        "total": 101.7,
                        "price": 85.46,
                        "tax": 16.24,
                        "tax_rate": 19,
                        "attributes": [
                            {
                                "name": "color",
                                "value": "RoyalBlue"
                            },
                            {
                                "name": "size",
                                "value": "S"
                            }
                        ],
                        "origin": {
                            "code": "0635579894134"
                        },
                        "media_id": 607,
                        "views": {
                            "back": {
                                "composite_media_id": 609,
                                "customizations": []
                            },
                            "left": {
                                "composite_media_id": 610,
                                "customizations": []
                            },
                            "front": {
                                "composite_media_id": 608,
                                "customizations": []
                            },
                            "right": {
                                "composite_media_id": 611,
                                "customizations": []
                            }
                        },
                        "created_at": "2017-11-15T08:07:48+00:00",
                        "updated_at": "2017-11-15T08:07:50+00:00"
                    },
                    {
                        "id": 92,
                        "total": 185.21,
                        "price": 173.09,
                        "tax": 12.12,
                        "tax_rate": 7,
                        "attributes": [
                            {
                                "name": "color",
                                "value": "DarkCyan"
                            },
                            {
                                "name": "size",
                                "value": "L"
                            }
                        ],
                        "origin": {
                            "code": "6904687103174"
                        },
                        "media_id": 617,
                        "views": {
                            "back": {
                                "composite_media_id": 619,
                                "customizations": []
                            },
                            "left": {
                                "composite_media_id": 620,
                                "customizations": []
                            },
                            "front": {
                                "composite_media_id": 618,
                                "customizations": []
                            },
                            "right": {
                                "composite_media_id": 621,
                                "customizations": []
                            }
                        },
                        "created_at": "2017-11-15T08:07:49+00:00",
                        "updated_at": "2017-11-15T08:07:50+00:00"
                    },
                    {
                        "id": 94,
                        "total": 24.52,
                        "price": 20.61,
                        "tax": 3.91,
                        "tax_rate": 19,
                        "attributes": [
                            {
                                "name": "color",
                                "value": "Blue"
                            },
                            {
                                "name": "size",
                                "value": "L"
                            }
                        ],
                        "origin": {
                            "code": "1243574262255"
                        },
                        "media_id": 627,
                        "views": {
                            "back": {
                                "composite_media_id": 629,
                                "customizations": []
                            },
                            "left": {
                                "composite_media_id": 630,
                                "customizations": []
                            },
                            "front": {
                                "composite_media_id": 628,
                                "customizations": []
                            },
                            "right": {
                                "composite_media_id": 631,
                                "customizations": []
                            }
                        },
                        "created_at": "2017-11-15T08:07:50+00:00",
                        "updated_at": "2017-11-15T08:07:50+00:00"
                    }
                ]
            },
            {
                "is_test": false,
                "id": 30,
                "title": "ut",
                "description": "Et voluptatem quas neque praesentium qui harum. Ea occaecati perferendis inventore tempore nemo. Nobis perferendis voluptas sed tempore at.",
                "created_at": "2017-11-15T08:07:51+00:00",
                "updated_at": "2017-11-15T08:07:51+00:00",
                "variants": [
                    {
                        "id": 96,
                        "total": 168.98,
                        "price": 142,
                        "tax": 26.98,
                        "tax_rate": 19,
                        "attributes": [
                            {
                                "name": "color",
                                "value": "DarkRed"
                            },
                            {
                                "name": "size",
                                "value": "M"
                            }
                        ],
                        "origin": {
                            "code": "9410671772396"
                        },
                        "media_id": 642,
                        "views": {
                            "back": {
                                "composite_media_id": 644,
                                "customizations": []
                            },
                            "left": {
                                "composite_media_id": 645,
                                "customizations": []
                            },
                            "front": {
                                "composite_media_id": 643,
                                "customizations": []
                            },
                            "right": {
                                "composite_media_id": 646,
                                "customizations": []
                            }
                        },
                        "created_at": "2017-11-15T08:07:51+00:00",
                        "updated_at": "2017-11-15T08:07:55+00:00"
                    },
                    {
                        "id": 98,
                        "total": 95.92,
                        "price": 80.61,
                        "tax": 15.31,
                        "tax_rate": 19,
                        "attributes": [
                            {
                                "name": "color",
                                "value": "BlanchedAlmond"
                            },
                            {
                                "name": "size",
                                "value": "L"
                            }
                        ],
                        "origin": {
                            "code": "0473312504175"
                        },
                        "media_id": 652,
                        "views": {
                            "back": {
                                "composite_media_id": 654,
                                "customizations": []
                            },
                            "left": {
                                "composite_media_id": 655,
                                "customizations": []
                            },
                            "front": {
                                "composite_media_id": 653,
                                "customizations": []
                            },
                            "right": {
                                "composite_media_id": 656,
                                "customizations": []
                            }
                        },
                        "created_at": "2017-11-15T08:07:52+00:00",
                        "updated_at": "2017-11-15T08:07:55+00:00"
                    },
                    {
                        "id": 100,
                        "total": 121.2,
                        "price": 101.85,
                        "tax": 19.35,
                        "tax_rate": 19,
                        "attributes": [
                            {
                                "name": "color",
                                "value": "Pink"
                            },
                            {
                                "name": "size",
                                "value": "XL"
                            }
                        ],
                        "origin": {
                            "code": "6122944008004"
                        },
                        "media_id": 662,
                        "views": {
                            "back": {
                                "composite_media_id": 664,
                                "customizations": []
                            },
                            "left": {
                                "composite_media_id": 665,
                                "customizations": []
                            },
                            "front": {
                                "composite_media_id": 663,
                                "customizations": []
                            },
                            "right": {
                                "composite_media_id": 666,
                                "customizations": []
                            }
                        },
                        "created_at": "2017-11-15T08:07:53+00:00",
                        "updated_at": "2017-11-15T08:07:55+00:00"
                    },
                    {
                        "id": 102,
                        "total": 125.17,
                        "price": 116.98,
                        "tax": 8.19,
                        "tax_rate": 7,
                        "attributes": [
                            {
                                "name": "color",
                                "value": "Ivory"
                            },
                            {
                                "name": "size",
                                "value": "S"
                            }
                        ],
                        "origin": {
                            "code": "5897554102930"
                        },
                        "media_id": 672,
                        "views": {
                            "back": {
                                "composite_media_id": 674,
                                "customizations": []
                            },
                            "left": {
                                "composite_media_id": 675,
                                "customizations": []
                            },
                            "front": {
                                "composite_media_id": 673,
                                "customizations": []
                            },
                            "right": {
                                "composite_media_id": 676,
                                "customizations": []
                            }
                        },
                        "created_at": "2017-11-15T08:07:54+00:00",
                        "updated_at": "2017-11-15T08:07:55+00:00"
                    },
                    {
                        "id": 104,
                        "total": 64.28,
                        "price": 54.02,
                        "tax": 10.26,
                        "tax_rate": 19,
                        "attributes": [
                            {
                                "name": "color",
                                "value": "DarkSalmon"
                            },
                            {
                                "name": "size",
                                "value": "XL"
                            }
                        ],
                        "origin": {
                            "code": "0899276696853"
                        },
                        "media_id": 682,
                        "views": {
                            "back": {
                                "composite_media_id": 684,
                                "customizations": []
                            },
                            "left": {
                                "composite_media_id": 685,
                                "customizations": []
                            },
                            "front": {
                                "composite_media_id": 683,
                                "customizations": []
                            },
                            "right": {
                                "composite_media_id": 686,
                                "customizations": []
                            }
                        },
                        "created_at": "2017-11-15T08:07:55+00:00",
                        "updated_at": "2017-11-15T08:07:55+00:00"
                    }
                ]
            }
            ...
        ],
        "links": {
            "first": "https://api.smake.io/v2/products?page=1",
            "last": "https://api.smake.io/v2/products?page=2",
            "prev": null,
            "next": "https://api.smake.io/v2/products?page=2"
        },
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 2,
            "path": "https://api.smake.io/v2/products",
            "per_page": 25,
            "to": 25,
            "total": 28
        }
    }
    

    Returns a collection of products.

    Collection Filtering

    List products for specified id(s)

    List products for specified title

    List products for a specified origin code

    Get product

    Example Request

    GET /products/1 HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "is_test": false,
        "id": 1,
        "title": "qui ut nemo",
        "description": "Autem nesciunt ipsam excepturi non distinctio quas ullam placeat. Quam quidem rerum veniam corrupti velit aperiam non. Repudiandae rem incidunt atque optio vero et voluptatem. Fuga et quos in ipsa.",
        "created_at": "2017-11-15T08:07:48+00:00",
        "updated_at": "2017-11-15T08:07:48+00:00",
        "variants": [
            {
                "id": 90,
                "total": 101.7,
                "price": 85.46,
                "tax": 16.24,
                "tax_rate": 19,
                "attributes": [
                    {
                        "name": "color",
                        "value": "RoyalBlue"
                    },
                    {
                        "name": "size",
                        "value": "S"
                    }
                ],
                "origin": {
                    "code": "0635579894134"
                },
                "media_id": 607,
                "views": {
                    "back": {
                        "composite_media_id": 609,
                        "customizations": []
                    },
                    "left": {
                        "composite_media_id": 610,
                        "customizations": []
                    },
                    "front": {
                        "composite_media_id": 608,
                        "customizations": []
                    },
                    "right": {
                        "composite_media_id": 611,
                        "customizations": []
                    }
                },
                "created_at": "2017-11-15T08:07:48+00:00",
                "updated_at": "2017-11-15T08:07:50+00:00"
            },
            {
                "id": 92,
                "total": 185.21,
                "price": 173.09,
                "tax": 12.12,
                "tax_rate": 7,
                "attributes": [
                    {
                        "name": "color",
                        "value": "DarkCyan"
                    },
                    {
                        "name": "size",
                        "value": "L"
                    }
                ],
                "origin": {
                    "code": "6904687103174"
                },
                "media_id": 617,
                "views": {
                    "back": {
                        "composite_media_id": 619,
                        "customizations": []
                    },
                    "left": {
                        "composite_media_id": 620,
                        "customizations": []
                    },
                    "front": {
                        "composite_media_id": 618,
                        "customizations": []
                    },
                    "right": {
                        "composite_media_id": 621,
                        "customizations": []
                    }
                },
                "created_at": "2017-11-15T08:07:49+00:00",
                "updated_at": "2017-11-15T08:07:50+00:00"
            },
            {
                "id": 94,
                "total": 24.52,
                "price": 20.61,
                "tax": 3.91,
                "tax_rate": 19,
                "attributes": [
                    {
                        "name": "color",
                        "value": "Blue"
                    },
                    {
                        "name": "size",
                        "value": "L"
                    }
                ],
                "origin": {
                    "code": "1243574262255"
                },
                "media_id": 627,
                "views": {
                    "back": {
                        "composite_media_id": 629,
                        "customizations": []
                    },
                    "left": {
                        "composite_media_id": 630,
                        "customizations": []
                    },
                    "front": {
                        "composite_media_id": 628,
                        "customizations": []
                    },
                    "right": {
                        "composite_media_id": 631,
                        "customizations": []
                    }
                },
                "created_at": "2017-11-15T08:07:50+00:00",
                "updated_at": "2017-11-15T08:07:50+00:00"
            }
        ]
    }
    

    Returns the product with the id = x.

    Variants

    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.

    List variants

    Example Request

    GET /variants HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "data": [
            {
                "is_test": false,
                "id": 6,
                "total": 97.37,
                "price": 91,
                "tax": 6.37,
                "tax_rate": 7,
                "attributes": [
                    {
                        "name": "color",
                        "value": "CadetBlue"
                    },
                    {
                        "name": "size",
                        "value": "M"
                    }
                ],
                "origin": {
                    "code": "0441837446362"
                },
                "media_id": 150,
                "views": {
                    "back": {
                        "composite_media_id": 152,
                        "customizations": []
                    },
                    "left": {
                        "composite_media_id": 153,
                        "customizations": []
                    },
                    "front": {
                        "composite_media_id": 151,
                        "customizations": []
                    },
                    "right": {
                        "composite_media_id": 154,
                        "customizations": []
                    }
                },
                "created_at": "2018-02-21T10:49:41+00:00",
                "updated_at": "2018-02-21T10:49:41+00:00"
            },
            {
                "is_test": false,
                "id": 10,
                "total": 191.59,
                "price": 161,
                "tax": 30.59,
                "tax_rate": 19,
                "attributes": [
                    {
                        "name": "color",
                        "value": "DarkSalmon"
                    },
                    {
                        "name": "size",
                        "value": "XL"
                    }
                ],
                "origin": {
                    "code": "2673696529018"
                },
                "media_id": 165,
                "views": {
                    "back": {
                        "composite_media_id": 167,
                        "customizations": []
                    },
                    "left": {
                        "composite_media_id": 168,
                        "customizations": []
                    },
                    "front": {
                        "composite_media_id": 166,
                        "customizations": []
                    },
                    "right": {
                        "composite_media_id": 169,
                        "customizations": []
                    }
                },
                "created_at": "2018-02-21T10:49:42+00:00",
                "updated_at": "2018-02-21T10:49:42+00:00"
            },
            {
                "is_test": false,
                "id": 11,
                "total": 152.88,
                "price": 128.47,
                "tax": 24.41,
                "tax_rate": 19,
                "attributes": [
                    {
                        "name": "color",
                        "value": "Navy"
                    },
                    {
                        "name": "size",
                        "value": "S"
                    }
                ],
                "origin": {
                    "code": "4244363429184"
                },
                "media_id": 180,
                "views": {
                    "back": {
                        "composite_media_id": 182,
                        "customizations": []
                    },
                    "left": {
                        "composite_media_id": 183,
                        "customizations": []
                    },
                    "front": {
                        "composite_media_id": 181,
                        "customizations": []
                    },
                    "right": {
                        "composite_media_id": 184,
                        "customizations": []
                    }
                },
                "created_at": "2018-02-21T10:49:42+00:00",
                "updated_at": "2018-02-21T10:49:42+00:00"
            },
            ...
        ],
        "links": {
            "first": "https://api.smake.io/v2/variants?page=1",
            "last": "https://api.smake.io/v2/variants?page=4",
            "prev": null,
            "next": "https://api.smake.io/v2/variants?page=2"
        },
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 4,
            "path": "https://api.smake.io/v2/variants",
            "per_page": 15,
            "to": 15,
            "total": 56
        }
    }
    

    Returns a collection of variants.

    Collection Filtering

    List variants for specified id(s)

    List variants for a specified origin code

    Get variant

    Example Request

    GET /variants/1 HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "id": 1,
        "is_test": true,
        "total": 259.98,
        "price": 218.47,
        "tax": 41.51,
        "tax_rate": 19,
        "attributes": [
            {
                "name": "color",
                "value": "LightYellow"
            },
            {
                "name": "size",
                "value": "XL"
            }
        ],
        "origin": {
            "code": "0635579894134"
        },
        "media_id": 1094,
        "views": {
            "back": {
                "composite_media_id": 10680,
                "customizations": [
                    {
                        "type": "dtg",
                        "production_media_id": 1,
                        "preview_media_id": 1001,
                        "dimension": {
                            "width": 100.55,
                            "height": 200.66
                        }
                    },
                    {
                        "type": "dtg",
                        "production_media_id": 2,
                        "preview_media_id": 1002,
                        "dimension": {
                            "width": 100.66,
                            "height": 200.12
                        }
                    }
                ]
            },
            "front": {
                "composite_media_id": 1093,
                "customizations": [
                    {
                        "type": "dtg",
                        "production_media_id": 2,
                        "preview_media_id": 1003,
                        "dimension": {
                            "width": 100.55,
                            "height": 200.66
                        }
                    },
                    {
                        "type": "dtg",
                        "production_media_id": 2,
                        "preview_media_id": 1004,
                        "dimension": {
                            "width": 1001.55,
                            "height": 2000.66
                        }
                    },
                    {
                        "type": "dtg",
                        "production_media_id": 2,
                        "preview_media_id": 1095,
                        "dimension": {
                            "width": 100.55,
                            "height": 200.66
                        }
                    },
                    {
                        "type": "dtg",
                        "production_media_id": 2,
                        "preview_media_id": 1096,
                        "dimension": {
                            "width": 1001.55,
                            "height": 2000.66
                        }
                    }
                ]
            }
        },
        "created_at": "2017-09-28T14:48:05+00:00",
        "updated_at": "2017-09-28T14:48:05+00:00"
    }
    

    Returns the product variant with the id = x.

    Design variant

    Example Request

    POST /variants/136/design HTTP/1.1
    
    {
        "views": {
            "front": {
                "composite_media_id": 1,
                "customizations": [
                    {
                        "type": "dtg",
                        "production_media_id": 2,
                        "dimension": {
                            "width": 100.55,
                            "height": 200.66
                        }
                    },
                    {
                        "type": "dtg",
                        "production_media_id": 2,
                        "dimension": {
                            "width": 1001.55,
                            "height": 2000.66
                        }
                    }
                ]
            }
    
        }
    }
    

    Example Response

    HTTP/1.1 202 Accepted
    Location https://api.smake.io/jobs/1
    

    When you design a product variant, this happens asynchronously and you have to use Polling.

    It is not possible to order this product variant before.

    Designing a product variant is made possible by placing customizations on the corresponding view (e. g. front or back).

    Field Type Description Required
    views object Contains the views on which customizations are placed. Allowed are front, back, left and right. Views Object yes

    Views Object

    Field Type Description Required
    front.composite_media_id integer The media id that represents the product image with customizations. See Media yes
    front.customizations array Contains all customizations to be placed for the view. An array of Customizations Objects yes

    Customizations Object

    Field Type Description Required
    type string Processing format of the customizations. Allowed is dtg yes
    production_media_id integer The media id that contains the production file of the customizations. See Media yes
    dimension object Dimension Object yes

    Dimension Object

    Field Type Description Required
    width float The width of the customization in millimetres (mm) yes
    height float The height of the customization in millimetres (mm) yes

    Checkouts

    A checkout must be created so that you can order a product variant.

    Create Checkout

    Example Request

    POST /checkouts HTTP/1.1
    
    {
       "email": "customer@example.com",
       "items": [
          {
             "variant_id": 1,
             "quantity": 1
          }
       ],
       "shipping_address": {
          "first_name": "John",
          "last_name": "Doe",
          "street1": "123 Main St",
          "zip": "12345",
          "city": "Anytown",
          "country_code": "DE",
          "province_code": "NW",
          "phone": "12345 67890",
          "email": "shipping@example.com"
       }
    }
    

    Example Response

    HTTP/1.1 201 Created
    
    {
        "id": 1,
        "is_test": true,
        "external_identifier": null,
        "project_name": null,
        "state": "incompleted",
        "customer_locale": "en",
        "currency": "EUR",
        "total": 123.75,
        "subtotal": 103.99,
        "total_tax": 19.76,
        "total_items_price": 123.75,
        "shipping_line": [],
        "created_at": "2017-09-29T09:14:11+00:00",
        "updated_at": "2017-09-29T09:14:11+00:00",
        "cancelled_at": null,
        "items": [
            {
                "id": 75,
                "quantity": 1,
                "total": 123.75,
                "price": 103.99,
                "total_tax": 19.76,
                "tax_rate": 19,
                "variant": {
                    "id": 1,
                    "total": 123.75,
                    "price": 103.99,
                    "tax": 19.76,
                    "tax_rate": 19,
                    "attributes": [
                        {
                            "name": "color",
                            "value": "LightPink"
                        },
                        {
                            "name": "size",
                            "value": "M"
                        }
                    ],
                    "origin": {
                        "code": "2032095419441"
                    },
                    "media_id": 81,
                    "views": [],
                    "state": "finished",
                    "created_at": "2017-09-27T10:10:33+00:00",
                    "updated_at": "2017-09-27T10:10:34+00:00"
                },
                "created_at": "2017-09-29T09:14:11+00:00",
                "updated_at": "2017-09-29T09:14:11+00:00",
                "cancelled_at": null
            }
        ],
        "customer": {
            "id": 98,
            "first_name": null,
            "last_name": null,
            "email": "customer@example.com",
            "phone": null,
            "addresses": [],
            "default_address": null,
            "created_at": "2017-09-29T09:14:11+00:00",
            "updated_at": "2017-09-29T09:14:11+00:00"
        },
        "shipping_address": {
            "id": 190,
            "default": true,
            "company": null,
            "first_name": "John",
            "last_name": "Doe",
            "city": "Anytown",
            "street1": "123 Main St",
            "street2": null,
            "street3": null,
            "zip": "12345",
            "phone": "12345 67890",
            "email": "shipping@example.com",
            "province_code": "NW",
            "country_code": "DE",
            "vat_in": null,
            "created_at": "2017-09-29T09:14:11+00:00",
            "updated_at": "2017-09-29T09:14:11+00:00"
        },
        "billing_address": {
            "id": 191,
            "default": true,
            "company": null,
            "first_name": "John",
            "last_name": "Doe",
            "city": "Anytown",
            "street1": "123 Main St",
            "street2": null,
            "street3": null,
            "zip": "12345",
            "phone": "12345 67890",
            "email": "shipping@example.com",
            "province_code": "NW",
            "country_code": "DE",
            "vat_in": null,
            "created_at": "2017-09-29T09:14:11+00:00",
            "updated_at": "2017-09-29T09:14:11+00:00"
        },
        "whitelabel_address": null,
        "transactions": [],
        "fulfillments": [],
        "id_tags": []
    }
    

    Attribute

    Field Type Description Required
    project_name string Project name
    external_identifier string The external identifier is an optional field for the order id for your system. The external identifier must be unique.
    email string E-mail. RFC3696/5321 compliant yes
    items array Items. An array of Item Objects yes
    shipping_address object Shipping address. Address Object yes
    billing_address object Billing address. If you do not specify this address, it corresponds to the shipping address. Address Object
    whitelabel_address object White label / Sender address. Address Object

    Item Object

    Back to Attributes

    Field Type Description Required
    variant_id integer Id of the product variant yes
    quantity integer The quantity to be ordered yes

    Address Object

    Back to Attributes

    Field Type Description Required
    company string Company
    first_name string First name yes
    last_name string Last name yes
    street1 string First street line. Limited to 35 characters yes
    street2 string Second street line. Limited to 35 characters
    street3 string Third street line. Limited to 35 characters
    zip string Zip code yes
    city string City yes
    province_code string Requires a two-digit code. Example: 'NW' (North Rhine-Westphalia), 'AL' (Alabama) yes
    country_code ISO 3166-1-alpha-2 code (ISO 2 country code) Example: 'US' or 'DE'. All accepted values can be found on the Official ISO website. yes
    email string Contact person's e-mail address, RFC3696/5321 compliant. yes
    phone string So that, for example, the parcel service can call the address/dispatcher of the parcel in case of problems with shipping. yes
    vat_in string Sales tax

    Check shipping rates

    Example Request

    GET /checkouts/1/shipping-rates HTTP/1.1
    

    Example Response

    HTTP/1.1 202 Accepted
    Location https://api.smake.io/jobs/1
    

    Example Request as soon as the task is completed

    GET /checkouts/1/shipping-rates HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "data": [
            {
                "is_test": true,
                "handle": "pickup",
                "title": "Abholung",
                "price": 22
            }
        ],
        "links": {
            "first": "/?page=1",
            "last": "/?page=1",
            "prev": null,
            "next": null
        },
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 1,
            "path": "/",
            "per_page": 15,
            "to": 1,
            "total": 1
        }
    }
    

    To be able to send the order, it is necessary to query the shipping rates and select the appropriate shipping method. This happens asynchronously and you have to use Polling.

    If the response is 200 OK, you have to update the shipping_line in the checkout with the desired shipment handle.

    Update Checkout

    Example request to update the items

    PUT /checkouts/1 HTTP/1.1
    
    {
        "items": [
            {
                "variant_id": 3,
                "quantity": 1
            },
            {
                 "variant_id": 4,
                 "quantity": 5
            }
        ]
    }
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        ...
        "items": [
            {
                "id": 77,
                "quantity": 1,
                ...
                "variant": {
                    "id": 3,
                    ...
                },
            },
            {
                "id": 78,
                "quantity": 5,
                ...
                "variant": {
                    "id": 4,
                    ...
                },
            }
        ],
        ...
    }
    

    Example request to update shipping_line

    PUT /checkouts/1 HTTP/1.1
    
    {
        "shipping": {
            "handle": "pickup"
        }
    }
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        ...
        "shipping_line": {
            "title": "Pickup",
            "price": 22.06,
            "total": 26.25,
            "tax": 4.19
        },
        ...
    }
    

    During the process it is possible to update the checkout.

    Complete checkout

    Example request to complete a checkout

    PUT /checkouts/1/complete HTTP/1.1
    
    {
        "payment": {
          "handle": "invoice",
          "amount": 150.0
        }
    }
    

    In order to complete the checkout, the following must be transferred as payment.handle invoice. and the request must contain the total amount of the order.

    You can then use the Orders endpoint to list and filter your orders.

    Orders

    An order is created when the checkout process is complete.

    List order

    Example Request

    GET /orders HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "data": [
            {
                "id": 1,
                "is_test": true,
                "external_identifier": null,
                "project_name": "et",
                "state": "delivered",
                "customer_locale": "en",
                "currency": "EUR",
                "total": 87.76,
                "subtotal": 86.63,
                "total_tax": 1.13,
                "total_items_price": 82.98,
                "shipping_line": {
                    "title": "Pickup",
                    "price": 4.47,
                    "total": 4.78,
                    "tax": 0.31
                },
                "created_at": "2017-09-27T10:10:59+00:00",
                "updated_at": "2017-09-27T10:11:03+00:00",
                "cancelled_at": null,
                "items": [
                    {
                        "id": 1,
                        "quantity": 4,
                        "total": 82.98,
                        "price": 20.54,
                        "total_tax": 0.82,
                        "tax_rate": 1,
                        "variant": {
                            "id": 27,
                            "total": 186.58,
                            "price": 174.37,
                            "tax": 12.21,
                            "tax_rate": 7,
                            "attributes": [
                                {
                                    "name": "color",
                                    "value": "Khaki"
                                },
                                {
                                    "name": "size",
                                    "value": "XL"
                                }
                            ],
                            "origin": {
                                "code": "4490824589755"
                            },
                            "media_id": 251,
                            "views": [],
                            "created_at": "2017-09-27T10:10:38+00:00",
                            "updated_at": "2017-09-27T10:10:38+00:00"
                        },
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00",
                        "cancelled_at": null
                    }
                ],
                "customer": {
                    "id": 40,
                    "first_name": "John",
                    "last_name": "Doe",
                    "email": "John@example.com",
                    "phone": "12345 67890",
                    "addresses": [],
                    "default_address": {
                        "id": 122,
                        "default": true,
                        "company": null,
                        "first_name": "John",
                        "last_name": "Doe",
                        "city": "Anytown",
                        "street1": "123 Main St",
                        "street2": null,
                        "street3": null,
                        "zip": "12345",
                        "phone": "12345 67890",
                        "email": "John@example.com",
                        "province_code": "NW",
                        "country_code": "DE",
                        "vat_in": null,
                        "created_at": "2017-09-27T10:11:01+00:00",
                        "updated_at": "2017-09-27T10:11:01+00:00"
                    },
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "shipping_address": {
                    "id": 45,
                    "default": true,
                    "company": "MyCompany",
                    "first_name": "John",
                    "last_name": "John",
                    "city": "Anytown",
                    "street1": "123 Main St",
                    "street2": null,
                    "street3": null,
                    "zip": "12345",
                    "phone": "12345 67890",
                    "email": "john@example.net",
                    "province_code": "NW",
                    "country_code": "DE",
                    "vat_in": null,
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "billing_address": {
                    "id": 44,
                    "default": true,
                    "company": "MyCompany",
                    "first_name": "John",
                    "last_name": "Doe",
                    "city": "Anytown",
                    "street1": "123 Main St",
                    "street2": null,
                    "street3": null,
                    "zip": "12345",
                    "phone": "12345 67890",
                    "email": "john@example.net",
                    "province_code": "NW",
                    "country_code": "DE",
                    "vat_in": null,
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "whitelabel_address": null,
                "transactions": [
                    {
                        "amount": 87.76,
                        "title": "Invoice"
                    }
                ],
                "fulfillments": [
                    {
                        "id": 1,
                        "order_id": 1,
                        "tracking_number": "2229446017085",
                        "created_at": "2017-09-27T10:11:02+00:00",
                        "updated_at": "2017-09-27T10:11:02+00:00"
                    }
                ],
                "id_tags": [
                    {
                        "id": 1,
                        "order_item_id": 1,
                        "current_state": "Goods booked in",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    },
                    {
                        "id": 2,
                        "order_item_id": 1,
                        "current_state": "Released to production stage",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    },
                    {
                        "id": 3,
                        "order_item_id": 1,
                        "current_state": "Shipped",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    },
                    {
                        "id": 4,
                        "order_item_id": 1,
                        "current_state": "Scanned on machine (DTG)",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    }
                ]
            },
            {
                "id": 2,
                "is_test": true,
                "external_identifier": null,
                "project_name": "dicta",
                "state": "incompleted",
                "customer_locale": "en",
                "currency": "EUR",
                "total": 9.46,
                "subtotal": 8.94,
                "total_tax": 0.52,
                "total_items_price": 5.44,
                "shipping_line": {
                    "title": "German Post Maxibrief",
                    "price": 3.76,
                    "total": 4.02,
                    "tax": 0.26
                },
                "created_at": "2017-09-27T10:10:59+00:00",
                "updated_at": "2017-09-27T10:10:59+00:00",
                "cancelled_at": null,
                "items": [
                    {
                        "id": 2,
                        "quantity": 1,
                        "total": 5.44,
                        "price": 5.18,
                        "total_tax": 0.26,
                        "tax_rate": 5,
                        "variant": {
                            "id": 53,
                            "total": 144.78,
                            "price": 135.31,
                            "tax": 9.47,
                            "tax_rate": 7,
                            "attributes": [
                                {
                                    "name": "color",
                                    "value": "LightCyan"
                                },
                                {
                                    "name": "size",
                                    "value": "S"
                                }
                            ],
                            "origin": {
                                "code": "0729845433827"
                            },
                            "media_id": 436,
                            "views": [],
                            "created_at": "2017-09-27T10:10:43+00:00",
                            "updated_at": "2017-09-27T10:10:43+00:00"
                        },
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00",
                        "cancelled_at": null
                    }
                ],
                "customer": {
                    "id": 41,
                    "first_name": "John",
                    "last_name": "Doe",
                    "email": "john@example.com",
                    "phone": "12345 67890",
                    "addresses": [],
                    "default_address": {
                        "id": 124,
                        "default": true,
                        "company": null,
                        "first_name": "John",
                        "last_name": "Doe",
                        "city": "Anytown",
                        "street1": "123 Main St",
                        "street2": null,
                        "street3": null,
                        "zip": "12345",
                        "phone": "12345 67890",
                        "email": "John@example.org",
                        "province_code": "NW",
                        "country_code": "DE",
                        "vat_in": null,
                        "created_at": "2017-09-27T10:11:01+00:00",
                        "updated_at": "2017-09-27T10:11:01+00:00"
                    },
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "shipping_address": {
                    "id": 47,
                    "default": true,
                    "company": "MyComapny",
                    "first_name": "John",
                    "last_name": "Doe",
                    "city": "Anytown",
                    "street1": "123 Main St",
                    "street2": null,
                    "street3": null,
                    "zip": "12345",
                    "phone": "12345 67890",
                    "email": "John@example.org",
                    "province_code": "BW",
                    "country_code": "DE",
                    "vat_in": null,
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "billing_address": {
                    "id": 46,
                    "default": true,
                    "company": "MyCompany",
                    "first_name": "John",
                    "last_name": "Doe",
                    "city": "Anytown",
                    "street1": "123 Main St",
                    "street2": null,
                    "street3": null,
                    "zip": "12345",
                    "phone": "12345 67890",
                    "email": "John@example.org",
                    "province_code": "BY",
                    "country_code": "DE",
                    "vat_in": null,
                    "created_at": "2017-09-27T10:10:59+00:00",
                    "updated_at": "2017-09-27T10:10:59+00:00"
                },
                "whitelabel_address": null,
                "transactions": [
                    {
                        "amount": 9.46,
                        "title": "Invoice"
                    }
                ],
                "fulfillments": [
                    {
                        "id": 2,
                        "order_id": 2,
                        "tracking_number": "2229446017086",
                        "created_at": "2017-09-27T10:11:02+00:00",
                        "updated_at": "2017-09-27T10:11:02+00:00"
                    }
                ],
                "id_tags": [
                    {
                        "id": 5,
                        "order_item_id": 2,
                        "current_state": "Production stages combined (stitching)",
                        "created_at": "2017-09-27T10:10:59+00:00",
                        "updated_at": "2017-09-27T10:10:59+00:00"
                    }
                ]
            }
            ...
        ],
        "links": {
            "first": "https://api.smake.io/v2/orders?page=1",
            "last": "https://api.smake.io/v2/orders?page=2",
            "prev": null,
            "next": "https://api.smake.io/v2/orders?page=2"
        },
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 2,
            "path": "https://api.smake.io/v2/orders",
            "per_page": 25,
            "to": 25,
            "total": 28
        }
    }
    

    Returns a collection of created orders.

    Collection Filtering

    List orders for specified id(s)

    Get order

    Example Request

    GET /order/1 HTTP/1.1
    

    Example Response

    HTTP/1.1 200 OK
    
    {
        "id": 1,
        "is_test": true,
        "external_identifier": null,
        "project_name": "et",
        "state": "delivered",
        "customer_locale": "en",
        "currency": "EUR",
        "total": 87.76,
        "subtotal": 86.63,
        "total_tax": 1.13,
        "total_items_price": 82.98,
        "shipping_line": {
            "title": "Pickup",
            "price": 4.47,
            "total": 4.78,
            "tax": 0.31
        },
        "created_at": "2017-09-27T10:10:59+00:00",
        "updated_at": "2017-09-27T10:11:03+00:00",
        "cancelled_at": null,
        "items": [
            {
                "id": 1,
                "quantity": 4,
                "total": 82.98,
                "price": 20.54,
                "total_tax": 0.82,
                "tax_rate": 1,
                "variant": {
                    "id": 27,
                    "total": 186.58,
                    "price": 174.37,
                    "tax": 12.21,
                    "tax_rate": 7,
                    "attributes": [
                        {
                            "name": "color",
                            "value": "Khaki"
                        },
                        {
                            "name": "size",
                            "value": "XL"
                        }
                    ],
                    "origin": {
                        "code": "4490824589755"
                    },
                    "media_id": 251,
                    "views": [],
                    "created_at": "2017-09-27T10:10:38+00:00",
                    "updated_at": "2017-09-27T10:10:38+00:00"
                },
                "created_at": "2017-09-27T10:10:59+00:00",
                "updated_at": "2017-09-27T10:10:59+00:00",
                "cancelled_at": null
            }
        ],
        "customer": {
            "id": 40,
            "first_name": "John",
            "last_name": "Doe",
            "email": "John@example.com",
            "phone": "12345 67890",
            "addresses": [],
            "default_address": {
                "id": 122,
                "default": true,
                "company": null,
                "first_name": "John",
                "last_name": "Doe",
                "city": "Anytown",
                "street1": "123 Main St",
                "street2": null,
                "street3": null,
                "zip": "12345",
                "phone": "12345 67890",
                "email": "John@example.com",
                "province_code": "NW",
                "country_code": "DE",
                "vat_in": null,
                "created_at": "2017-09-27T10:11:01+00:00",
                "updated_at": "2017-09-27T10:11:01+00:00"
            },
            "created_at": "2017-09-27T10:10:59+00:00",
            "updated_at": "2017-09-27T10:10:59+00:00"
        },
        "shipping_address": {
            "id": 45,
            "default": true,
            "company": "MyCompany",
            "first_name": "John",
            "last_name": "Doe",
            "city": "Anytown",
            "street1": "123 Main St",
            "street2": null,
            "street3": null,
            "zip": "12345",
            "phone": "12345 67890",
            "email": "John@example.net",
            "province_code": "NW",
            "country_code": "DE",
            "vat_in": null,
            "created_at": "2017-09-27T10:10:59+00:00",
            "updated_at": "2017-09-27T10:10:59+00:00"
        },
        "billing_address": {
            "id": 44,
            "default": true,
            "company": "MyCompany",
            "first_name": "John",
            "last_name": "Doe",
            "city": "Anytown",
            "street1": "123 Main St",
            "street2": null,
            "street3": null,
            "zip": "12345",
            "phone": "12345 67890",
            "email": "John@example.net",
            "province_code": "NW",
            "country_code": "DE",
            "vat_in": null,
            "created_at": "2017-09-27T10:10:59+00:00",
            "updated_at": "2017-09-27T10:10:59+00:00"
        },
        "whitelabel_address": null,
        "transactions": [
            {
                "amount": 87.76,
                "title": "Invoice"
            }
        ],
        "fulfillments": [
            {
                "id": 1,
                "order_id": 1,
                "tracking_number": "2229446017085",
                "created_at": "2017-09-27T10:11:02+00:00",
                "updated_at": "2017-09-27T10:11:02+00:00"
            }
        ],
        "id_tags": [
            {
                "id": 1,
                "order_item_id": 1,
                "current_state": "Goods booked in",
                "created_at": "2017-09-27T10:10:59+00:00",
                "updated_at": "2017-09-27T10:10:59+00:00"
            },
            {
                "id": 2,
                "order_item_id": 1,
                "current_state": "Released to production stage",
                "created_at": "2017-09-27T10:10:59+00:00",
                "updated_at": "2017-09-27T10:10:59+00:00"
            },
            {
                "id": 3,
                "order_item_id": 1,
                "current_state": "Shipped",
                "created_at": "2017-09-27T10:10:59+00:00",
                "updated_at": "2017-09-27T10:10:59+00:00"
            },
            {
                "id": 4,
                "order_item_id": 1,
                "current_state": "Scanned on machine (DTG)",
                "created_at": "2017-09-27T10:10:59+00:00",
                "updated_at": "2017-09-27T10:10:59+00:00"
            }
        ]
    }
    

    Returns the order with id = x.