NAV Navbar
http shell
  • Introduction
  • Authentication
  • Headers
  • Data types
  • Errors
  • Bruno options
  • Categories
  • Collections
  • Customers
  • Entities
  • Inventory
  • Products
  • Introduction

    Welcome to the Traede API! You can use our API to access Traede API endpoints.

    You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

    Suggested order of reading

    1. Start with "Authentication"
    2. Then see what headers are required under "Headers". Now you are ready to request
    3. A company in Traede is called an entity. Read about those in "Entities"
    4. First thing that should be done is products should be created. Read about those in "Products"
    5. Next, customer should be invited to buy from the B2B webshop. See how under "Customers"
    6. Now you are ready to create orders. Either by your self or by customers in the B2B webshop. Read more under "Orders"

    Authentication

    Traede uses OAuth2 for authorization to the API. It is not possible to interact with the API without a valid access token.

    Generate a token

    To get a token for the Traede API you must be added as a app in our app store. Contact ep@traede.com for more information.

    Requesting resources

    Traede expects for a authorization token to be included in all requests either as a header

    Authorization: Bearer 1234token

    or as a query string parameter

    GET https://api.traede.com/products?access_token=1234token

    Headers

    Header Required Description
    Content-Type true Must be application/json
    X-TraedeAppIdentifier true Must be set. Example could be TraedeEconomicApp/1.0 (http://traede.com/integration ; support@traede.com)

    Data types

    Common data types

    Type Description
    Date A given date in UTC timezone
    DateTime A given date and time in UTC timezone

    Errors

    The Traede API uses the following error codes:

    Error Code Meaning
    401 Unauthorized -- Your access token is wrong
    403 Forbidden -- The resource requested is hidden for administrators only
    404 Not Found -- The specified kitten could not be found
    405 Method Not Allowed -- You tried to access a kitten with an invalid method
    422 Validation error -- You need to change the data to the proper format
    429 Too Many Requests -- You're requesting too many kittens! Slow down!
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarially offline for maintanance. Please try again later.

    Bruno options

    Bruno is a library that adds query string parameters to use when fetching resources. It can be used to sort, filter, paginate collections of resources. It can also be used to fetch related resources. This will be a short introduction to Bruno's functionality. However, for a more complete view please refer to the official documentation.

    Bruno options are appended to a GET request as query string parameters.

    Key Format Explanation
    filter_groups Please refer to documentation for syntax
    limit 50 Return 50 entities per page
    includes ['variants', 'variants.prices'] Please include the related resources variants and variants.prices
    page 1 Give me the first 50 entities
    sort [{key: 'item_number', direction: 'ASC'}, {key: 'name', direction: 'DESC'}] Will sort by item_number ASC, then name DESC

    To see what related resources can be included refer to the "Related Resources" section under each entity. Notice that . (dot) denotes a nested resource. So, for instance for a Product has many Variants that can be included like GET https://api.traede.com/api/products?includes[]=variants. However, the Variant resource also has nested resources that can be loaded. We can include these for each Variant by adding the . (dot). So if we wanted to include the Prices attached to all the Variants we could do so like GET https://api.traede.com/api/products?includes[]=variants&includes[]=variants.prices

    Categories

    Get all categories

    GET https://api.traede.com/api/categories HTTP/1.1
    

    The above command will return JSON structured like this

    {  
       "total": 6,
       "categories": [  
          {  
             "id": 1,
             "brand_id": 1,
             "parent": null,
             "name": "Men",
             "created_at": "2017-04-13 09:21:07",
             "updated_at": "2017-04-13 09:21:07",
             "children": [  
                {  
                   "id": 2,
                   "brand_id": 1,
                   "parent": 1,
                   "name": "Shirts",
                   "created_at": "2017-04-13 09:21:16",
                   "updated_at": "2017-04-13 09:21:16"
                },
                {  
                   "id": 3,
                   "brand_id": 1,
                   "parent": 1,
                   "name": "Pants",
                   "created_at": "2017-04-13 09:21:22",
                   "updated_at": "2017-04-13 09:21:22"
                }
             ]
          },
          {  
             "id": 4,
             "brand_id": 1,
             "parent": null,
             "name": "Women",
             "created_at": "2017-04-13 09:21:10",
             "updated_at": "2017-04-13 09:21:10",
             "children": [  
                {  
                   "id": 5,
                   "brand_id": 1,
                   "parent": 4,
                   "name": "Dresses",
                   "created_at": "2017-04-13 09:21:43",
                   "updated_at": "2017-04-13 09:21:43"
                },
                {  
                   "id": 6,
                   "brand_id": 1,
                   "parent": 4,
                   "name": "Skirts",
                   "created_at": "2017-04-13 09:21:47",
                   "updated_at": "2017-04-13 09:21:47"
                }
             ]
          }
       ]
    }
    

    This endpoint will return all the categories of the company.

    HTTP Request

    GET https://api.traede.com/api/categories

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    Response

    The endpoint will return an array of categories and a total of how many there are.

    Key Type Default Description
    total integer The number of categories in the company's database
    categories array[Category] [] An array of category objects

    Get a single category

    GET https://api.traede.com/api/categories/1 HTTP/1.1
    

    The above command will return JSON structured like this

    {
        "category": {
             "id": 1,
             "brand_id": 1,
             "parent": null,
             "name": "Men",
             "created_at": "2017-04-13 09:21:07",
             "updated_at": "2017-04-13 09:21:07",
             "children": [  
                {  
                   "id": 2,
                   "brand_id": 1,
                   "parent": 1,
                   "name": "Shirts",
                   "created_at": "2017-04-13 09:21:16",
                   "updated_at": "2017-04-13 09:21:16"
                },
                {  
                   "id": 3,
                   "brand_id": 1,
                   "parent": 1,
                   "name": "Pants",
                   "created_at": "2017-04-13 09:21:22",
                   "updated_at": "2017-04-13 09:21:22"
                }
             ]
        }
    }
    

    This endpoint gets a single category

    HTTP Request

    GET https://api.traede.com/api/categories/{categoryId}

    URL Parameters

    Key Type Default Description
    categoryId Category ID The ID of the category to fetch

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    Response

    The endpoint will return a single category object

    Key Type Default Description
    id integer The id of the category
    brand_id Entity ID The id of the brand owning the category
    parent Category ID null A parent category this category belongs to. If there is a parent the category is a subcategory. If no parent, the category is a parent category.
    name string The name of the category, e.g. Men, Pants, or similar
    created_at string DateTime When was the category created?
    updated_at string DateTime When was the category last updated?

    Create a parent category

    POST https://api.traede.com/api/categories HTTP/1.1
    Content-Type: application/json
    
    {
        "category": {
            "name": "A category"
        }
    }
    

    The above command will give a JSON structured like this

    HTTP/1.1 201 Created
    Content-Type: application/json
    
    {
        "id": 1,
        "brand_id": 1,
        "parent": null,
        "name": "A category",
        "created_at": "2017-03-23 15:25:26",
        "updated_at": "2017-03-23 15:53:44"
    }
    

    This endpoint creates a category

    HTTP Request

    POST https://api.traede.com/api/categories

    HTTP Parameters

    Key Type Default Description
    name string The name of the category, e.g. Men, Women, or similar

    Response

    The endpoint will return 201 Created on success.

    The response will be a single category object

    Create a subcategory

    POST https://api.traede.com/api/categories/1/categories HTTP/1.1
    Content-Type: application/json
    
    {
        "category": {
            "name": "A subcategory"
        }
    }
    

    The above command will give a JSON structured like this

    HTTP/1.1 201 Created
    Content-Type: application/json
    
    {
        "id": 1,
        "brand_id": 1,
        "parent": 1,
        "name": "A subcategory",
        "created_at": "2017-03-23 15:25:26",
        "updated_at": "2017-03-23 15:53:44"
    }
    

    This endpoint creates a category

    HTTP Request

    POST https://api.traede.com/api/categories/{parentCategoryId}/categories

    URL Parameters

    Key Type Default Description
    parentCategoryId Category ID The ID of the parent category

    HTTP Parameters

    Key Type Default Description
    name string The name of the category, e.g. Men, Women, or similar

    Response

    The endpoint will return 201 Created on success.

    The response will be a single category object

    Update a category

    PUT https://api.traede.com/api/categories/1 HTTP/1.1
    Content-Type: application/json
    
    {
        "category": {
            "name": "A new name"
        }
    }
    

    The above command will return JSON structured like this

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "id": 1,
        "brand_id": 1,
        "parent": 1,
        "name": "A new name",
        "created_at": "2017-03-23 15:25:26",
        "updated_at": "2017-03-23 15:53:44"
    }
    

    This endpoint updates a category

    HTTP Request

    PUT https://api.traede.com/api/categories/{categoryId}

    URL Parameters

    Key Type Default Description
    categoryId Category ID The ID of the category to update

    HTTP Parameters

    Key Type Default Description
    name string The name of the category, e.g. Men, Women, or similar

    Response

    The endpoint will return 200 OK on success.

    The response will be a single collection object

    Delete a category

    DELETE https://api.traede.com/api/categories/1 HTTP/1.1
    

    The above command will return JSON structured like this

    HTTP/1.1 204 No Content
    Content-Type: application/json
    

    This endpoint deletes a category. If the category is a parent category all of its subcategories will be deleted as well. All products attached to the category will not be deleted but will be disassociated with the categories prior to deletion.

    HTTP Request

    DELETE https://api.traede.com/api/categories/{categoryId}

    URL Parameters

    Key Type Default Description
    categoryId Category ID The ID of the category to delete

    Response

    The endpoint will return 204 No Content on success.

    The following related resources can be included for categories using Bruno.

    Key Type Description
    children Category The subcategories of the category
    products Product The products attached to the collection

    Errors

    The following are errors that occur when trying to create or update a category

    Error Code Meaning
    40001 A category already exists with this name + parent combination

    Collections

    Get all collections

    GET https://api.traede.com/api/collections HTTP/1.1
    

    The above command will return JSON structured like this

    {  
       "collections": [  
          {  
             "id": 1,
             "brand_id": 1,
             "active": true,
             "title": "asdasdas",
             "visibility": "customers_custom",
             "allowed_customers": [  
                1,
                2
             ],
             "created_at": "2017-03-23 15:25:26",
             "updated_at": "2017-03-23 15:53:44"
          }
       ],
       "totals": 1
    }
    

    This endpoint will return all the collections of the company.

    HTTP Request

    GET https://api.traede.com/api/collections

    HTTP Query Parameters

    This endpoint has Bruno options enabled.

    Response

    The endpoint will return an array of collections and a total of how many there are.

    Key Type Default Description
    total integer The number of collections in the company's database
    collections array[Collections] [] An array of collection objects

    Get a single collection

    GET https://api.traede.com/api/collections/1 HTTP/1.1
    

    The above command will return JSON structured like this

    {
        "collection": {
            "id": 1,
            "brand_id": 1,
            "active": true,
            "title": "asdasdas",
            "visibility": "customers_custom",
            "allowed_customers": [  
                1,
                2
            ],
            "created_at": "2017-03-23 15:25:26",
            "updated_at": "2017-03-23 15:53:44"
        }
    }
    

    This endpoint gets a single collection

    HTTP Request

    GET https://api.traede.com/api/collections/{collectionId}

    URL Parameters

    Key Type Default Description
    collectionId Collection ID The ID of the collection to fetch

    HTTP Query Parameters

    This endpoint has Bruno options enabled.

    Response

    The endpoint will return a single collection object

    Key Type Default Description
    id integer The id of the collection
    brand_id Entity ID The id of the brand owning the collection
    active boolean true
    title string The name of the collection, e.g. Summer/Winter 2017 or similar
    visibility Collection visibility Who should be allowed to view products of the collection
    allowed_customers array[Customer ID] [] If visibility is customers_custom this array should contain IDs of the customers that are allowed to view the products
    created_at string DateTime When was the collection created?
    updated_at string DateTime When was the collection last updated?

    Create a collection

    POST https://api.traede.com/api/customers HTTP/1.1
    Content-Type: application/json
    
    {
        "collection": {
            "active": true,
            "title": "asdasdas",
            "visibility": "own_entity"
        }
    }
    

    The above command will give a JSON structured like this

    HTTP/1.1 201 Created
    Content-Type: application/json
    
    {
        "id": 1,
        "brand_id": 1,
        "active": true,
        "title": "asdasdas",
        "visibility": "own_entity",
        "allowed_customers": [],
        "created_at": "2017-03-23 15:25:26",
        "updated_at": "2017-03-23 15:53:44"
    }
    

    This endpoint creates a collection

    HTTP Request

    POST https://api.traede.com/api/collections

    HTTP Parameters

    Key Type Default Description
    active boolean true
    title string The name of the collection, e.g. Summer/Winter 2017 or similar
    visibility Collection visibility Who should be allowed to view products of the collection
    allowed_customers array[Customer ID] [] If visibility is customers_custom this array should contain IDs of the customers that are allowed to view the products

    Response

    The endpoint will return 201 Created on success.

    The response will be a single collection object

    Update a collection

    PUT https://api.traede.com/api/collections/1 HTTP/1.1
    Content-Type: application/json
    
    {
        "collection": {
            "active": true,
            "title": "asdasdas",
            "visibility": "own_entity"
        }
    }
    

    The above command will return JSON structured like this

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "id": 1,
        "brand_id": 1,
        "active": true,
        "title": "asdasdas",
        "visibility": "own_entity",
        "allowed_customers": [],
        "created_at": "2017-03-23 15:25:26",
        "updated_at": "2017-03-23 15:53:44"
    }
    

    This endpoint updates a collection

    HTTP Request

    PUT https://api.traede.com/api/collections/{collectionId}

    URL Parameters

    Key Type Default Description
    collectionId Collection ID The ID of the collection to update

    HTTP Parameters

    Key Type Default Description
    active boolean true
    title string The name of the collection, e.g. Summer/Winter 2017 or similar
    visibility Collection visibility Who should be allowed to view products of the collection
    allowed_customers array[Customer ID] [] If visibility is customers_custom this array should contain IDs of the customers that are allowed to view the products

    Response

    The endpoint will return 200 OK on success.

    The response will be a single collection object

    Collection visibility

    Collection visibility determines who can view the collection's products in the webshop. It should be noted that the owning company itself can always view the products in the webshop.

    Visibility Description
    customers All customers can view the products in the webshop
    own_entity Customers cannot view the products in the webshop
    customers_custom All customers with an ID in the allowed_customers property can view the products in the webshop

    The following related resources can be included for collections using Bruno.

    Key Type Description
    products Product The products attached to the collection

    Customers

    A customer is the connection between a brand entity and a shop entity. Remember from Entities that an Entity in Traede is a legal entity, e.g. a company. When a customer connection is created between a brand entity and a shop entity, any user that is connected to the shop entity can now access the brand's webshop from their account.

    The customer object itself will contain the settings of the agreement between the buyer (shop) and seller (brand). For instance how much VAT should be added to orders? What currencies is the shop allowed to buy in? Is there a special billing email that should receive all billing related emails?

    Notice that the customer relationship is many-to-many in both directions. This means just as well as a brand can sell to many shops, a shop can buy from many brands. So every time a shop entity receives an invite to buy from a brand they will be able to do so from their existing account.

    Get all customers

    GET https://api.traede.com/api/customers HTTP/1.1
    

    The above command will return JSON structured like this

    {
        "total": 1,
        "customers": [
            {
                "id": 1,
                "customer_number": 1,
                "brand_id": 1,
                "shop_id": 2,
                "agent_id": null,
                "active": true,
                "name": "Customer #1",
                "billing_email": "invoices@customer.com",
                "reminder_charge": 99.00,
                "interest_rate": 2.192,
                "credit_type": null,
                "credit_modifier": null,
                "vat": null,
                "allowed_currencies": [
                    {
                        "currency": "AUD",
                        "amount": null
                    },
                    {
                        "currency": "GBP",
                        "amount": 25000
                    }
                ],
                "addresses": [  
                    {  
                        "id": 12329,
                        "entity_id": 10456,
                        "primary": true,
                        "name": "Primary Address",
                        "vat": null,
                        "address": "Hejrevej 33",
                        "zip": "2400",
                        "city": "Copenhagen N",
                        "region": null,
                        "country": "DK",
                        "telephone": null,
                        "email": null,
                        "website": null,
                        "created_at": "2017-03-23 13:33:01",
                        "updated_at": "2017-03-23 13:33:01"
                    }
                ],
                "users": [
                    {  
                        "id": 8864,
                        "user_type": "user",
                        "entity_id": 10456,
                        "active": true,
                        "virgin": false,
                        "email": "demo.emailtest@traede.com",
                        "firstname": "Email Test",
                        "lastname": null,
                        "telephone": null,
                        "title": null,
                        "picture": null,
                        "currency": "USD",
                        "locale": "en",
                        "created_at": "2017-02-22 08:13:12",
                        "updated_at": "2017-02-22 08:14:02"
                    }
                ],
                "created_at": "2015-06-16 11:45:59",
                "updated_at": "2015-06-16 11:45:59"
            }
        ]
    }
    

    This endpoint will return all the customers of the company.

    HTTP Request

    GET https://api.traede.com/api/customers

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    Response

    The endpoint will an array customers and a total of how many there are.

    Key Type Default Description
    total integer The number of customers in the company's database
    customers array[Customers] [] An array of customer objects

    Get a single customer

    GET https://api.traede.com/api/customers/1 HTTP/1.1
    

    The above command will return JSON structured like this

    {
        "customer": {
            "id": 1,
            "customer_number": 1,
            "brand_id": 1,
            "shop_id": 2,
            "agent_id": null,
            "active": true,
            "name": "Customer #1",
            "billing_email": "invoices@customer.com",
            "reminder_charge": 99.00,
            "interest_rate": 2.192,
            "credit_type": null,
            "credit_modifier": null,
            "vat": null,
            "allowed_currencies": [
                {
                    "currency": "AUD",
                    "amount": null
                },
                {
                    "currency": "GBP",
                    "amount": 25000
                }
            ],
            "addresses": [  
                {  
                    "id": 12329,
                    "entity_id": 10456,
                    "primary": true,
                    "name": "Primary Address",
                    "vat": null,
                    "address": "Hejrevej 33",
                    "zip": "2400",
                    "city": "Copenhagen N",
                    "region": null,
                    "country": "DK",
                    "telephone": null,
                    "email": null,
                    "website": null,
                    "created_at": "2017-03-23 13:33:01",
                    "updated_at": "2017-03-23 13:33:01"
                }
            ],
            "users": [
                {  
                    "id": 8864,
                    "user_type": "user",
                    "entity_id": 10456,
                    "active": true,
                    "virgin": false,
                    "email": "demo.emailtest@traede.com",
                    "firstname": "Email Test",
                    "lastname": null,
                    "telephone": null,
                    "title": null,
                    "picture": null,
                    "currency": "USD",
                    "locale": "en",
                    "created_at": "2017-02-22 08:13:12",
                    "updated_at": "2017-02-22 08:14:02"
                }
            ],
            "created_at": "2015-06-16 11:45:59",
            "updated_at": "2015-06-16 11:45:59"
        }
    }
    

    This endpoint gets a single customer

    HTTP Request

    GET https://api.traede.com/api/customers/{customerId}

    URL Parameters

    Key Type Default Description
    customerId Customer ID The ID of the customer to fetch

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    Response

    The endpoint will return a single customer object

    Key Type Default Description
    id integer The id of the customer
    name string Name of the customer's company
    billing_email Billing email null A billing e-mail for the customer
    customer_number integer The number of the customer. This is unique.
    agent_id User ID null The id of an associated agent
    brand_id Entity ID The id of the brand owning the customer
    shop_id Entity ID The id of the entity associated with the customer
    active boolean true
    reminder_charge float null A flat fee to pay for unpaid invoices that are past due date
    interest_rate float null An interest rate to be applied to unpaid invoices that are past due date
    vat float 0.00 VAT rate associated with customer
    allowed_currencies array[Allowed currencies] [] An array of currency rules
    addresses array[Addresses] [] An array of addresses
    users array[Users] [] An array of users
    credit_type Credit type null Credit type given to the customer
    credit_modifier Credit modifier null Modifier of the credit type
    created_at string DateTime When was the collection created?
    updated_at string DateTime When was the collection last updated?

    Create a customer

    POST https://api.traede.com/api/customers HTTP/1.1
    Content-Type: application/json
    
    {
        "customer": {
            "customer_number": 1,
            "name": "Customer #1",
            "billing_email": "invoices@customer.com",
            "reminder_charge": 99.00,
            "interest_rate": 2.192,
            "allowed_currencies": [
                {
                    "currency": "AUD",
                    "amount": null
                },
                {
                    "currency": "GBP",
                    "amount": 25000
                }
            ],
            "addresses": [  
                {  
                    "name": "Primary Address",
                    "address": "Hejrevej 33",
                    "zip": "2400",
                    "city": "Copenhagen N",
                    "country": "DK"
                }
            ],
            "invite_user": {
                "email": "demo.emailtest@traede.com",
                "firstname": "Email Test"
            }
        },
        "send_customer_email": true
    }
    

    The above command will give a JSON structured like this

    HTTP/1.1 201 Created
    Content-Type: application/json
    
    {
        "id": 1,
        "customer_number": 1,
        "brand_id": 1,
        "shop_id": 2,
        "agent_id": null,
        "active": true,
        "name": "Customer #1",
        "billing_email": "invoices@customer.com",
        "reminder_charge": 99.00,
        "interest_rate": 2.192,
        "credit_type": null,
        "credit_modifier": null,
        "vat": null,
        "allowed_currencies": [
            {
                "currency": "AUD",
                "amount": null
            },
            {
                "currency": "GBP",
                "amount": 25000
            }
        ],
        "addresses": [  
            {  
                "id": 12329,
                "entity_id": 10456,
                "primary": true,
                "name": "Primary Address",
                "vat": null,
                "address": "Hejrevej 33",
                "zip": "2400",
                "city": "Copenhagen N",
                "region": null,
                "country": "DK",
                "telephone": null,
                "email": null,
                "website": null,
                "created_at": "2017-03-23 13:33:01",
                "updated_at": "2017-03-23 13:33:01"
            }
        ],
        "users": [
            {  
                "id": 8864,
                "user_type": "user",
                "entity_id": 10456,
                "active": true,
                "virgin": false,
                "email": "demo.emailtest@traede.com",
                "firstname": "Email Test",
                "lastname": null,
                "telephone": null,
                "title": null,
                "picture": null,
                "currency": "USD",
                "locale": "en",
                "created_at": "2017-02-22 08:13:12",
                "updated_at": "2017-02-22 08:14:02"
            }
        ],
        "created_at": "2015-06-16 11:45:59",
        "updated_at": "2015-06-16 11:45:59"
    }
    

    This endpoint creates a customer

    HTTP Request

    POST https://api.traede.com/api/customers

    HTTP Parameters

    Key Type Default Description
    customer.name string The name of the customer (company name).
    customer.customer_number integer The number of the customer. Must be unique.
    customer.billing_email Billing email null The billing e-mail of the customer.
    customer.agent_id User ID null The id of an associated agent
    customer.active boolean true
    customer.reminder_charge float null A flat fee to pay for unpaid invoices that are past due date
    customer.interest_rate float null An interest rate to be applied to unpaid invoices that are past due date
    customer.vat float 0.00 VAT rate associated with customer
    customer.allowed_currencies array[Allowed currencies] [] An array of currency rules
    customer.addresses array[Addresses] [] An array of addresses
    customer.invite_user object[Invite user] null If given, will create a user the parameters of the object. Note an invitation is only send if send_customer_email is true
    customer.credit_type Credit type null Credit type given to the customer
    customer.credit_modifier Credit modifier null Modifier of the credit type
    send_customer_email boolean false Should an invitation be send to the invite_user email? The invitation will invite them to login into Traede to put orders with the company.

    Invite User

    Key Type Default Description
    firstname string The first name of the user
    email string The e-mail of the user

    Response

    The endpoint will return 201 Created on success.

    The response will be a single customer object

    Update a customer

    PUT https://api.traede.com/api/customers/1 HTTP/1.1
    Content-Type: application/json
    
    {
        "customer": {
            "customer_number": 1,
            "name": "Customer #1",
            "billing_email": "invoices@customer.com",
            "reminder_charge": 99.00,
            "interest_rate": 2.192,
            "allowed_currencies": [
                {
                    "currency": "AUD",
                    "amount": null
                },
                {
                    "currency": "GBP",
                    "amount": 25000
                }
            ]
        }
    }
    

    The above command will return JSON structured like this

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "id": 1,
        "customer_number": 1,
        "brand_id": 1,
        "shop_id": 2,
        "agent_id": null,
        "active": true,
        "name": "Customer #1",
        "billing_email": "invoices@customer.com",
        "reminder_charge": 99.00,
        "interest_rate": 2.192,
        "credit_type": null,
        "credit_modifier": null,
        "vat": null,
        "allowed_currencies": [
            {
                "currency": "AUD",
                "amount": null
            },
            {
                "currency": "GBP",
                "amount": 25000
            }
        ],
        "addresses": [  
            {  
                "id": 12329,
                "entity_id": 10456,
                "primary": true,
                "name": "Primary Address",
                "vat": null,
                "address": "Hejrevej 33",
                "zip": "2400",
                "city": "Copenhagen N",
                "region": null,
                "country": "DK",
                "telephone": null,
                "email": null,
                "website": null,
                "created_at": "2017-03-23 13:33:01",
                "updated_at": "2017-03-23 13:33:01"
            }
        ],
        "users": [
            {  
                "id": 8864,
                "user_type": "user",
                "entity_id": 10456,
                "active": true,
                "virgin": false,
                "email": "demo.emailtest@traede.com",
                "firstname": "Email Test",
                "lastname": null,
                "telephone": null,
                "title": null,
                "picture": null,
                "currency": "USD",
                "locale": "en",
                "created_at": "2017-02-22 08:13:12",
                "updated_at": "2017-02-22 08:14:02"
            }
        ],
        "created_at": "2015-06-16 11:45:59",
        "updated_at": "2015-06-16 11:45:59"
    }
    

    This endpoint updates a customer

    HTTP Request

    PUT https://api.traede.com/api/customers/{customerId}

    URL Parameters

    Key Type Default Description
    customerId Customer ID The ID of the customer to update

    HTTP Parameters

    Key Type Default Description
    customer.name string The name of the customer (company name).
    customer.customer_number integer The number of the customer. Must be unique.
    customer.billing_email Billing email null The billing e-mail of the customer.
    customer.agent_id User ID null The id of an associated agent
    customer.active boolean true
    customer.reminder_charge float null A flat fee to pay for unpaid invoices that are past due date
    customer.interest_rate float null An interest rate to be applied to unpaid invoices that are past due date
    customer.vat float 0.00 VAT rate associated with customer
    customer.allowed_currencies array[Allowed currencies] [] An array of currency rules
    customer.credit_type Credit type null Credit type given to the customer
    customer.credit_modifier Credit modifier null Modifier of the credit type

    Response

    The endpoint will return 200 OK on success.

    The response will be a single customer object

    Billing email

    Whenever a order is created, cancelled, invoiced or similar all notifications will be sent to the billing email if is given. This is addition to the e-mails that are sent to the user.

    Allowed currencies

    The allowed currencies array determines in what currencies a customer can buy.

    1. If the array is empty the customer can buy in all currencies
    2. If the array is not empty then the customer can only buy in the currencies of the array
    3. If amount is not null then the customer has to purchase for at least that amount
    4. If amount is null then there is no minimum amount in that currency

    Each object in the array should follow the description below

    Key Type Default Description
    currency string The currency
    amount float null The minimum amount

    Credit type

    The payment terms of customers. This is only valid when talking invoices, however it will also be sent to relevant 3rd party integrations such as e-conomic.

    Key Type Default Description
    credit_type string The type of credit (see below)
    credit_modifier mixed null The modifier of the credit type (see below)
    credit_type credit_modifer Example Description
    net days credit_modifier: 30 30 days net
    invoice_month days credit_modifier: 30 Should be paid at the end of the month + 30 days
    paid_cash contra account credit_modifier: "1010" Paid in cash and booked in account 1010 (sales w/ VAT)
    prepaid null Has already been paid

    Errors

    The following are errors that occur when trying to create or update a customer

    Error Code Meaning
    30002 The customer number already exists
    30003 The email that you try to invite belongs to another brand in Traede and can therefore not be added as a customer
    30004 The email that you try to invite already belongs to one of your customers

    Entities

    An entity in Traede is a company. In Traede brands have a webshop where they can sell products to their B2B customers (retailers, distributors etc.). An entity has a property entity_type. This determines what kind of company it is.

    entity_type Description
    brand A brand is a company that produces physical goods, like t-shirts. In Traede a brand will create products, collections, prices etc. to create a B2B webshop. To invite retailers, distributors etc. to buy from that webshop the brand will create them in Traede as a customer.
    shop A shop entity is a company that exists in Traede to buy from retailers. These are retailers, distributors and so forth. A shop will not create products but will through and invite browse the brands' products and make orders.

    An entity, whether or not it is a brand or a shop can have multiple users and multiple adresses. For instance a company might have headquarters at one address whilst the warehouse at another. This makes it easy when purchasing to select an invoice address and a delivery address.

    Inventory

    Below are given an overview of different stock types and what they mean.

    Type Color Description
    stock green This stock type describes the variants that are in stock, ready to be delivered.
    remote blue These are variants in stock, but they are in a remote facility so expect longer delivery time.
    underway orange These are variants on the way in from the production facilities
    discontinued red These are variants that are on the way out of the sortment, however there are a few left.

    Products

    Products is a core concept of Traede. To understand product imagine you were producing t-shirt. Any given model of a t-shirt is a product. But every t-shirt comes in different variants. What defines a variant can be different from product to product. For instance if you are selling a t-shirt it might be that every variant comes in different sizes and colors. If you are selling phones every model might come with different sizes of memory, screen size etc.

    The relationship between different product entities can be graphically diagrammed like so.

    A product can belong to one collection and one subbrand. It can also belong to many categories and many tags.

    Every product has one or many variants. And every variant has one or many inventory entries. So imagine Product A has two variants: Size:M and Size:XL. Size:M has 10 in stock and Size:XL has 20 in stock. So each have an inventory entry to define how much is in stock per variant. Consider the examples below.

    T-shirt #1 (item number: 1234)

    Size Color SKU
    M Black 1234-b-m
    L Black 1234-b-l
    XL Black 1234-b-xl
    M White 1234-w-m
    L White 1234-w-l

    Awesome table (item number: 1234)

    Size (diameter)
    Ø50cm
    Ø60cm
    Ø70cm

    Get all products

    GET https://api.traede.com/api/products HTTP/1.1
    

    The above command will return JSON structured like this

    {
        "total": 1,
        "products": [
            {
                "id": 1,
                "brand_id": 1,
                "subbrand_id": 1,
                "collection_id": 1,
                "item_number": "awesome-tshirt",
                "name": "Awesome T-shirt",
                "description": "<p>Super awesome t-shirt made of 100% cutton.</p>",
                "image": "products\/2\/r5r7cam6l5kzhis2j8oi",
                "images": [  
                    "products\/2\/r5r7cam6l5kzhis2j8oi",
                    "products\/2\/dmfqjcz6zgpwoyb5u47b"
                ],
                "active": true,
                "colli": null,
                "attributes": [  
                    "Color",
                    "Size"
                ],
                "created_at": "2015-06-16 11:46:00",
                "updated_at": "2015-06-16 11:46:00",
                "variants":[  
                    {  
                        "id": 1,
                        "entity_id": 1,
                        "product_id": 1,
                        "sku": "awesome-tshirt-b-s",
                        "picture": null,
                        "ean": 83023934,
                        "created_at": "2015-06-16 11:46:00",
                        "updated_at": "2015-06-16 11:46:00",
                        "attributes": {  
                            "Color": "Black",
                            "Size": "Small"
                        },
                        "prices": {  
                            "EUR": {  
                                "sales_price": "100",
                                "rec_sales_price": "300",
                                "offer_price": null
                            },
                            "DKK": {  
                                "sales_price": "300",
                                "rec_sales_price": "800",
                                "offer_price": null
                            }
                        },
                        "inventory": {  
                            "stock": {  
                                "id": 1,
                                "product_variant_id": 1,
                                "quantity": 100,
                                "stock_type": "stock",
                                "delivery": "1992-08-18",
                                "created_at": "2015-06-16 11:46:00",
                                "updated_at": "2015-06-16 11:46:00",
                                "entity_id": 1
                            },
                            "discontinued": {  
                                "id": 2,
                                "product_variant_id": 1,
                                "quantity": 200,
                                "stock_type": "discontinued",
                                "delivery": "2012-09-27",
                                "created_at": "2015-06-16 11:46:00",
                                "updated_at": "2015-06-16 11:46:00",
                                "entity_id": 1
                            }
                        }
                    },
                    {  
                        "id": 1,
                        "entity_id": 1,
                        "product_id": 1,
                        "sku": "awesome-tshirt-b-m",
                        "ean": 83023934,
                        "created_at": "2015-06-16 11:46:00",
                        "updated_at": "2015-06-16 11:46:00",
                        "attributes": {  
                            "Color": "Black",
                            "Size": "Medium"
                        },
                        "prices": {  
                            "EUR": {  
                                "sales_price": "100",
                                "rec_sales_price": "300",
                                "offer_price": null
                            },
                            "DKK": {  
                                "sales_price": "300",
                                "rec_sales_price": "800",
                                "offer_price": null
                            }
                        },
                        "inventory": {  
                            "stock": {  
                                "id": 1,
                                "product_variant_id": 1,
                                "quantity": 100,
                                "stock_type": "stock",
                                "delivery": "1992-08-18",
                                "created_at": "2015-06-16 11:46:00",
                                "updated_at": "2015-06-16 11:46:00",
                                "entity_id": 1
                            },
                            "discontinued": {  
                                "id": 2,
                                "product_variant_id": 1,
                                "quantity": 200,
                                "stock_type": "discontinued",
                                "delivery": "2012-09-27",
                                "created_at": "2015-06-16 11:46:00",
                                "updated_at": "2015-06-16 11:46:00",
                                "entity_id": 1
                            }
                        }
                    }
                ]
            }
        ]
    }
    

    This endpoint will return all the products of the company.

    HTTP Request

    GET https://api.traede.com/api/products

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    Response

    The endpoint will an array products and a total of how many there are.

    Key Type Default Description
    total integer The number of products in the company's database
    products array[Product] [] An array of product objects

    Get a single product

    GET https://api.traede.com/api/products/1 HTTP/1.1
    

    The above command will return JSON structured like this

    {
        "product": {
            "id": 1,
            "brand_id": 1,
            "subbrand_id": 1,
            "collection_id": 1,
            "item_number": "awesome-tshirt",
            "name": "Awesome T-shirt",
            "description": "<p>Super awesome t-shirt made of 100% cutton.</p>",
            "image": "products\/2\/r5r7cam6l5kzhis2j8oi",
            "images": [  
                "products\/2\/r5r7cam6l5kzhis2j8oi",
                "products\/2\/dmfqjcz6zgpwoyb5u47b"
            ],
            "active": true,
            "colli": null,
            "attributes": [  
                "Color",
                "Size"
            ],
            "created_at": "2015-06-16 11:46:00",
            "updated_at": "2015-06-16 11:46:00",
            "variants":[  
                {  
                    "id": 1,
                    "entity_id": 1,
                    "product_id": 1,
                    "sku": "awesome-tshirt-b-s",
                    "picture": null,
                    "ean": 83023934,
                    "created_at": "2015-06-16 11:46:00",
                    "updated_at": "2015-06-16 11:46:00",
                    "attributes": {  
                        "Color": "Black",
                        "Size": "Small"
                    },
                    "prices": {  
                        "EUR": {  
                            "sales_price": "100",
                            "rec_sales_price": "300",
                            "offer_price": null
                        },
                        "DKK": {  
                            "sales_price": "300",
                            "rec_sales_price": "800",
                            "offer_price": null
                        }
                    },
                    "inventory": {  
                        "stock": {  
                            "id": 1,
                            "product_variant_id": 1,
                            "quantity": 100,
                            "stock_type": "stock",
                            "delivery": "1992-08-18",
                            "created_at": "2015-06-16 11:46:00",
                            "updated_at": "2015-06-16 11:46:00",
                            "entity_id": 1
                        },
                        "discontinued": {  
                            "id": 2,
                            "product_variant_id": 1,
                            "quantity": 200,
                            "stock_type": "discontinued",
                            "delivery": "2012-09-27",
                            "created_at": "2015-06-16 11:46:00",
                            "updated_at": "2015-06-16 11:46:00",
                            "entity_id": 1
                        }
                    }
                },
                {  
                    "id": 1,
                    "entity_id": 1,
                    "product_id": 1,
                    "sku": "awesome-tshirt-b-m",
                    "ean": 83023934,
                    "created_at": "2015-06-16 11:46:00",
                    "updated_at": "2015-06-16 11:46:00",
                    "attributes": {  
                        "Color": "Black",
                        "Size": "Medium"
                    },
                    "prices": {  
                        "EUR": {
                            "sales_price": "100",
                            "rec_sales_price": "300",
                            "offer_price": null
                        },
                        "DKK": {
                            "sales_price": "300",
                            "rec_sales_price": "800",
                            "offer_price": null
                        }
                    },
                    "inventory": {  
                        "stock": {  
                            "id": 1,
                            "product_variant_id": 1,
                            "quantity": 100,
                            "stock_type": "stock",
                            "delivery": "1992-08-18",
                            "created_at": "2015-06-16 11:46:00",
                            "updated_at": "2015-06-16 11:46:00",
                            "entity_id": 1
                        },
                        "discontinued": {  
                            "id": 2,
                            "product_variant_id": 1,
                            "quantity": 200,
                            "stock_type": "discontinued",
                            "delivery": "2012-09-27",
                            "created_at": "2015-06-16 11:46:00",
                            "updated_at": "2015-06-16 11:46:00",
                            "entity_id": 1
                        }
                    }
                }
            ]
        }
    }
    

    This endpoint gets a single customer

    HTTP Request

    GET https://api.traede.com/api/products/{productId}

    URL Parameters

    Key Type Default Description
    productId product ID The ID of the product to fetch

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    Response

    The endpoint will return a single product object

    Key Type Default Description
    id integer The id of the product
    brand_id Entity ID The id of the brand owning the product
    subbrand_id Subbrand ID The id of subbrand associated with the product
    collection_id Collection ID The id of collection associated with the product
    name string Name of the product's company
    item_number string The item number of the product
    description string null The description of the product
    image string null The primary image of the product
    images Array<string> [] All images of the product
    active boolean true Is the product active? (Should it be shown to customers in the webshop)
    colli integer null How many makes a colli?
    attributes Array<string> What attributes are associated with the product?
    created_at string DateTime When was the product created?
    updated_at string DateTime When was the product last updated?
    variants Array[Variants] An array of variant objects

    Variants

    Key Type Default Description
    id integer The id of the variant
    entity_id Entity ID The id of the brand owning the variant
    product_id Product ID The id of product owning the variant
    sku string The SKU of the variant
    ean integer null The EAN number of the variant
    attributes { [string]: string } The attributes of the variant
    created_at string DateTime When was the product created?
    updated_at string DateTime When was the product last updated?

    Prices

    Key Type Default Description
    currency string The currency of the price
    sales_price float The sales price of the variant
    rec_sales_price float null The recommended sales price of the variant
    offer_price flaot null The offer price of the variant

    Inventory

    Key Type Default Description
    id integer The id of the inventory entry
    product_variant_id Variant ID The id of variant
    stock_type string The inventory type of the entry. See the different types under inventory.
    quantity integer The quantity of the stock type
    delivery string Date null When is the entry going to be delivered?
    created_at string DateTime When was the product created?
    updated_at string DateTime When was the product last updated?

    Create a product

    POST https://api.traede.com/api/products HTTP/1.1
    Content-Type: application/json
    
    {
        "product": {
            "subbrand_id": null,
            "collection_id": null,
            "item_number": "awesome-tshirt",
            "name": "Awesome T-shirt",
            "description": "<p>Super awesome t-shirt made of 100% cutton.</p>",
            "image": "products\/2\/r5r7cam6l5kzhis2j8oi",
            "images": [  
                "products\/2\/r5r7cam6l5kzhis2j8oi",
                "products\/2\/dmfqjcz6zgpwoyb5u47b"
            ],
            "active": true,
            "colli": null,
            "variants": [  
                {  
                    "sku": "awesome-tshirt-b-s",
                    "picture": null,
                    "ean": null,
                    "attributes": {  
                        "Color": "Black",
                        "Size": "Small"
                    },
                    "prices": {  
                        "EUR": {  
                            "sales_price": 100,
                            "rec_sales_price": 300,
                            "offer_price": null,
                        },
                        "DKK": {
                            "sales_price": 300,
                            "rec_sales_price": 800,
                            "offer_price": null
                        }
                    },
                    "inventory": {  
                        "stock": {  
                            "quantity": 100,
                            "delivery": "1992-08-18"
                        },
                        "discontinued": {
                            "quantity": 200,
                            "delivery": null
                        }
                    }
                },
                {  
                    "sku": "awesome-tshirt-b-m",
                    "ean": null,
                    "attributes": {  
                        "Color": "Black",
                        "Size": "Medium"
                    },
                    "prices": {  
                        "EUR": {  
                            "sales_price": 100,
                            "rec_sales_price": 300,
                            "offer_price": null
                        },
                        "DKK": {
                            "sales_price": 300,
                            "rec_sales_price": 800,
                            "offer_price": null
                        }
                    },
                    "inventory": {  
                        "stock": {  
                            "quantity": 100,
                            "delivery": "1992-08-18"
                        },
                        "discontinued": {  
                            "quantity": 200,
                            "delivery": "2012-09-27"
                        }
                    }
                }
            ]
        }
    }
    

    The above command will give a JSON structured like this

    HTTP/1.1 201 Created
    Content-Type: application/json
    
    {
        "id": 1,
        "brand_id": 1,
        "subbrand_id": 1,
        "collection_id": 1,
        "item_number": "awesome-tshirt",
        "name": "Awesome T-shirt",
        "description": "<p>Super awesome t-shirt made of 100% cutton.</p>",
        "image": "products\/2\/r5r7cam6l5kzhis2j8oi",
        "images": [  
            "products\/2\/r5r7cam6l5kzhis2j8oi",
            "products\/2\/dmfqjcz6zgpwoyb5u47b"
        ],
        "active": true,
        "colli": null,
        "attributes": [  
            "Color",
            "Size"
        ],
        "created_at": "2015-06-16 11:46:00",
        "updated_at": "2015-06-16 11:46:00",
        "variants": [  
            {  
                "id": 1,
                "entity_id": 1,
                "product_id": 1,
                "sku": "awesome-tshirt-b-s",
                "picture": null,
                "ean": 83023934,
                "created_at": "2015-06-16 11:46:00",
                "updated_at": "2015-06-16 11:46:00",
                "attributes": {  
                    "Color": "Black",
                    "Size": "Small"
                }
            },
            {  
                "id": 1,
                "entity_id": 1,
                "product_id": 1,
                "sku": "awesome-tshirt-b-m",
                "ean": 83023934,
                "created_at": "2015-06-16 11:46:00",
                "updated_at": "2015-06-16 11:46:00",
                "attributes": {  
                    "Color": "Black",
                    "Size": "Medium"
                }
            }
        ]
    }
    

    This endpoint creates a product

    HTTP Request

    POST https://api.traede.com/api/products

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    HTTP Parameters

    Key Type Default Description
    id integer The id of the product
    subbrand_id Subbrand ID The id of subbrand associated with the product
    collection_id Collection ID The id of collection associated with the product
    name string Name of the product's company
    item_number string The item number of the product. This must be unique.
    description string null The description of the product
    image string null The primary image of the product
    images Array<string> [] All images of the product
    active boolean true Is the product active? (Should it be shown to customers in the webshop)
    colli integer null How many makes a colli?
    variants Array[Variants] An array of variant objects
    variants.*.sku string The SKU of the variant. This must be unique.
    variants.*.ean integer null The EAN number of the variant
    variants.*.attributes { [string]: string } The attributes of the variant. This is formatted as {Color: "Black", Size: "XL"} or {"Memory": "64gb"}. It can be anything. But all variants must have at least 1 attribute.
    variants.*.prices Array[Prices] Array of prices
    variants.*.prices.[currency].sales_price float The sales price of the variant. All variants must have at least one price in your base currency.
    variants.*.prices.[currency].rec_sales_price float null The recommended sales price of the variant
    variants.*.prices.[currency].offer_price flaot null The offer price of the variant
    variants.*.inventory Array[Inventory] Array of inventory entries
    variants.*.inventory.[stock_type].quantity integer The quantity of the stock type
    variants.*.inventory.[stock_type].delivery string Date null When is the entry going to be delivered?

    Response

    The endpoint will return 201 Created on success.

    The response will be a single product object

    Update a product

    PUT https://api.traede.com/api/products/1 HTTP/1.1
    Content-Type: application/json
    
    {
        "product": {
            "subbrand_id": null,
            "collection_id": null,
            "item_number": "awesome-tshirt",
            "name": "Awesome T-shirt",
            "description": "<p>Super awesome t-shirt made of 100% cutton.</p>",
            "image": "products\/2\/r5r7cam6l5kzhis2j8oi",
            "images": [  
                "products\/2\/r5r7cam6l5kzhis2j8oi",
                "products\/2\/dmfqjcz6zgpwoyb5u47b"
            ],
            "active": true,
            "colli": null
        }
    }
    

    The above command will return JSON structured like this

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
        "id": 1,
        "brand_id": 1,
        "subbrand_id": 1,
        "collection_id": 1,
        "item_number": "awesome-tshirt",
        "name": "Awesome T-shirt",
        "description": "<p>Super awesome t-shirt made of 100% cutton.</p>",
        "image": "products\/2\/r5r7cam6l5kzhis2j8oi",
        "images": [  
            "products\/2\/r5r7cam6l5kzhis2j8oi",
            "products\/2\/dmfqjcz6zgpwoyb5u47b"
        ],
        "active": true,
        "colli": null,
        "attributes": [  
            "Color",
            "Size"
        ],
        "created_at": "2015-06-16 11:46:00",
        "updated_at": "2015-06-16 11:46:00",
        "variants": [  
            {  
                "id": 1,
                "entity_id": 1,
                "product_id": 1,
                "sku": "awesome-tshirt-b-s",
                "picture": null,
                "ean": 83023934,
                "created_at": "2015-06-16 11:46:00",
                "updated_at": "2015-06-16 11:46:00",
                "attributes": {  
                    "Color": "Black",
                    "Size": "Small"
                }
            },
            {  
                "id": 1,
                "entity_id": 1,
                "product_id": 1,
                "sku": "awesome-tshirt-b-m",
                "ean": 83023934,
                "created_at": "2015-06-16 11:46:00",
                "updated_at": "2015-06-16 11:46:00",
                "attributes": {  
                    "Color": "Black",
                    "Size": "Medium"
                }
            }
        ]
    }
    

    This endpoint updates a product. Note that this will only update the root product object. You cannot update the associated variants using this endpoint! To update a variant, use the Update Variant endpoint.

    HTTP Request

    PUT https://api.traede.com/api/products/{productId}

    URL Parameters

    Key Type Default Description
    productId Product ID The ID of the product to update

    HTTP Parameters

    Key Type Default Description
    id integer The id of the product
    subbrand_id Subbrand ID The id of subbrand associated with the product
    collection_id Collection ID The id of collection associated with the product
    name string Name of the product's company
    item_number string The item number of the product. This must be unique.
    description string null The description of the product
    image string null The primary image of the product
    images Array<string> [] All images of the product
    active boolean true Is the product active? (Should it be shown to customers in the webshop)
    colli integer null How many makes a colli?

    Response

    The endpoint will return 200 OK on success.

    The response will be a single product object

    Delete a product

    DELETE https://api.traede.com/api/products/1 HTTP/1.1
    

    The above command will return JSON structured like this

    HTTP/1.1 204 No Content
    Content-Type: application/json
    

    This endpoint deletes a product. You can only delete a product if no orders are made for it.

    HTTP Request

    DELETE https://api.traede.com/api/products/{productId}

    URL Parameters

    Key Type Default Description
    productId Product ID The ID of the product to delete

    Response

    The endpoint will return 204 No Content on success.

    Create a variant

    POST https://api.traede.com/api/products/1/variants HTTP/1.1
    Content-Type: application/json
    
    {
        "variant": {
            "sku": "awesome-tshirt-b-l",
            "picture": null,
            "ean": null,
            "attributes": {  
                "Color": "Black",
                "Size": "Large"
            },
            "prices": {  
                "EUR": {  
                    "sales_price": 100,
                    "rec_sales_price": 300,
                    "offer_price": null,
                },
                "DKK": {
                    "sales_price": 300,
                    "rec_sales_price": 800,
                    "offer_price": null
                }
            },
            "inventory": {  
                "stock": {  
                    "quantity": 100,
                    "delivery": "1992-08-18"
                },
                "discontinued": {
                    "quantity": 200,
                    "delivery": null
                }
            }
        }
    }
    

    The above command will give a JSON structured like this

    HTTP/1.1 201 Created
    Content-Type: application/json
    
    { 
        "id": 1,
        "entity_id": 1,
        "product_id": 1,
        "sku": "awesome-tshirt-b-l",
        "picture": null,
        "ean": 83023934,
        "created_at": "2015-06-16 11:46:00",
        "updated_at": "2015-06-16 11:46:00",
        "attributes": {  
            "Color": "Black",
            "Size": "Large"
        }
    }
    

    This endpoint creates a variant

    HTTP Request

    POST https://api.traede.com/api/products/{productId}/variants

    URL Parameters

    Key Type Default Description
    productId Product ID The ID of the product to which you will add a variant

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    HTTP Parameters

    Key Type Default Description
    sku string The SKU of the variant. This must be unique.
    ean integer null The EAN number of the variant
    attributes { [string]: string } The attributes of the variant. This is formatted as {Color: "Black", Size: "XL"} or {"Memory": "64gb"}. It can be anything. But all variants must have at least 1 attribute.
    prices Array[Prices] Array of prices
    prices.[currency].sales_price float The sales price of the variant. All variants must have at least one price in your base currency.
    prices.[currency].rec_sales_price float null The recommended sales price of the variant
    prices.[currency].offer_price flaot null The offer price of the variant
    inventory Array[Inventory] Array of inventory entries
    inventory.[stock_type].quantity integer The quantity of the stock type
    inventory.[stock_type].delivery string Date null When is the entry going to be delivered?

    Response

    The endpoint will return 201 Created on success.

    The response will be a single variant object

    Update a variant

    PUT https://api.traede.com/api/products/1/variants/1 HTTP/1.1
    Content-Type: application/json
    
    {
        "variant": {
            "sku": "awesome-tshirt-b-l",
            "picture": null,
            "ean": null,
            "attributes": {  
                "Color": "Black",
                "Size": "Large"
            },
            "prices": {  
                "EUR": {  
                    "sales_price": 100,
                    "rec_sales_price": 300,
                    "offer_price": null,
                },
                "DKK": {
                    "sales_price": 300,
                    "rec_sales_price": 800,
                    "offer_price": null
                }
            },
            "inventory": {  
                "stock": {  
                    "quantity": 100,
                    "delivery": "1992-08-18"
                },
                "discontinued": {
                    "quantity": 200,
                    "delivery": null
                }
            }
        }
    }
    

    The above command will give a JSON structured like this

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    { 
        "id": 1,
        "entity_id": 1,
        "product_id": 1,
        "sku": "awesome-tshirt-b-l",
        "picture": null,
        "ean": 83023934,
        "created_at": "2015-06-16 11:46:00",
        "updated_at": "2015-06-16 11:46:00",
        "attributes": {  
            "Color": "Black",
            "Size": "Large"
        }
    }
    

    This endpoint updates a product variant

    HTTP Request

    PUT https://api.traede.com/api/products/{productId}/variants/{variantId}

    URL Parameters

    Key Type Default Description
    productId Product ID The ID of the product owning the variant
    variantId Variant ID The ID of the variant you want to update

    HTTP Query Parameters

    This endpoint has Bruno options enabled

    HTTP Parameters

    Key Type Default Description
    sku string The SKU of the variant. This must be unique.
    ean integer null The EAN number of the variant
    attributes { [string]: string } The attributes of the variant. This is formatted as {Color: "Black", Size: "XL"} or {"Memory": "64gb"}. You can only update the values, e.g. Black to White or XL to Medium. To change the attributes of the product you must create a new product.
    prices Array[Prices] Array of prices
    prices.[currency].sales_price float The sales price of the variant. All variants must have at least one price in your base currency.
    prices.[currency].rec_sales_price float null The recommended sales price of the variant
    prices.[currency].offer_price flaot null The offer price of the variant
    inventory Array[Inventory] Array of inventory entries
    inventory.[stock_type].quantity integer The quantity of the stock type
    inventory.[stock_type].delivery string Date null When is the entry going to be delivered?

    Response

    The endpoint will return 200 OK on success.

    The response will be a single variant object

    Delete a variant

    DELETE https://api.traede.com/api/products/1/variants/1 HTTP/1.1
    

    The above command will return JSON structured like this

    HTTP/1.1 204 No Content
    Content-Type: application/json
    

    This endpoint deletes a variant of a product. You can only delete a variant if no orders exists for it

    HTTP Request

    DELETE https://api.traede.com/api/products/{productId}/variants/{variantId}

    URL Parameters

    Key Type Default Description
    productId Product ID The ID of the product to delete
    variantId Variant ID The ID of the variant to delete

    Response

    The endpoint will return 204 No Content on success.

    The following related resources can be included for products using Bruno.

    Key Type Description
    categories Array[Category] Array of all categories attached to the product
    collection Collection The collection to which the product belongs
    subbrand Subbrand The subbrand to which the product belongs
    tags Array[Tag] The tags attached to the product
    variants.inventory Array[Inventory] The inventory of the variants

    Errors

    The following are errors that occur when trying to create or update a customer

    Error Code Meaning
    1000001 Attributes differs accross variants. Every variant for a product MUST have the same attributes. E.g. if a product has Size and Color all its variants must contain those attributes.
    1000002 Another product already has the item number. Item numbers MUST be unique.
    1000003 A variant already exists with this SKU. SKUs MUST be unique.
    1000005 You are trying to delete the last variant of a product. A product MUST contain at least one variant.
    1000007 There already exists a variant for this product with these attributes.
    1000008 Two or more variants in your data set contain the same SKU.
    1000014 You are trying to create a variant without a price in your base currency.