API Documentation
The Faslet API gives you direct access to provide data, without having to go through third party services.
Access to our APIs is available to customers on certain tiers. If you're in doubt, please reach out to your Faslet representative.
API Base Url
The base url for the API is
https://api.faslet.net/public/v1
If you'd like sandbox/staging environment to test against, please reach out to support, so we can create a test store.
Authorization
Include the custom header faslet-shopid set to your Faslet Shop ID.
Your API token can be found in the Faslet Partner Portal. This needs to be included as a Bearer token with the authorization header.
Endpoints
All formats, request and response are JSON. Be sure to include the application/json content header.
Example headers:
"Content-Type" "application/json",
"faslet-shopid": "MY_SHOP_ID",
"authorization": "Bearer MY_API_TOKEN"
POST /returns
https://api.faslet.net/public/v1/returns
Request Body
An Array of Product Info
Product Info
| Field | Required | Type | Description | 
|---|---|---|---|
| orderId | YES | string | The identifier of the order | 
| productId | YES | string | The identifier of the product. This should match the product id send to Faslet with the orders and the button | 
| sku | YES | string | The variant SKU | 
| returnDate | YES | string | ISO8601 Date Time | 
| returnReason | YES | string | The return reason value as described below | 
| returnReasonMessage | NO | string | A message for the return reason. This can be the message sent by the customer | 
| externalId | NO | string | The ID of the return in your system | 
Example Request
[{
        "orderId": "1234",
        "productId": "1234",
        "sku": "1234",
        "returnReason": "1",
        "returnDate": "2022-02-05T18:40:00.000Z",
        "externalId": "o-123"
}, {
        "orderId": "3456",
        "productId": "3456",
        "sku": "3456",
        "returnReason": "3",
        "returnDate": "2022-09-05T18:40:00.000Z",
        "externalId": "o-345"
}]
Return reasons
| Reason | Value | 
|---|---|
| Too big | 1 | 
| Too small | 2 | 
| Product is damaged | 3 | 
| Product isn’t as expected | 4 | 
| Wrong article/ size | 5 | 
| Color isn’t as expected | 6 | 
| Quality isn’t as expected | 7 | 
| Other reason | 8 | 
| Multiple sizes ordered | 9 | 
Response
StatusCodes
| Status | Description | 
|---|---|
| 202 | The request was accepted. | 
Body
| Field | Required | Type | 
|---|---|---|
| errors | YES | Array of Return Error | 
Return Error
| Field | Type | Description | 
|---|---|---|
| message | string | The error message | 
Example Response
{
    "errors": [
        {
            "message": "returnDate is invalid for order 1234"
        }
    ]
}
POST /orders
https://api.faslet.net/public/v1/orders
Request Body
An Order Event
Order Event
| Field | Required | Type | Description | 
|---|---|---|---|
| customerDataPackage | YES | string | The customer data package obtained from the faslet-orders script | 
| orderId | YES | string | The identifier of the order | 
| paymentStatus | YES | string | The payment status of the order | 
| lineItems | YES | array | Array of Line Items | 
Line Item
| Field | Required | Type | Description | 
|---|---|---|---|
| productId | YES | string | The identifier of the product | 
| title | YES | string | The title of the product | 
| variantId | YES | string | The identifier of the variant | 
| sku | YES | string | The SKU of the variant | 
| variant | YES | string | The variant description | 
| quantity | YES | number | The quantity ordered | 
| price | YES | number | The price of the item | 
Example Request
{
    "orderId": "1234",
    "paymentStatus": "paid",
    "lineItems": [{
        "productId": "1234",
        "title": "Test API Order",
        "variantId": "1234",
        "sku": "1234",
        "variant": "S",
        "quantity": 1,
        "price": 123.45
    }],
  "customerDataPackage": "yX2lkIjoibm8tdXNlci1kYXRhIiwiaGFzVXNlZFdpZGdldCI6ZmFsc2UsInBsYXRmb3JtIjoidW5rbm93biIsImV4cGVyaW1lbnRWYXJpYW50cyI6W119"
}
To obtain the customerDataPackage, include the faslet-orders script somewhere before the end of the checkout flow:
<script src="https://widget.faslet.net/faslet-orders.js"></script> 
<script>
  var fasletCustomerDataPackage = window._faslet_orders.getCustomerDataPackage(MY_SHOP_ID)
  /* Send fasletCustomerDataPackage to your backend to be used in the API request */
</script>
POST /size-specs
https://api.faslet.net/public/v1/size-specs/MY_BRAND
Request Parameters
| Field | Required | Type | Description | 
|---|---|---|---|
| brand | YES | string | Then name of the brand for this size specification | 
Request Body
An Array of Product Size Descriptors
Product Size Descriptor
| Field | Required | Type | Description | 
|---|---|---|---|
| productName | YES | string | The name or title of the product. | 
| productId | YES | string | The identifier of the product. This should match the product id send to Faslet with the orders and the button | 
| gender | YES | string | The gender of the product. Must be male, female or unisex | 
| productUrl | YES | string | The url of the product as found on the store | 
| sizeChartSpecifications | YES | string | An array of size specifications | 
Size Chart Specification
| Field | Required | Type | Description | 
|---|---|---|---|
| sizeLabel | YES | string | The size label of the variant. | 
| useDefaults | NO | boolean | Whether this variant should use default size charts as provided by Faslet. | 
| waist | NO | number | The minimum measurement of the waist for this size label. | 
| hips | NO | number | The minimum measurement of the hips for this size label. | 
| chest | NO | number | The minimum measurement of the chest for this size label. | 
| innerLeg | NO | number | The minimum measurement of the innerLeg for this size label. | 
| length | NO | number | The minimum measurement of the length for this size label. | 
| sleeve | NO | number | The minimum measurement of the sleeve for this size label. | 
| thigh | NO | number | The minimum measurement of the thigh for this size label. | 
| shoulder | NO | number | The minimum measurement of the shoulder for this size label. | 
| waistStretched | NO | number | The maximum measurement of the waist for this size label. | 
| hipsStretched | NO | number | The maximum measurement of the hips for this size label. | 
| chestStretched | NO | number | The maximum measurement of the chest for this size label. | 
If you choose not to use defaults, please provide as much of this information as possible in order to get the most accurate size charts. Our algorithms will process these and optimize them based on how much information is given.
Example Request
[{
  "productName": "Jacket",
  "productId": "11",
  "gender": "male",
  "productUrl": "https://mywebstore.com/en/jacket.html",
  "sizeChartSpecifications": [{
    "useDefaults": false,
    "waist": 60,
    "waistStretched": 70,
    "hips": 50,
    "hipsStretched": 56,
    "chest": 65,
    "sizeLabel": "S"
  }, {
    "waist": 63,
    "hips": 53,
    "chest": 68,
    "sizeLabel": "M"
  }, {
    "waist": 68,
    "hips": 58,
    "chest": 73,
    "sizeLabel": "XL",
    "useDefaults": false
  }]
}]
Response
StatusCodes
| Status | Description | 
|---|---|
| 201 | New size specifications were created. | 
| 200 | Existing size specifications were updated. | 
Body
| Field | Required | Type | 
|---|---|---|
| errors | NO | Array of Return Error. In the case of a 2xx response, with some (or all) size specifications skipped, a list of errors will be provided | 
| error | NO | A Return Error. In the case of a 4xx response, a single error will be returned and nothing will be processed | 
Return Error
| Field | Type | Description | 
|---|---|---|
| message | string | The error message | 
Example Response
{
    "errors": [
        {
            "message": "[Item 42] No Product URL, ignoring"
        },
        {
            "message": "[Item 76] No Product ID, ignoring"
        }
    ]
}
Errors in individual Size Chart Specifications will not prevent everything from processing. The error will list the index of the descriptor that failed. These will return a 2xx status code and can be safely retried after fixing the errors.
Errors in the Product Size Descriptors will prevent processing and will return a 4xx status code.POST /assistant/state/
https://api.faslet.net/public/v1/assistant/state/MY_BRAND
Request Parameters
| Field | Required | Type | Description | 
|---|---|---|---|
| brand | YES | string | Then name of the brand for this size specification | 
Query String Parameters
| Field | Required | Type | Description | 
|---|---|---|---|
| disableTracking | No | boolean | Set this to true if you want to disable all analytics. This will prevent any data from going into the Faslet Partner Portal, and will stop the system from being able to adjust automatically. | 
Request Body
| Field | Required | Type | Description | 
|---|---|---|---|
| productId | YES | string | The unique identifier for the product | 
| variants | YES | Array of Variant | List of product variants | 
| productName | NO | string | The name of the product | 
| productUrl | NO | string | The URL of the product | 
| productImage | NO | string | The URL of the product image | 
| userId1 | NO | string | The unique identifier for the user | 
| widgetVersion1 | NO | string | The version of the widget being used | 
| seenExperiments1 | NO | string | The experiments the user has seen | 
| experimentVariants1 | NO | string | The variants of the experiments the user has been exposed to | 
| profile1 | NO | Profile | The profile of the user | 
Variant
| Field | Required | Type | Description | 
|---|---|---|---|
| sizeLabel | YES | string | The label of the size for this variant | 
| available | YES | boolean | Indicates if the variant is available for purchase/in stock | 
| variantId | YES | string | The unique identifier for this variant | 
Example Requests
An initial request before getting user data from the assistant may look like this:
{
  "productId": "11",
  "variants": [{
    "sizeLabel": "S",
    "available": true,
    "variantId": "1234"
  }, {
    "sizeLabel": "M",
    "available": true,
    "variantId": "5678"
  }]
}
Subsequent requests after getting user data from the assistant may look like this:
{
  "productId": "11",
  "variants": [{
    "sizeLabel": "S",
    "available": true,
    "variantId": "1234"
  }, {
    "sizeLabel": "M",
    "available": true,
    "variantId": "5678"
  }],
  "userId": "1234",
  "widgetVersion": "v35.0.3",
  "seenExperiments": "exp1,exp2",
  "experimentVariants": "exp1_variant1,exp2_variant2",
  "profile": {
    "gender": "male",
    "height": 180,
    "weight": 85,
    "age": 29   
    ...
  }
}
Response
StatusCodes
| Status | Description | 
|---|---|
| 200 | The endpoint returned a state result | 
Body
| Field | Required | Type | Description | 
|---|---|---|---|
| state | YES | string | The state of the assistant. Can be hidden, default or result | 
| data | YES | object | When the state is result, the data contains the recommened size label as a field called result. This also contains a userId which should be used in the widget initialization | 
Example Response
When a product is not available:
{
    "state": "hidden",
    "data": {
        "userId" "123-456-789"
    }
}
When a product is available:
{
    "state": "default",
    "data": {
        "userId" "123-456-789"
    }
}
When a product is available and a result is available:
{
    "state": "result",
    "data": {
        "result": "M",
        "userId" "123-456-789"
    }
}
Help
In case of any questions, please don’t hesitate to contact us on support@faslet.me