NAV

Distru API

Overview

Distru's public API allows you to easily access and manipulate your data in our system automatically.

Getting Started

To integrate with Distru, you'll need to contact a representative that will can enable your account's API access. From there, have a look at the following information on how to authenticate with Distru.

Authentication

Logging in as your user

curl -v -XPOST -H'Content-Type: application/json' https://app.distru.com/api/v1/sessions -d'{"session": {"mobile": false, "email": "antonio@distru.com", "password": "nicetry"}, "platform": "API"}'

> This returns a JSON object that contains information about your user. Most importantly, it
includes a JWT token in the `jwt` field.
{"jwt":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE2ODI3OTA2OTQsImlhdCI6MTY4MDE5ODY5NCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZDMxZTM5MWYtNWQ5Ni00ZjI2LWE5NGYtYWFkOWI4MjM1MzhlIiwibW9iaWxlIjpmYWxzZSwibmJmIjoxNjgwMTk4NjkzLCJwbGF0Zm9ybSI6IndlYiIsInN1YiI6IlVzZXI6NTgiLCJ0eXAiOiJhY2Nlc3MifQ.XmkYcEuCJhxI_v3cRujHZSbIIetUZ-7Se6S7Okzt3uo","user":{"api_ke...

Using your Distru username and password, log in to Distru.

Getting an API token

curl -v -H'Content-Type: application/json' -H 'authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE2ODI3OTA2OTQsImlhdCI6MTY4MDE5ODY5NCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZDMxZTM5MWYtNWQ5Ni00ZjI2LWE5NGYtYWFkOWI4MjM1MzhlIiwibW9iaWxlIjpmYWxzZSwibmJmIjoxNjgwMTk4NjkzLCJwbGF0Zm9ybSI6IndlYiIsInN1YiI6IlVzZXI6NTgiLCJ0eXAiOiJhY2Nlc3MifQ.XmkYcEuCJhxI_v3cRujHZSbIIetUZ-7Se6S7Okzt3uo' https://app.distru.com/api/v1/sessions/generate_api_token

> The response has the JWT token we should use moving forward in the `api_token` field.
{"company":{"settings_invoice_date_based_off_order_delivery_date":false,"settings_tableau_site_id":"Distru","settings_calendar_default_invoice_date":"due_date","qb_purchase_deposit_to_account_id":"231","settings_leaflink_sync_payments":false,"hubspot_company_id":null,"api_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTE2NDk2NDAsImlhdCI6MTY4MDIwMDA0MCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZjM0ZjU5MTUtYWMzZC00Yzk1LWJkYWUtODc5NDU0OGExNDczIiwibW9iaWxlIjpmYWxzZSwibmJmIjoxNjgwMjAwMDM5LCJwbGF0Zm9ybSI6ImFwaSIsInN1YiI6IlVzZXI6NTgiLCJ0eXAiOiJhY2Nlc3MifQ.-H7Id6RFKqsVC956o42kVtldWX5-OXUjOCIudFhfjA4","sett...

Using the first JWT token you get from your initial sign in, call the session API one last time to get a long-term token suitable for use in your integration.

This token expires in 1 year, so be sure to renew it periodically so the integration you're building doesn't break.

Making a request with the API token

curl -v -H'Content-Type: application/json' -H 'authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTE2NDk2NDAsImlhdCI6MTY4MDIwMDA0MCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZjM0ZjU5MTUtYWMzZC00Yzk1LWJkYWUtODc5NDU0OGExNDczIiwibW9iaWxlIjpmYWxzZSwibmJmIjoxNjgwMjAwMDM5LCJwbGF0Zm9ybSI6ImFwaSIsInN1YiI6IlVzZXI6NTgiLCJ0eXAiOiJhY2Nlc3MifQ.-H7Id6RFKqsVC956o42kVtldWX5-OXUjOCIudFhfjA4' https://app.distru.com/public/v1/orders?page[size]=10&page[number]=1

You can keep using this token in future requests by specifying it as an authorization header value just like we did in our generate_api_token request.

Finally, clean up your initial temporary user session using the api_token generated:

curl -XPOST -H'Content-Type: application/json' -H 'authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTE2NDk2NDAsImlhdCI6MTY4MDIwMDA0MCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZjM0ZjU5MTUtYWMzZC00Yzk1LWJkYWUtODc5NDU0OGExNDczIiwibW9iaWxlIjpmYWxzZSwibmJmIjoxNjgwMjAwMDM5LCJwbGF0Zm9ybSI6ImFwaSIsInN1YiI6IlVzZXI6NTgiLCJ0eXAiOiJhY2Nlc3MifQ.-H7Id6RFKqsVC956o42kVtldWX5-OXUjOCIudFhfjA4' https://app.distru.com/api/v1/sessions/delete -d'{"tokens": ["eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE2ODI3OTA2OTQsImlhdCI6MTY4MDE5ODY5NCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZDMxZTM5MWYtNWQ5Ni00ZjI2LWE5NGYtYWFkOWI4MjM1MzhlIiwibW9iaWxlIjpmYWxzZSwibmJmIjoxNjgwMTk4NjkzLCJwbGF0Zm9ybSI6IndlYiIsInN1YiI6IlVzZXI6NTgiLCJ0eXAiOiJhY2Nlc3MifQ.XmkYcEuCJhxI_v3cRujHZSbIIetUZ-7Se6S7Okzt3uo"]}'

Models

Product

A product as shown in Distru

{
  "brand": {
    "name": "Brand 123"
  },
  "category": {
    "id": "89c8323f-aaaa-45v3-88f9-64009d68h3n8",
    "name": "Super Dank Buds"
  },
  "id": "02c88a3f-d759-4973-88f9-60049d682524",
  "name": "Blue Dream Preroll 1G",
  "sku": "BDP-1G",
  "unit_price": 1.5,
  "unit_type": {
    "name": "Gram"
  },
  "units_per_case": 6
}
Property Description Type Required
brand A brand as shown in Distru Brand false
category A product category as shown in Distru ProductCategory false
company A company as shown in Distru Company false
id Unique ID for this product string false
name Human readable name for this product string false
sku The SKU configured for the product string false
unit_price The price of one unit of this product number false
unit_type A unit type as shown in Distru UnitType false
units_per_case The number of units of this product that come in one case, if any number false
updated_datetime The datetime this product was last updated at string false

Products

A collection of Products

Property Description Type Required

OrderItemsRequest

A collection of Order item params

Property Description Type Required

Locations

A collection of Locations

Property Description Type Required

Charge

A line representing a Tax, Discount, or Charge added to an order

Property Description Type Required
id Unique ID for this charge string false
name The name for this charge string false
percent The percent to charge for this line if it is a percentage number false
price The price of this line if it is a flat charge number false
type What type of additional line is this array(any) false
unit_type Determines if this line is tracked as a percentage or a flat charge array(any) false
tax.id Unique ID for this Tax string false
tax.name The name of this tax string false
tax.percent The amount of tax levied string false

InvoiceItemsRequest

A collection of invoice item params

Property Description Type Required

InvoiceItem

A invoice line item as shown in Distru

Property Description Type Required
batch A batch for a product as shown in Distru Batch false
id Unique ID for this invoice item string false
package A package as shown in Distru Package false
price Price per unit of this invoice item number false
product A product as shown in Distru Product false
quantity Quantity used on this invoice item number false

OrderItemRequest

Order item params

Property Description Type Required
batch_id The ID of the batch (if the product is batch-tracked) string false
id Unique ID for this order item. If it exists, an update will be performed; otherwise, it will be used as the ID of a new order item record string false
package_id The ID of the package (if the product is package-tracked) string false
price_base Price per unit of this order item (prior to price tier items being applied) number true
product_id The ID of the product (if the product is product-tracked) string false
quantity Quantity used on this order item number true

Batch

A batch for a product as shown in Distru

Property Description Type Required
id Unique ID for this batch string false
name Human readable name for this batch string false

PurchaseChargesRequest

A collection of Invoice charge params

Property Description Type Required

PurchaseItemRequest

Purchase item params

Property Description Type Required
batch_id The ID of the batch (if the product is batch-tracked) string false
id Unique ID for this order item. If it exists, an update will be performed; otherwise, it will be used as the ID of a new invoice item record string false
price Price per unit of the inventory being received on this line item number true
product_id The ID of the product (if the product is product-tracked) string false
quantity Quantity received in this order item number true

InvoiceChargesRequest

A collection of Invoice charge params

Property Description Type Required

PurchaseOrderItem

An order line item as shown in Distru

Property Description Type Required
batch A batch for a product as shown in Distru Batch false
id Unique ID for this order item string false
package A package as shown in Distru Package false
price Price per unit of this order item (with discounts applied) number false
price_base Price per unit of this order item number false
product A product as shown in Distru Product false
quantity Quantity used on this order item number false
received_quantity Quantity received on this order item. Less than or equal to the quantity field number false

PageWithSize

Pagination information for a request

{
  "number": 1,
  "size": 100
}
Property Description Type Required
number Page number integer true
size Amount of records per page integer true

InvoiceItemRequest

Invoice item params

Property Description Type Required
id Unique ID for this order item. If it exists, an update will be performed; otherwise, it will be used as the ID of a new invoice item record string false
order_item_id The ID of order item with which this invoice item is associated string false
quantity Quantity used on this order item number true

User

Information about a user in Distru

{
  "banned": false,
  "email": "jeanb@zorgindustries.com",
  "full_name": "Jean-Baptiste Emanuel Zorg",
  "id": "12345"
}
Property Description Type Required
banned Is this user banned? boolean false
email The email address of this user string false
full_name The full name of this user string false
id Unique ID for this user string false

OrderChargeRequest

Order charge params

Property Description Type Required
id Unique ID for this order charge. If it exists, an update will be performed; otherwise, it will be used as the ID of a new order charge record string false
name The ID of the batch (if the product is batch-tracked) string false
percent The ID of the package (if the product is package-tracked) number false
price The ID of the product (if the product is product-tracked) number false
type What type of additional line is this string true
unit_type Determines if this line is tracked as a percentage or a flat charge string true

Packages

A collection of Packages

Property Description Type Required

Batches

A collection of Batches

Property Description Type Required

Inventory

{
  "active": "500.000000000",
  "available": "400.000000000",
  "batch_number": "1234",
  "location_id": "1764da45-c1be-425c-9b31-b860cdb93e98",
  "product_id": "67ae9080-8dc2-4ab7-9704-19673f4d9f21"
}
Property Description Type Required
active Active quantity number true
available Available quantity (active - reserved) number true
batch_number The batch number of the batch or the package string false
location_id ID of the location string false
product_id ID of the product string true

Order

A sales order as shown in Distru. Ordered by order date

{
  "billing_location": {
    "address": "123 Compton Street, CA, USA, 12345",
    "id": "d06a5135-dccf-4d62-a922-804190213c10",
    "name": "Warehouse 1"
  },
  "charges": [
    {
      "id": "8h7512d2-g4h6-jj89-92h7-12f9ed9ls8f5",
      "name": "Friends and Family",
      "percent": -10,
      "type": "DISCOUNT",
      "unit_type": "PERCENT"
    },
    {
      "id": "duy67x9r-0d4k-mmk5-8u9u-l3k8ed9lj900",
      "name": "Excise Tax",
      "percent": 27,
      "tax": {
        "id": "9876",
        "name": "Excise Tax - CA 27%",
        "percent": 27.0
      },
      "type": "TAX",
      "unit_type": "PERCENT"
    },
    {
      "id": "ko38h9ju-ndn7-76h8-jio9-j98yhd93h6fh",
      "name": "Membership Fee",
      "price": 25.0,
      "type": "CHARGE",
      "unit_type": "PRICE"
    }
  ],
  "creator": {
    "banned": false,
    "email": "jeanb@zorgindustries.com",
    "full_name": "Jean-Baptiste Emanuel Zorg",
    "id": "3e98e590-85b6-4247-b2e9-96fc2f45802e"
  },
  "delivery_datetime": "2022‐07‐02T00:00:00Z",
  "due_datetime": "2022‐07‐02T00:00:00Z",
  "id": "193c12d2-bc68-46fa-a221-12f9ed958ef4",
  "inserted_datetime": "2022‐07‐02T00:00:00Z",
  "items": [
    {
      "id": "3e98e590-85b6-4247-b2e9-96fc2f45802e",
      "price": 0.006,
      "price_base": 0.006,
      "product": {
        "id": "4ec0ac89-a382-409c-ae67-4478e7e681ac",
        "name": "Crawdad Crippler - 1g - PreRoll",
        "sku": "WHODAT"
      },
      "quantity": 786
    }
  ],
  "order_datetime": "2022‐07‐02T00:00:00Z",
  "order_number": "SO-00012345",
  "shipping_location": {
    "address": "123 Compton Street, CA, USA, 12345",
    "id": "d06a5135-dccf-4d62-a922-804190213c10",
    "name": "Warehouse 1"
  },
  "status": "PENDING",
  "total": 150.23,
  "updated_datetime": "2022‐07‐02T00:00:00Z"
}
Property Description Type Required
billing_location A location as shown in Distru Location false
charges A collection of Charges array(Charge) false
company A company as shown in Distru Company false
creator Information about a user in Distru User false
delivery_datetime The datetime on which the order was / will be delivered string false
due_datetime The datetime by which the order should be completed for the customer string false
id Unique ID for this order string false
inserted_datetime The datetime at which the order was created in Distru string false
items A collection of SalesOrderItems array(SalesOrderItem) false
order_datetime The datetime on which the order was placed string false
order_number The order number as shown in the Distru UI string false
owner Information about a user in Distru User false
shipping_location A location as shown in Distru Location false
status The status of this sales order string false
total The total for this order including taxes, discounts, and all line items number false
updated_datetime The datetime at which the order was last updated in Distru string false

Page

Pagination information for a request

{
  "number": 1
}
Property Description Type Required
number Page number integer true

Purchase

A purchase order as shown in Distru. Ordered by order date

{
  "charges": [
    {
      "id": "8h7512d2-g4h6-jj89-92h7-12f9ed9ls8f5",
      "name": "Friends and Family",
      "percent": -10,
      "type": "Discount",
      "unit_type": "Percent"
    },
    {
      "id": "duy67x9r-0d4k-mmk5-8u9u-l3k8ed9lj900",
      "name": "Excise Tax",
      "percent": 27,
      "tax": {
        "id": "9876",
        "name": "Excise Tax - CA 27%",
        "percent": 27.0
      },
      "type": "Tax",
      "unit_type": "Percent"
    },
    {
      "id": "ko38h9ju-ndn7-76h8-jio9-j98yhd93h6fh",
      "name": "Membership Fee",
      "price": 25.0,
      "type": "Charge",
      "unit_type": "Price"
    }
  ],
  "due_datetime": "2022‐07‐02T00:00:00Z",
  "id": "193c12d2-bc68-46fa-a221-12f9ed958ef4",
  "inserted_datetime": "2022‐07‐02T00:00:00Z",
  "items": [
    {
      "id": "3e98e590-85b6-4247-b2e9-96fc2f45802e",
      "price": 0.006,
      "product": {
        "id": "4ec0ac89-a382-409c-ae67-4478e7e681ac",
        "name": "Crawdad Crippler - 1g - PreRoll",
        "sku": "WHODAT"
      },
      "quantity": 786,
      "received_quantity": 786
    }
  ],
  "order_datetime": "2022‐07‐02T00:00:00Z",
  "purchase_number": "PO-00012345",
  "status": "Pending",
  "total": 150.23,
  "updated_datetime": "2022‐07‐02T00:00:00Z"
}
Property Description Type Required
charges A collection of Charges array(Charge) false
company A company as shown in Distru Company false
creator Information about a user in Distru User false
due_datetime The datetime by which the order should be completed for the customer string false
id Unique ID for this order string false
inserted_datetime The datetime at which the order was created in Distru string false
items A collection of PurchaseOrderItems array(PurchaseOrderItem) false
order_datetime The datetime on which the order was placed string false
order_number The order number as shown in the Distru UI string false
owner Information about a user in Distru User false
status The status of this purchase order string false
total The total for this order including taxes, discounts, and all line items number false
updated_datetime The datetime at which the order was last updated in Distru string false

Package

A package as shown in Distru

Property Description Type Required
batch_number The non-compliance batch number for this package string false
compliance_label The compliance (e.g. Metrc) label for this package string false
id Unique ID for this package in Distru string false

Invoices

A collection of Invoices

Property Description Type Required

Orders

A collection of Orders

Property Description Type Required

SalesOrderItem

An order line item as shown in Distru

Property Description Type Required
batch A batch for a product as shown in Distru Batch false
id Unique ID for this order item string false
package A package as shown in Distru Package false
price Price per unit of this order item number false
product A product as shown in Distru Product false
quantity Quantity sold on this order item number false

Invoice

An invoice as shown in Distru. Ordered by invoice date

{
  "creator": {
    "banned": false,
    "email": "jeanb@zorgindustries.com",
    "full_name": "Jean-Baptiste Emanuel Zorg",
    "id": "12345"
  },
  "due_datetime": "2022‐07‐02T00:00:00Z",
  "id": "193c12d2-bc68-46fa-a221-12f9ed958ef4",
  "inserted_datetime": "2022‐07‐02T00:00:00Z",
  "invoice_datetime": "2022‐07‐02T00:00:00Z",
  "invoice_number": "INV-00012345",
  "items": [
    {
      "id": "1",
      "price": 3.0,
      "product": {
        "id": "543",
        "name": "Crawdad Crippler - 1g - PreRoll",
        "sku": "WHODAT"
      },
      "quantity": 5
    }
  ],
  "order": {
    "id": "931c12d2-68bc-fa46-a221-12f9edcg5hd7",
    "order_number": "SO-0000657",
    "status": "Delivering",
    "total": 999.99
  },
  "status": "Pending",
  "total": 543.23,
  "updated_datetime": "2022‐07‐02T00:00:00Z"
}
Property Description Type Required
charges A collection of Charges array(Charge) false
company A company as shown in Distru Company false
creator Information about a user in Distru User false
due_datetime The datetime by which the invoice should be paid by the customer string false
id Unique ID for this invoice string false
inserted_datetime The datetime at which the invoice was created in Distru string false
invoice_datetime The datetime on which the invoice was placed string false
invoice_number The invoice number as shown in the Distru UI string false
items A collection of InvoiceItems array(InvoiceItem) false
owner Information about a user in Distru User false
status The status of this invoice string false
total The total for this invoice including taxes, discounts, and all line items number false
updated_datetime The datetime at which the invoice was last updated in Distru string false
order.id Unique ID for this order string false
order.order_number The order number for this sale as seen in the Distru UI string false
order.status Status of the associated order string false
order.total The total on the order number false

PurchaseChargeRequest

Purchase charge params

Property Description Type Required
id Unique ID for this purchase charge. If it exists, an update will be performed; otherwise, it will be used as the ID of a new purchase charge record string false
name The name of this charge string false
percent The percent (if it is percent-based) of this charge number false
price The flat price (if it is price-based) of this charge number false
type Determines if this is a charge or discount string true
unit_type Determines if this line is tracked as a percentage or a flat charge string true

License

A license as shown in Distru

Property Description Type Required
license_number License number string false

Purchases

A collection of Purchases

Property Description Type Required

PurchaseItemsRequest

A collection of purchase item params

Property Description Type Required

Location

A location as shown in Distru

Property Description Type Required
address Human readable address for this location string false
company_id ID of company that owns this location string false
id Unique ID for this location string false
license A license as shown in Distru License false
name Human readable name for this location string false

ProductCategory

A product category as shown in Distru

{
  "id": "88c02a3f-57d9-9473-f8f9-40609d68bbh4",
  "name": "Super Dank Buds"
}
Property Description Type Required
id Unique ID for this category string false
name Human readable name for this category string false

OrderChargesRequest

A collection of Order charge params

Property Description Type Required

InvoiceChargeRequest

Invoice charge params

Property Description Type Required
id Unique ID for this invoice charge. If it exists, an update will be performed; otherwise, it will be used as the ID of a new invoice charge record string false
name The name of this charge string false
percent The percent (if it is percent-based) of this charge number false
price The flat price (if it is price-based) of this charge number false
type Determines if this is a charge or discount string true
unit_type Determines if this line is tracked as a percentage or a flat charge string true

Companies

A collection of companies

Property Description Type Required

UnitType

A unit type as shown in Distru

{
  "name": "Gram"
}
Property Description Type Required
name Human readable name for this unit type string false

Company

A company as shown in Distru

Property Description Type Required
id Unique ID for this company string false
licenses The license for the company array(License) false
locations The location for the company array(Location) false
name Human readable name for this company string false
updated_datetime The datetime this company was last updated at string false

Inventories

A list of active and available quantity for each group

Property Description Type Required

Brand

A brand as shown in Distru

{
  "name": "Brand 123"
}
Property Description Type Required
name Name of the brand string false

Batch

Get batches

GET /public/v1/batches returns batches related to the company

GET /public/v1/batches
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiYTQ2YzhlNmItMDkzZS00NDczLTlmZWQtMmFmYTUyYzE3OGI0IiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM4NzQiLCJ0eXAiOiJhY2Nlc3MifQ.Biiv5AvP52R6gNkdCR41rL-UfJO6WGarLmfWKcHaxSM

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 63a58c71b93f1c000000000000000001-ba7bee10ce9b64db-0
{
  "data": [
    {
      "batch_number": null,
      "id": "00000000-0000-0000-0000-000000000c5d",
      "name": "B137",
      "primary_test_result": null
    },
    {
      "batch_number": null,
      "id": "00000000-0000-0000-0000-000000000c60",
      "name": "B145",
      "primary_test_result": {
        "cbd_mg_per_unit": "1",
        "cbd_mg_per_unit_total": "2",
        "cbd_percentage": "3",
        "cbd_percentage_total": "4",
        "mg_per_unit_type": "mg/mL",
        "name": "File.pdf",
        "thc_mg_per_unit": "5",
        "thc_mg_per_unit_total": "6",
        "thc_percentage": "7",
        "thc_percentage_total": "8"
      }
    }
  ]
}

Get batches sorted by their creation date and filtered by various attributes

Request

GET /public/v1/batches

Parameters

Parameter Description In Type Required Default Example
inserted_datetime Filter batches by their creation datetime query string false 2022-07-10T00:00:00Z,
page Pagination information body Page false
updated_datetime Filter batches by the datetime they were most recently modified query string false ,2022-07-10T00:00:00Z

Responses

Status Description Schema
200 A list of batches Batches

Company

Get companies

GET /public/companies returns companies related to the company

GET /public/v1/companies
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiNWZlYmNiZjgtM2U0OS00MzQ0LTg2Y2EtZTliN2RiNDIzNDAzIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM4NTIiLCJ0eXAiOiJhY2Nlc3MifQ.bZU7fCII5JC9cAX4o01-Pa_O4cyg6RNnUSdjQAMyi_k

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 09a487ff22088f000000000000000001-0c8d40512ac89e9c-0
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000f63",
      "licenses": [],
      "locations": [
        {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000116c",
          "id": "00000000-0000-0000-0000-000000000432",
          "name": "Place 32"
        }
      ],
      "name": "Company 80",
      "updated_datetime": "2023-11-03T00:00:00.000000Z"
    },
    {
      "id": "00000000-0000-0000-0000-000000000f64",
      "licenses": [
        {
          "license_number": "CDPH-00000012"
        }
      ],
      "locations": [],
      "name": "Company 85",
      "updated_datetime": "2023-12-02T00:00:00.000000Z"
    }
  ]
}

Get companies sorted by their creation date and filtered by various attributes

Request

GET /public/v1/companies

Parameters

Parameter Description In Type Required Default Example
inserted_datetime Filter companies by their creation datetime query string false 2022-07-10T00:00:00Z,
page Pagination information body Page false
updated_datetime Filter companies by the datetime they were most recently modified query string false ,2022-07-10T00:00:00Z

Responses

Status Description Schema
200 A list of companies Companies

Inventory

Get inventory levels

GET /public/inventory returns stock quantities filtered by product IDs

GET /public/v1/inventory?grouping[]=PRODUCT&product_ids[]=cb64dca8-2447-43ee-8235-e4c7e7a4f341
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDYsImlhdCI6MTcxMjkxNzcwNiwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZTk2MGE5Y2YtZGNkYS00NzRhLWI5OWQtYjIxNjgyZjg3MjBhIiwibmJmIjoxNzEyOTE3NzA1LCJzdWIiOiJVc2VyOjQxOTciLCJ0eXAiOiJhY2Nlc3MifQ.QMMU_eK5wvSRglT9QZfGY3UuH_dH9IRBD_ek-6TBNWQ

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 5ea6e68bf100d8000000000000000001-f78edb8e378411e3-0
{
  "data": [
    {
      "active": "10.000000000",
      "available": "10.000000000",
      "product_id": "cb64dca8-2447-43ee-8235-e4c7e7a4f341",
      "updated_datetime": "2024-04-12T10:28:26.306397Z"
    }
  ]
}

GET /public/inventory returns stock quantities grouped by product

GET /public/v1/inventory?grouping[]=PRODUCT
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDYsImlhdCI6MTcxMjkxNzcwNiwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZDk4NDE5YTQtYTMyNy00MjY3LWIyOGMtN2YwYzM4NzA3YjljIiwibmJmIjoxNzEyOTE3NzA1LCJzdWIiOiJVc2VyOjQyMzQiLCJ0eXAiOiJhY2Nlc3MifQ.FYBoUtF1wxDh5XXYe3uhz2q1pkjdBKaE1aFGEbxHMSo

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: dc539c2553b418000000000000000001-43175934f45bd515-0
{
  "data": [
    {
      "active": "100.000000000",
      "available": "90.000000000",
      "product_id": "151b1994-1732-46de-a441-815af903ea9c",
      "updated_datetime": "2023-12-03T00:00:00.000000Z"
    },
    {
      "active": "50.000000000",
      "available": "50.000000000",
      "product_id": "566d3914-94ae-4532-b7e1-66c41b7f7ba7",
      "updated_datetime": "2023-11-05T00:00:00.000000Z"
    },
    {
      "active": "95.000000000",
      "available": "80.000000000",
      "product_id": "e86a1289-2ce1-4ed4-8e1b-586e50c6cd55",
      "updated_datetime": "2023-11-06T00:00:00.000000Z"
    }
  ]
}

GET /public/inventory returns stock quantities grouped by product & location

GET /public/v1/inventory?grouping[]=PRODUCT&grouping[]=LOCATION
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDYsImlhdCI6MTcxMjkxNzcwNiwiaXNzIjoiRGlzdHJ1IiwianRpIjoiMjljNTEzMzMtZmViNC00MTg4LWJiMTEtM2M0Njc5YzE0ZmI2IiwibmJmIjoxNzEyOTE3NzA1LCJzdWIiOiJVc2VyOjQyOTIiLCJ0eXAiOiJhY2Nlc3MifQ.LhSHTWCjDeWuady1xDxAAmcs_3FVGlfOUwesHp2NP60

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 1a56d31e0de12c000000000000000001-0f475dc9917f08ba-0
{
  "data": [
    {
      "active": "100.000000000",
      "available": "85.000000000",
      "location_id": "00000000-0000-0000-0000-0000000004b8",
      "product_id": "4e9a961f-67f3-47fd-bcc0-af91d0eb79a9",
      "updated_datetime": "2030-10-03T00:00:00.000000Z"
    },
    {
      "active": "90.000000000",
      "available": "82.000000000",
      "location_id": "00000000-0000-0000-0000-0000000004b9",
      "product_id": "4e9a961f-67f3-47fd-bcc0-af91d0eb79a9",
      "updated_datetime": "2030-10-04T00:00:00.000000Z"
    },
    {
      "active": "150.000000000",
      "available": "129.000000000",
      "location_id": "00000000-0000-0000-0000-0000000004ba",
      "product_id": "4e9a961f-67f3-47fd-bcc0-af91d0eb79a9",
      "updated_datetime": "2030-10-05T00:00:00.000000Z"
    },
    {
      "active": "0.000000000",
      "available": "-1.000000000",
      "location_id": null,
      "product_id": "4e9a961f-67f3-47fd-bcc0-af91d0eb79a9",
      "updated_datetime": "2030-10-08T00:00:00.000000Z"
    },
    {
      "active": "100.000000000",
      "available": "100.000000000",
      "location_id": "00000000-0000-0000-0000-0000000004b9",
      "product_id": "750a86e8-d10c-4f66-916a-1ae267a20acf",
      "updated_datetime": "2030-09-01T00:00:00.000000Z"
    },
    {
      "active": "30.000000000",
      "available": "26.000000000",
      "location_id": null,
      "product_id": "750a86e8-d10c-4f66-916a-1ae267a20acf",
      "updated_datetime": "2030-10-07T00:00:00.000000Z"
    },
    {
      "active": "100.000000000",
      "available": "90.000000000",
      "location_id": "00000000-0000-0000-0000-0000000004b8",
      "product_id": "81decf53-b2b4-42e6-b649-f59907dc5b14",
      "updated_datetime": "2030-10-01T00:00:00.000000Z"
    },
    {
      "active": "0.000000000",
      "available": "-1.000000000",
      "location_id": "00000000-0000-0000-0000-0000000004b9",
      "product_id": "81decf53-b2b4-42e6-b649-f59907dc5b14",
      "updated_datetime": "2030-10-02T00:00:00.000000Z"
    }
  ]
}

GET /public/inventory returns stock quantities grouped by product & batch number

GET /public/v1/inventory?grouping[]=PRODUCT&grouping[]=BATCH_NUMBER
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiNThiYTFlZTItNzljOC00NmM1LWEzMDctNmJiNzhkMmU0ZmQzIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjQwOTEiLCJ0eXAiOiJhY2Nlc3MifQ.h1PEAqRVod21RqcbAp_K59kza4WCcq2qwRBtQ4kqF9E

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 00fd13fb021802400000000000000001-030dad8c0e5d82ea-0
{
  "data": [
    {
      "active": "19.000000000",
      "available": "19.000000000",
      "batch_number": null,
      "product_id": "14f2e99a-37fc-449b-99d1-697a536a6e6e",
      "updated_datetime": "2030-10-02T00:00:00.000000Z"
    },
    {
      "active": "13.000000000",
      "available": "13.000000000",
      "batch_number": "TEST-1",
      "product_id": "14f2e99a-37fc-449b-99d1-697a536a6e6e",
      "updated_datetime": "2030-10-04T00:00:00.000000Z"
    },
    {
      "active": "43.000000000",
      "available": "43.000000000",
      "batch_number": null,
      "product_id": "30921e27-1cb5-440e-a365-25924605c3ad",
      "updated_datetime": "2030-11-02T00:00:00.000000Z"
    },
    {
      "active": "47.000000000",
      "available": "47.000000000",
      "batch_number": "1",
      "product_id": "30921e27-1cb5-440e-a365-25924605c3ad",
      "updated_datetime": "2030-11-04T00:00:00.000000Z"
    },
    {
      "active": "25.000000000",
      "available": "25.000000000",
      "batch_number": "2",
      "product_id": "30921e27-1cb5-440e-a365-25924605c3ad",
      "updated_datetime": "2030-11-05T00:00:00.000000Z"
    },
    {
      "active": "8.000000000",
      "available": "8.000000000",
      "batch_number": "TEST-1",
      "product_id": "419303be-9412-4814-a325-625b1eb89bbf",
      "updated_datetime": "2030-09-01T00:00:00.000000Z"
    },
    {
      "active": "26.000000000",
      "available": "26.000000000",
      "batch_number": null,
      "product_id": "8f073bf1-fca6-420c-9a7c-4bfaa1fc2345",
      "updated_datetime": "2030-12-01T00:00:00.000000Z"
    },
    {
      "active": "27.000000000",
      "available": "27.000000000",
      "batch_number": "1",
      "product_id": "8f073bf1-fca6-420c-9a7c-4bfaa1fc2345",
      "updated_datetime": "2030-12-02T00:00:00.000000Z"
    }
  ]
}

GET /public/inventory returns stock quantities grouped by product & location & batch number

GET /public/v1/inventory?grouping[]=PRODUCT&grouping[]=LOCATION&grouping[]=BATCH_NUMBER
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZWFiYzk4NzgtZDA5ZC00MWIzLWFhMDctOWJiOTM3MGEwNTIyIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM5NzciLCJ0eXAiOiJhY2Nlc3MifQ.dgfYVZLj7kVw-MfH-LOBy-BDeqZniXgu3PP-Vdm-SqY

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 57875f7a413434000000000000000001-fff8578b2992e458-0
{
  "data": [
    {
      "active": "41.000000000",
      "available": "41.000000000",
      "batch_number": null,
      "location_id": "00000000-0000-0000-0000-000000000450",
      "product_id": "315deeff-fedf-4f36-8923-0e7c48dff458",
      "updated_datetime": "2031-01-02T00:00:00.000000Z"
    },
    {
      "active": "49.000000000",
      "available": "49.000000000",
      "batch_number": "TEST-1",
      "location_id": "00000000-0000-0000-0000-000000000450",
      "product_id": "315deeff-fedf-4f36-8923-0e7c48dff458",
      "updated_datetime": "2031-02-02T00:00:00.000000Z"
    },
    {
      "active": "45.000000000",
      "available": "45.000000000",
      "batch_number": null,
      "location_id": "00000000-0000-0000-0000-000000000451",
      "product_id": "315deeff-fedf-4f36-8923-0e7c48dff458",
      "updated_datetime": "2031-01-04T00:00:00.000000Z"
    },
    {
      "active": "53.000000000",
      "available": "53.000000000",
      "batch_number": "TEST-1",
      "location_id": "00000000-0000-0000-0000-000000000451",
      "product_id": "315deeff-fedf-4f36-8923-0e7c48dff458",
      "updated_datetime": "2031-02-04T00:00:00.000000Z"
    },
    {
      "active": "21.000000000",
      "available": "21.000000000",
      "batch_number": null,
      "location_id": "00000000-0000-0000-0000-000000000450",
      "product_id": "d2573d9e-34aa-47d4-b671-47c7c2447c71",
      "updated_datetime": "2030-11-02T00:00:00.000000Z"
    },
    {
      "active": "29.000000000",
      "available": "29.000000000",
      "batch_number": "TEST-1",
      "location_id": "00000000-0000-0000-0000-000000000450",
      "product_id": "d2573d9e-34aa-47d4-b671-47c7c2447c71",
      "updated_datetime": "2030-12-02T00:00:00.000000Z"
    },
    {
      "active": "25.000000000",
      "available": "25.000000000",
      "batch_number": null,
      "location_id": "00000000-0000-0000-0000-000000000451",
      "product_id": "d2573d9e-34aa-47d4-b671-47c7c2447c71",
      "updated_datetime": "2030-11-04T00:00:00.000000Z"
    },
    {
      "active": "33.000000000",
      "available": "33.000000000",
      "batch_number": "TEST-1",
      "location_id": "00000000-0000-0000-0000-000000000451",
      "product_id": "d2573d9e-34aa-47d4-b671-47c7c2447c71",
      "updated_datetime": "2030-12-04T00:00:00.000000Z"
    }
  ]
}

Get active and available quantities grouped by a specified list of attributes. Groups with 0 active and 0 available quantity won't be returned. Groups are sorted by the IDs of the attributes they are grouped by.

Request

GET /public/v1/inventory

Parameters

Parameter Description In Type Required Default Example
grouping Attributes to group inventory by. PRODUCT is required to be in the list. Accepted values are "BATCH_NUMBER", "LOCATION" and "PRODUCT". query array false ["PRODUCT","LOCATION"]
page Pagination information body Page false
product_ids Filter inventory levels by product IDs query array false ["67ae9080-8dc2-4ab7-9704-19673f4d9f21","213c7080-8dc2-4ab7-9704-19673f4d9f22"]

Responses

Status Description Schema
200 A list of active and available quantity for each group Inventories

Invoice

Get invoices

GET /invoices/ returns invoices related to the access token's company

GET /public/v1/invoices
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDgsImlhdCI6MTcxMjkxNzcwOCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiNDlkNzQ4MGItYjFkNy00MjUxLWIyOWItNTNlZTc3MmQ3YzU2IiwibmJmIjoxNzEyOTE3NzA3LCJzdWIiOiJVc2VyOjQ2NjMiLCJ0eXAiOiJhY2Nlc3MifQ.HUkKzSo8d-Suam8-cZsJS080oozmkd9vGl6o6ACVj6g

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 1bec95fdb2d9b4000000000000000001-82552c19a29a4290-0
{
  "data": [
    {
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-00000000120a",
        "name": "Company 876",
        "updated_datetime": "2024-04-12T10:28:28.457855Z"
      },
      "creator": {
        "banned": false,
        "email": "owner-869@example.com",
        "full_name": "FirstName1736 LastName1737",
        "id": "00000000-0000-0000-0000-000000001245"
      },
      "due_datetime": "2024-04-12T10:28:28.507476Z",
      "id": "00000000-0000-0000-0000-000000000062",
      "inserted_datetime": "2024-04-12T10:28:28.508017Z",
      "invoice_datetime": "2024-04-12T10:28:28.507475Z",
      "invoice_number": "Invoice #38",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000edf",
            "name": "B1932"
          },
          "id": "00000000-0000-0000-0000-0000000000a3",
          "order_item_id": "18cc3e33-a747-4ef3-a945-e478305e377c",
          "package": null,
          "price": "10.000000000",
          "product": {
            "id": "0cdfad0a-766f-489d-b1b6-52a867668e26",
            "name": "Product 1930",
            "sku": "sku 1931",
            "updated_datetime": "2024-04-12T10:28:28.465054Z"
          },
          "quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000ee0",
            "name": "B1935"
          },
          "id": "00000000-0000-0000-0000-0000000000a4",
          "order_item_id": "dd39bba2-925f-4bb9-8289-b8d39dd7eb1e",
          "package": null,
          "price": "10.000000000",
          "product": {
            "id": "f3310f43-a112-440e-a613-2d8cf5970647",
            "name": "Product 1933",
            "sku": "sku 1934",
            "updated_datetime": "2024-04-12T10:28:28.471989Z"
          },
          "quantity": "10.000000000"
        }
      ],
      "order": {
        "id": "aee30d3a-f15c-4c58-bc20-fc2c5c551cab",
        "order_number": "SO-80",
        "status": "Pending",
        "total": "320.00"
      },
      "owner": {
        "banned": false,
        "email": "owner-869@example.com",
        "full_name": "FirstName1736 LastName1737",
        "id": "00000000-0000-0000-0000-000000001245"
      },
      "status": "NOT_PAID",
      "total": "32.00",
      "updated_datetime": "2024-04-12T10:28:28.508017Z"
    },
    {
      "charges": [
        {
          "id": "66ae70c1-d899-4d82-bc78-90d5cca7c974",
          "name": "C1",
          "percent": "10.0000",
          "price": "1.00",
          "type": "CHARGE",
          "unit_type": "PERCENT"
        }
      ],
      "company": {
        "id": "00000000-0000-0000-0000-000000001203",
        "name": "Company 869",
        "updated_datetime": "2030-11-01T00:00:00.000000Z"
      },
      "creator": {
        "banned": false,
        "email": "user1@a.com",
        "full_name": "John Foo",
        "id": "00000000-0000-0000-0000-000000001237"
      },
      "due_datetime": "2020-01-01T00:00:01.000000Z",
      "id": "00000000-0000-0000-0000-000000000061",
      "inserted_datetime": "2020-01-01T00:00:03.000000Z",
      "invoice_datetime": "2020-01-01T00:00:02.000000Z",
      "invoice_number": "INV-123",
      "items": [
        {
          "batch": {
            "batch_number": "UID1",
            "id": "00000000-0000-0000-0000-000000000ed7",
            "name": "B1"
          },
          "id": "00000000-0000-0000-0000-0000000000a2",
          "order_item_id": "d56e74ac-4438-4c28-92c2-32f62d2d6b1a",
          "package": {
            "batch_number": "B1",
            "compliance_label": "ABCDEF012345670000000103",
            "id": "00000000-0000-0000-0000-000000000080"
          },
          "price": "10.000000000",
          "product": {
            "id": "32066c98-b0ed-4152-a61c-10f9810aef33",
            "name": "P1",
            "sku": "SKU1",
            "updated_datetime": "2023-11-02T00:00:00.000000Z"
          },
          "quantity": "1.000000000"
        }
      ],
      "order": {
        "id": "dd0c32e6-49ac-426e-9c18-81bd040d8d4c",
        "order_number": "SO-123",
        "status": "Completed",
        "total": "10.00"
      },
      "owner": {
        "banned": false,
        "email": "user2@a.com",
        "full_name": "John Bar",
        "id": "00000000-0000-0000-0000-000000001239"
      },
      "status": "FULLY_PAID",
      "total": "8.00",
      "updated_datetime": "2020-01-01T00:00:04.000000Z"
    }
  ]
}

GET /invoices/ allows filtering by several statuses

GET /public/v1/invoices?status[]=Fully+Paid&status[]=Not+Paid
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDksImlhdCI6MTcxMjkxNzcwOSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZWYyMDY0NWYtYTM3OS00ZGE0LWJhNjUtOThiN2Y2M2Q2NWIxIiwibmJmIjoxNzEyOTE3NzA4LCJzdWIiOiJVc2VyOjQ3ODgiLCJ0eXAiOiJhY2Nlc3MifQ.BM58JcN-8TTJ_UmTpzpaV7oeG4AhypwnSIIU_bWSNIU

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 8e1a6fba46f750000000000000000001-e10eb4959e2d384c-0
{
  "data": [
    {
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-0000000012a2",
        "name": "Company 1041",
        "updated_datetime": "2024-04-12T10:28:29.468062Z"
      },
      "creator": {
        "banned": false,
        "email": "owner-1006@example.com",
        "full_name": "FirstName2010 LastName2011",
        "id": "00000000-0000-0000-0000-0000000012d4"
      },
      "due_datetime": "2024-04-12T10:28:29.513041Z",
      "id": "00000000-0000-0000-0000-00000000006f",
      "inserted_datetime": "2024-04-12T10:28:29.513499Z",
      "invoice_datetime": "2020-01-01T12:30:00.000000Z",
      "invoice_number": "Invoice #49",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f5b",
            "name": "B2308"
          },
          "id": "00000000-0000-0000-0000-0000000000bb",
          "order_item_id": "23f983b0-c970-4234-b70c-80df1f52bdb8",
          "package": null,
          "price": "10.000000000",
          "product": {
            "id": "818f1aeb-6af3-4051-bba9-977349ab1e87",
            "name": "Product 2304",
            "sku": "sku 2305",
            "updated_datetime": "2024-04-12T10:28:29.475266Z"
          },
          "quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f5d",
            "name": "B2314"
          },
          "id": "00000000-0000-0000-0000-0000000000bc",
          "order_item_id": "afedd137-a87b-4f07-9ed2-de45a894e1ea",
          "package": null,
          "price": "10.000000000",
          "product": {
            "id": "64d7add5-be96-4a63-8673-2b94e5e3d19d",
            "name": "Product 2310",
            "sku": "sku 2311",
            "updated_datetime": "2024-04-12T10:28:29.481773Z"
          },
          "quantity": "10.000000000"
        }
      ],
      "order": {
        "id": "b3d75a7b-c859-40e1-bd60-10f4c2022a27",
        "order_number": "SO-107",
        "status": "Pending",
        "total": "320.00"
      },
      "owner": {
        "banned": false,
        "email": "owner-1006@example.com",
        "full_name": "FirstName2010 LastName2011",
        "id": "00000000-0000-0000-0000-0000000012d4"
      },
      "status": "NOT_PAID",
      "total": "32.00",
      "updated_datetime": "2024-04-12T10:28:29.513499Z"
    },
    {
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-000000001295",
        "name": "Company 1028",
        "updated_datetime": "2024-04-12T10:28:29.401243Z"
      },
      "creator": {
        "banned": false,
        "email": "owner-996@example.com",
        "full_name": "FirstName1990 LastName1991",
        "id": "00000000-0000-0000-0000-0000000012ca"
      },
      "due_datetime": "2024-04-12T10:28:29.445862Z",
      "id": "00000000-0000-0000-0000-00000000006e",
      "inserted_datetime": "2024-04-12T10:28:29.446340Z",
      "invoice_datetime": "2020-01-01T12:20:00.000000Z",
      "invoice_number": "Invoice #48",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f50",
            "name": "B2275"
          },
          "id": "00000000-0000-0000-0000-0000000000b9",
          "order_item_id": "9f150bf9-6d72-4373-ad55-e6b3cb59d16c",
          "package": null,
          "price": "10.000000000",
          "product": {
            "id": "169235f8-b5d2-4bd4-a3e5-490f6e2bb3bc",
            "name": "Product 2271",
            "sku": "sku 2272",
            "updated_datetime": "2024-04-12T10:28:29.408303Z"
          },
          "quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f52",
            "name": "B2281"
          },
          "id": "00000000-0000-0000-0000-0000000000ba",
          "order_item_id": "cace30dd-c633-4e14-a878-7e42e30e75c0",
          "package": null,
          "price": "10.000000000",
          "product": {
            "id": "741776af-8479-4a8b-a5de-b9b8a75dce72",
            "name": "Product 2277",
            "sku": "sku 2278",
            "updated_datetime": "2024-04-12T10:28:29.414879Z"
          },
          "quantity": "10.000000000"
        }
      ],
      "order": {
        "id": "49f45fe1-dcb2-4aa2-b088-afcdc458ffdd",
        "order_number": "SO-105",
        "status": "Pending",
        "total": "320.00"
      },
      "owner": {
        "banned": false,
        "email": "owner-996@example.com",
        "full_name": "FirstName1990 LastName1991",
        "id": "00000000-0000-0000-0000-0000000012ca"
      },
      "status": "FULLY_PAID",
      "total": "32.00",
      "updated_datetime": "2024-04-12T10:28:29.446340Z"
    },
    {
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-00000000127c",
        "name": "Company 1003",
        "updated_datetime": "2024-04-12T10:28:29.275738Z"
      },
      "creator": {
        "banned": false,
        "email": "owner-975@example.com",
        "full_name": "FirstName1948 LastName1949",
        "id": "00000000-0000-0000-0000-0000000012b5"
      },
      "due_datetime": "2024-04-12T10:28:29.321131Z",
      "id": "00000000-0000-0000-0000-00000000006c",
      "inserted_datetime": "2024-04-12T10:28:29.321682Z",
      "invoice_datetime": "2020-01-01T12:00:00.000000Z",
      "invoice_number": "Invoice #46",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f3b",
            "name": "B2210"
          },
          "id": "00000000-0000-0000-0000-0000000000b5",
          "order_item_id": "e6e0d60b-9d45-4a06-badb-eeb28396d4dd",
          "package": null,
          "price": "10.000000000",
          "product": {
            "id": "0059f840-746f-4895-9a9b-c9d7de4480db",
            "name": "Product 2208",
            "sku": "sku 2209",
            "updated_datetime": "2024-04-12T10:28:29.283403Z"
          },
          "quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f3d",
            "name": "B2216"
          },
          "id": "00000000-0000-0000-0000-0000000000b6",
          "order_item_id": "f9486f72-19a4-4b38-a973-4e0f919593b4",
          "package": null,
          "price": "10.000000000",
          "product": {
            "id": "b973ff28-7bcd-462c-b59f-5dfcd0d19cf2",
            "name": "Product 2214",
            "sku": "sku 2215",
            "updated_datetime": "2024-04-12T10:28:29.290212Z"
          },
          "quantity": "10.000000000"
        }
      ],
      "order": {
        "id": "5898671f-c6ad-4a72-bbd1-d4e14752f3f2",
        "order_number": "SO-100",
        "status": "Pending",
        "total": "320.00"
      },
      "owner": {
        "banned": false,
        "email": "owner-975@example.com",
        "full_name": "FirstName1948 LastName1949",
        "id": "00000000-0000-0000-0000-0000000012b5"
      },
      "status": "FULLY_PAID",
      "total": "32.00",
      "updated_datetime": "2024-04-12T10:28:29.321682Z"
    }
  ]
}

Get invoices sorted by Invoice Date descendingly date and filtered by various attributes

Request

GET /public/v1/invoices

Parameters

Parameter Description In Type Required Default Example
due_datetime Filter invoices by the due datetime query string false ,2022-07-10T00:00:00Z
inserted_datetime Filter invoices by their creation datetime query string false 2022-07-10T00:00:00Z,2022-07-11T00:00:00Z
invoice_datetime Filter invoices by the invoice datetime query string false 2022-07-10T00:00:00Z,
invoice_number Filter invoices by whether their invoice number contains the given string query string false 001
order_id Filter invoices by order IDs query array false ["67ae9080-8dc2-4ab7-9704-19673f4d9f21","213c7080-8dc2-4ab7-9704-19673f4d9f22"]
page Pagination information body Page false
status Filter invoices by their status. Accepted values are "Not Paid", "Over Paid", "Fully Paid" and "Partially Paid". query array false ["Not Paid","Over Paid"]
updated_datetime Filter invoices by the datetime they were most recently modified query string false ,2022-07-10T00:00:00Z

Responses

Status Description Schema
200 A list of invoices Invoices

Get an invoice

GET /invoices/:id returns the expected invoice

GET /public/v1/invoices/00000000-0000-0000-0000-00000000004a
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDYsImlhdCI6MTcxMjkxNzcwNiwiaXNzIjoiRGlzdHJ1IiwianRpIjoiMmY4NzVhMDItMWZlMC00YzBjLWI0MTUtMDRlN2E4Yzk5NmZmIiwibmJmIjoxNzEyOTE3NzA1LCJzdWIiOiJVc2VyOjQzMTkiLCJ0eXAiOiJhY2Nlc3MifQ.-W43FiroUajiSnW2v6oVGQxLtXBO3pqzjHvzq0XDSbo

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 6e7663bd13d2a4000000000000000001-3191d618070bef56-0
{
  "data": {
    "charges": [],
    "company": {
      "id": "00000000-0000-0000-0000-0000000010d1",
      "name": "Company 516",
      "updated_datetime": "2024-04-12T10:28:26.735941Z"
    },
    "creator": {
      "banned": false,
      "email": "owner-534@example.com",
      "full_name": "FirstName1066 LastName1067",
      "id": "00000000-0000-0000-0000-0000000010e0"
    },
    "due_datetime": "2024-04-12T10:28:26.796978Z",
    "id": "00000000-0000-0000-0000-00000000004a",
    "inserted_datetime": "2024-04-12T10:28:26.797558Z",
    "invoice_datetime": "2024-04-12T10:28:26.796977Z",
    "invoice_number": "Invoice #16",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000df5",
          "name": "B1230"
        },
        "id": "00000000-0000-0000-0000-000000000083",
        "order_item_id": "79d00d66-1a29-4cbf-8d2b-d45392e4f1ca",
        "package": null,
        "price": "10.000000000",
        "product": {
          "id": "7d69b7c7-02e7-4367-a9fb-6b264e556d0d",
          "name": "Product 1227",
          "sku": "sku 1228",
          "updated_datetime": "2024-04-12T10:28:26.744470Z"
        },
        "quantity": "10.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000df7",
          "name": "B1236"
        },
        "id": "00000000-0000-0000-0000-000000000084",
        "order_item_id": "203b7333-f202-43c6-99ef-c755bd4dfb92",
        "package": null,
        "price": "10.000000000",
        "product": {
          "id": "8e276f80-f714-44ae-a2e5-1cee47378b89",
          "name": "Product 1234",
          "sku": "sku 1235",
          "updated_datetime": "2024-04-12T10:28:26.754929Z"
        },
        "quantity": "10.000000000"
      }
    ],
    "order": {
      "id": "d6f26623-cbbe-4107-9e06-501bc122879a",
      "order_number": "SO-32",
      "status": "Pending",
      "total": "320.00"
    },
    "owner": {
      "banned": false,
      "email": "owner-534@example.com",
      "full_name": "FirstName1066 LastName1067",
      "id": "00000000-0000-0000-0000-0000000010e0"
    },
    "status": "FULLY_PAID",
    "total": "32.00",
    "updated_datetime": "2024-04-12T10:28:26.797558Z"
  }
}

Get a single invoice given the ID

Request

GET /public/v1/invoices/{id}

Parameters

Parameter Description In Type Required Default Example
id Unique ID for an invoice path string true

Responses

Status Description Schema
200 An invoice Invoice

Upsert an invoice

POST /invoices creates an invoice

POST /public/v1/invoices
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiYjE1NmVjN2MtNmMyYi00YTVkLWE3NGEtNjhlNDM5Y2EzMDhjIiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQ1MTkiLCJ0eXAiOiJhY2Nlc3MifQ.m6dL_KiU1goC_hRXXGU8FhuxpVsHRtizVQw-IDOJ_oA
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-000000000503",
  "charges": [
    {
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "name": "C2",
      "price": "-5.0000",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "due_datetime": "2020-01-30T00:00:01.000000Z",
  "invoice_datetime": "2020-01-01T00:00:00.000000Z",
  "items": [
    {
      "order_item_id": "28592238-87ac-413d-9c94-20141d87ed47",
      "quantity": "1.000000000"
    },
    {
      "order_item_id": "f6033bc0-9d61-4806-89b7-5a55fadff71e",
      "quantity": "10.000000000"
    }
  ],
  "order_id": "0b3666a5-373f-4865-910d-5bdb9854a999"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 50d5a11297fc98000000000000000001-b456b3957b5ea4cb-0
{
  "data": {
    "charges": [
      {
        "id": "f207b162-32bc-4efa-a843-ebf4515e10ea",
        "name": "C1",
        "percent": "10.0000",
        "price": "5.30",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "505c2b3d-d99e-41fd-b35a-ceb63e697f4c",
        "name": "C2",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-000000001178",
      "name": "Company 710",
      "updated_datetime": "2024-04-12T10:28:27.606588Z"
    },
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-0000000011a7"
    },
    "due_datetime": "2020-01-30T00:00:01.000000Z",
    "id": "00000000-0000-0000-0000-000000000058",
    "inserted_datetime": "2024-04-12T10:28:27.654629Z",
    "invoice_datetime": "2020-01-01T00:00:00.000000Z",
    "invoice_number": "INV-0000002",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e6a",
          "name": "B1"
        },
        "id": "00000000-0000-0000-0000-000000000090",
        "order_item_id": "28592238-87ac-413d-9c94-20141d87ed47",
        "package": null,
        "price": "3.000000000",
        "product": {
          "id": "09e1e9f4-552f-485f-a7aa-631c4eaeec9a",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:27.623972Z"
        },
        "quantity": "1.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e6b",
          "name": "B2"
        },
        "id": "00000000-0000-0000-0000-000000000091",
        "order_item_id": "f6033bc0-9d61-4806-89b7-5a55fadff71e",
        "package": null,
        "price": "5.000000000",
        "product": {
          "id": "9d675451-445a-4c57-8851-d94d76daa103",
          "name": "P2",
          "sku": "SKU2",
          "updated_datetime": "2024-04-12T10:28:27.631658Z"
        },
        "quantity": "10.000000000"
      }
    ],
    "order": {
      "id": "0b3666a5-373f-4865-910d-5bdb9854a999",
      "order_number": "SO-63",
      "status": "Processing",
      "total": "0.00"
    },
    "owner": null,
    "status": "NOT_PAID",
    "total": "53.30",
    "updated_datetime": "2024-04-12T10:28:27.660676Z"
  }
}

POST /invoices updates an invoice

POST /public/v1/invoices
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZmE2M2Q0ZjItMzkwNi00MTdiLWI2M2UtNjg1ZTBhOTM2NGQzIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM5ODUiLCJ0eXAiOiJhY2Nlc3MifQ.xs5MVj5RI2A5prjy2ANQgpVMYjF0y35RC1rwyqb9jdg
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-00000000044f",
  "charges": [
    {
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "name": "C2",
      "price": "-5.0000",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "due_datetime": "2020-01-30T00:00:01.000000Z",
  "invoice_datetime": "2020-01-01T00:00:00.000000Z",
  "items": [
    {
      "order_item_id": "d922a8a9-1263-42ee-8c46-411e4e324f50",
      "quantity": "1.000000000"
    },
    {
      "order_item_id": "4f0424db-29c0-4316-8598-f691e274b5e6",
      "quantity": "10.000000000"
    }
  ],
  "order_id": "72a6f6b5-7df4-4e43-b480-3ac3ac5da18a"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: f669830f1b98c8000000000000000001-6d0be455453fa177-0
{
  "data": {
    "charges": [
      {
        "id": "cace7227-477c-4567-a418-34a04b89cde0",
        "name": "C1",
        "percent": "10.0000",
        "price": "5.30",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "807daeac-ba51-49dd-b5a7-801f2f4d3c86",
        "name": "C2",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-000000000fb0",
      "name": "Company 190",
      "updated_datetime": "2024-04-12T10:28:25.478272Z"
    },
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-000000000f91"
    },
    "due_datetime": "2020-01-30T00:00:01.000000Z",
    "id": "00000000-0000-0000-0000-00000000003d",
    "inserted_datetime": "2024-04-12T10:28:25.560949Z",
    "invoice_datetime": "2020-01-01T00:00:00.000000Z",
    "invoice_number": "INV-0000002",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000c96",
          "name": "B1"
        },
        "id": "00000000-0000-0000-0000-000000000068",
        "order_item_id": "d922a8a9-1263-42ee-8c46-411e4e324f50",
        "package": null,
        "price": "3.000000000",
        "product": {
          "id": "6e6816da-049a-4aab-b69b-7ba9a0e86ea7",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:25.506868Z"
        },
        "quantity": "1.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000c98",
          "name": "B2"
        },
        "id": "00000000-0000-0000-0000-000000000069",
        "order_item_id": "4f0424db-29c0-4316-8598-f691e274b5e6",
        "package": null,
        "price": "5.000000000",
        "product": {
          "id": "878fe0e3-b6ff-4ee3-bacf-9430bbccfe0b",
          "name": "P2",
          "sku": "SKU2",
          "updated_datetime": "2024-04-12T10:28:25.516509Z"
        },
        "quantity": "10.000000000"
      }
    ],
    "order": {
      "id": "72a6f6b5-7df4-4e43-b480-3ac3ac5da18a",
      "order_number": "SO-7",
      "status": "Processing",
      "total": "0.00"
    },
    "owner": null,
    "status": "NOT_PAID",
    "total": "53.30",
    "updated_datetime": "2024-04-12T10:28:25.570891Z"
  }
}

POST /invoices updates an invoice

POST /public/v1/invoices
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZmE2M2Q0ZjItMzkwNi00MTdiLWI2M2UtNjg1ZTBhOTM2NGQzIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM5ODUiLCJ0eXAiOiJhY2Nlc3MifQ.xs5MVj5RI2A5prjy2ANQgpVMYjF0y35RC1rwyqb9jdg
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-000000000452",
  "charges": [
    {
      "id": "cace7227-477c-4567-a418-34a04b89cde0",
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "name": "C3",
      "price": "-5.0000",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "due_datetime": "2020-01-28T00:00:01.000000Z",
  "id": "00000000-0000-0000-0000-00000000003d",
  "invoice_datetime": "2020-01-02T00:00:00.000000Z",
  "items": [
    {
      "id": "00000000-0000-0000-0000-000000000068",
      "order_item_id": "d922a8a9-1263-42ee-8c46-411e4e324f50",
      "quantity": "1.000000000"
    },
    {
      "order_item_id": "4f0424db-29c0-4316-8598-f691e274b5e6",
      "quantity": "8.000000000"
    }
  ],
  "order_id": "72a6f6b5-7df4-4e43-b480-3ac3ac5da18a"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: f669830f1b98c8000000000000000001-b705dab417d47f49-0
{
  "data": {
    "charges": [
      {
        "id": "cace7227-477c-4567-a418-34a04b89cde0",
        "name": "C1",
        "percent": "10.0000",
        "price": "4.30",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "de420743-da67-4d30-ae4f-46acafb745b8",
        "name": "C3",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-000000000fb0",
      "name": "Company 190",
      "updated_datetime": "2024-04-12T10:28:25.478272Z"
    },
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-000000000f91"
    },
    "due_datetime": "2020-01-28T00:00:01.000000Z",
    "id": "00000000-0000-0000-0000-00000000003d",
    "inserted_datetime": "2024-04-12T10:28:25.560949Z",
    "invoice_datetime": "2020-01-02T00:00:00.000000Z",
    "invoice_number": "INV-0000002",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000c96",
          "name": "B1"
        },
        "id": "00000000-0000-0000-0000-000000000068",
        "order_item_id": "d922a8a9-1263-42ee-8c46-411e4e324f50",
        "package": null,
        "price": "3.000000000",
        "product": {
          "id": "6e6816da-049a-4aab-b69b-7ba9a0e86ea7",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:25.506868Z"
        },
        "quantity": "1.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000c98",
          "name": "B2"
        },
        "id": "00000000-0000-0000-0000-00000000006a",
        "order_item_id": "4f0424db-29c0-4316-8598-f691e274b5e6",
        "package": null,
        "price": "5.000000000",
        "product": {
          "id": "878fe0e3-b6ff-4ee3-bacf-9430bbccfe0b",
          "name": "P2",
          "sku": "SKU2",
          "updated_datetime": "2024-04-12T10:28:25.516509Z"
        },
        "quantity": "8.000000000"
      }
    ],
    "order": {
      "id": "72a6f6b5-7df4-4e43-b480-3ac3ac5da18a",
      "order_number": "SO-7",
      "status": "Processing",
      "total": "0.00"
    },
    "owner": null,
    "status": "NOT_PAID",
    "total": "42.30",
    "updated_datetime": "2024-04-12T10:28:25.653514Z"
  }
}

POST /invoices reports various errors correctly on update

POST /public/v1/invoices
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDksImlhdCI6MTcxMjkxNzcwOSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiNjU4ODNhMjUtOWJiZi00ZjNjLTg0MTctOTJkYzA5ZGYyZDM1IiwibmJmIjoxNzEyOTE3NzA4LCJzdWIiOiJVc2VyOjQ4MzIiLCJ0eXAiOiJhY2Nlc3MifQ.gqLmtaOXzI438Bm8X6pdTibdamVN8wbSBCIlhpALFy0
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-000000000561",
  "charges": [
    {
      "name": "C1",
      "percent": "-1000.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    }
  ],
  "due_datetime": "2020-01-30T00:00:01.000000Z",
  "id": "00000000-0000-0000-0000-000000000070",
  "invoice_datetime": "2020-01-01T00:00:00.000000Z",
  "items": [
    {
      "order_item_id": "00000000-0000-0000-0000-000000000000",
      "quantity": "15.000"
    },
    {
      "order_item_id": "8394efba-50f4-4428-b00d-b050715e9728",
      "quantity": "19.000"
    }
  ],
  "order_id": "c23ba48c-621e-48cf-8759-57a07b8357f0"
}

Response

400
cache-control: max-age=0, private, must-revalidate
content-type: application/json; charset=utf-8
b3: 3c1643fdc51204000000000000000001-b52f5f865410394b-0
{
  "errors": [
    {
      "context": {
        "id": "8e9ea74d-e57d-43e9-91e7-6a18ae87a37c"
      },
      "message": "Must be less than or equal to 100",
      "pointer": [
        "charges",
        0,
        "percent"
      ],
      "section": "body"
    },
    {
      "context": {},
      "message": "Order item not found",
      "pointer": [
        "items",
        2,
        "order_item_id"
      ],
      "section": "body"
    },
    {
      "context": {},
      "message": "Only 10 left uninvoiced",
      "pointer": [
        "items",
        3,
        "quantity"
      ],
      "section": "body"
    }
  ]
}

Upsert a single invoice. To update an existing invoice, pass in an existing invoice ID in the id field. When updating an invoice, you must pass in all fields (no sparse update currently supported). Any existing invoice item or charge you do not pass in to items and charges respectively will be deleted

Request

POST /public/v1/invoices

Parameters

Parameter Description In Type Required Default Example
due_datetime The datetime at which the invoice is due query string false
id Unique ID for this invoice. If it exists, an update will be performed; otherwise, it will be used as the ID of a new invoice record query string false
invoice_datetime The datetime on which the invoice was placed query string false
charges The additional lines of Charge, Discount, or Tax added to this invoice body InvoiceChargesRequest false
items The invoice items present on this order body InvoiceItemsRequest false
billing_location_id The billing location's ID query string false

Responses

Status Description Schema
200 A single invoice Invoice

Location

Get locations

GET /public/v1/locations returns locations related to the company

GET /public/v1/locations
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiNDA4MjQxZGMtMTcxNC00MzhiLWE2NTgtZDAxNThhZDU3N2EwIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM4MzgiLCJ0eXAiOiJhY2Nlc3MifQ.cp8fBacD8-TjxSU7szA7i3CPNUHgJT2XGMpFWe2EvGI

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 8e856f9d47aab0000000000000000001-87d4954d36f0cc02-0
{
  "data": [
    {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-000000001157",
      "id": "00000000-0000-0000-0000-000000000429",
      "license": null,
      "name": "Place 23"
    },
    {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-000000001157",
      "id": "00000000-0000-0000-0000-00000000042a",
      "license": {
        "license_number": "CDPH-00000009"
      },
      "name": "Place 24"
    }
  ]
}

Get locations sorted by their creation date and filtered by various attributes

Request

GET /public/v1/locations

Parameters

Parameter Description In Type Required Default Example
inserted_datetime Filter locations by their creation datetime query string false 2022-07-10T00:00:00Z,
page Pagination information body Page false
updated_datetime Filter locations by the datetime they were most recently modified query string false ,2022-07-10T00:00:00Z

Responses

Status Description Schema
200 A list of locations Locations

Order

Get orders

GET /public/v1/orders returns orders related to the company

GET /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDgsImlhdCI6MTcxMjkxNzcwOCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiYTA2OTQ2ZmItZDY1NC00YzJjLTllY2MtYmIxNTE5ZGUxZmM5IiwibmJmIjoxNzEyOTE3NzA3LCJzdWIiOiJVc2VyOjQ3MTQiLCJ0eXAiOiJhY2Nlc3MifQ.Wy3Im10cf0vVoa6LEtQZT4Ins6TGzjtT5C7ajwbdQCc

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 16cc1cbe9714b9000000000000000001-c4a276019d95aa57-0
{
  "data": [
    {
      "billing_location": {
        "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
        "company_id": "00000000-0000-0000-0000-0000000014ae",
        "id": "00000000-0000-0000-0000-00000000053b",
        "name": "Place 297"
      },
      "charges": [
        {
          "id": "10892b0d-9887-4e9a-81f9-60d7e9f7794a",
          "name": "C1",
          "percent": "10.0000",
          "price": "1.00",
          "type": "CHARGE",
          "unit_type": "PERCENT"
        }
      ],
      "company": {
        "id": "00000000-0000-0000-0000-000000001231",
        "name": "Company 920",
        "updated_datetime": "2030-11-01T00:00:00.000000Z"
      },
      "creator": {
        "banned": false,
        "email": "user1@a.com",
        "full_name": "John Foo",
        "id": "00000000-0000-0000-0000-00000000126a"
      },
      "delivery_datetime": "2020-01-01T00:00:00.000000Z",
      "due_datetime": "2020-01-01T00:00:01.000000Z",
      "id": "6efa251a-dd11-4e94-89f4-7f22ab0df2e4",
      "inserted_datetime": "2020-01-01T00:00:03.000000Z",
      "items": [
        {
          "batch": {
            "batch_number": "UID1",
            "id": "00000000-0000-0000-0000-000000000efc",
            "name": "B1"
          },
          "compliance_quantity": "10.0000",
          "id": "c4368c35-ef3b-4699-9a8b-aced43436321",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-0000000014ae",
            "id": "00000000-0000-0000-0000-00000000053b",
            "name": "Place 297"
          },
          "package": {
            "batch_number": "B1",
            "compliance_label": "ABCDEF012345670000000105",
            "id": "00000000-0000-0000-0000-000000000081"
          },
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "79bab155-18de-40e1-88d7-7c20c81cd26f",
            "name": "P1",
            "sku": "SKU1",
            "updated_datetime": "2023-11-02T00:00:00.000000Z"
          },
          "quantity": "1.000000000"
        }
      ],
      "order_datetime": "2020-01-01T00:00:02.000000Z",
      "order_number": "SO-123",
      "owner": {
        "banned": false,
        "email": "user2@a.com",
        "full_name": "John Bar",
        "id": "00000000-0000-0000-0000-00000000126c"
      },
      "shipping_location": {
        "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
        "company_id": "00000000-0000-0000-0000-0000000014ae",
        "id": "00000000-0000-0000-0000-00000000053b",
        "name": "Place 297"
      },
      "status": "COMPLETED",
      "total": "11.00",
      "updated_datetime": "2020-01-01T00:00:04.000000Z"
    }
  ]
}

GET /public/v1/orders allows filtering by several statuses

GET /public/v1/orders?status[]=COMPLETED&status[]=CANCELED
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDgsImlhdCI6MTcxMjkxNzcwOCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZmZlM2M5YjMtMWY1Yy00ZTM1LThmYmItYTE3YTRmNDk3NDdiIiwibmJmIjoxNzEyOTE3NzA3LCJzdWIiOiJVc2VyOjQ3NDQiLCJ0eXAiOiJhY2Nlc3MifQ.ohNkeIddaJIqalPvfDNsrvB-xAubCKNmwF9VFT4SvzM

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 4dca87339d0038000000000000000001-a1afb91a3364113b-0
{
  "data": [
    {
      "billing_location": null,
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-000000001262",
        "name": "Company 974",
        "updated_datetime": "2024-04-12T10:28:29.126792Z"
      },
      "creator": {
        "banned": false,
        "email": "owner-957@example.com",
        "full_name": "FirstName1912 LastName1913",
        "id": "00000000-0000-0000-0000-0000000012a3"
      },
      "delivery_datetime": null,
      "due_datetime": "2024-04-12T10:28:29.138425Z",
      "id": "c64de55f-cad5-4e74-b9ec-785e970e3262",
      "inserted_datetime": "2024-04-12T10:28:29.138697Z",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f29",
            "name": "B2156"
          },
          "compliance_quantity": null,
          "id": "2f38f203-e175-4ae3-894f-328badd8a9eb",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "d8a10aeb-fca4-4266-b0c4-5d517f4c5f19",
            "name": "Product 2154",
            "sku": "sku 2155",
            "updated_datetime": "2024-04-12T10:28:29.145559Z"
          },
          "quantity": "15.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f2b",
            "name": "B2162"
          },
          "compliance_quantity": null,
          "id": "c269f6d4-141c-481a-a739-b4140f7ae4ee",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "0cd91a9a-ba8b-4a68-899f-b3cc6237c46c",
            "name": "Product 2160",
            "sku": "sku 2161",
            "updated_datetime": "2024-04-12T10:28:29.152604Z"
          },
          "quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f2d",
            "name": "B2168"
          },
          "compliance_quantity": null,
          "id": "e54c00fc-ce4c-41d4-987f-a7acdc3b6481",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "d41e22e2-15ce-47f9-81cc-0cefa0dfe488",
            "name": "Product 2166",
            "sku": "sku 2167",
            "updated_datetime": "2024-04-12T10:28:29.159190Z"
          },
          "quantity": "5.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f2e",
            "name": "B2171"
          },
          "compliance_quantity": null,
          "id": "1f1db9db-a172-4c08-ad30-69a7d3cc8607",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "902ac815-acf7-487c-90e7-9a1a133f083a",
            "name": "Product 2169",
            "sku": "sku 2170",
            "updated_datetime": "2024-04-12T10:28:29.166116Z"
          },
          "quantity": "2.000000000"
        }
      ],
      "order_datetime": "2020-01-01T12:30:00.000000Z",
      "order_number": "SO-97",
      "owner": {
        "banned": false,
        "email": "owner-957@example.com",
        "full_name": "FirstName1912 LastName1913",
        "id": "00000000-0000-0000-0000-0000000012a3"
      },
      "shipping_location": null,
      "status": "CANCELED",
      "total": "320.00",
      "updated_datetime": "2024-04-12T10:28:29.179034Z"
    },
    {
      "billing_location": null,
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-000000001257",
        "name": "Company 963",
        "updated_datetime": "2024-04-12T10:28:29.065991Z"
      },
      "creator": {
        "banned": false,
        "email": "owner-949@example.com",
        "full_name": "FirstName1896 LastName1897",
        "id": "00000000-0000-0000-0000-00000000129b"
      },
      "delivery_datetime": null,
      "due_datetime": "2024-04-12T10:28:29.079046Z",
      "id": "71e3fd96-7236-4549-b3a3-30b8e78365e7",
      "inserted_datetime": "2024-04-12T10:28:29.079466Z",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f20",
            "name": "B2129"
          },
          "compliance_quantity": null,
          "id": "2987eeec-d2f5-4055-97b9-1996ab275a03",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "7034d2cd-9222-4419-8fd1-8e5e4f67e5db",
            "name": "Product 2127",
            "sku": "sku 2128",
            "updated_datetime": "2024-04-12T10:28:29.086486Z"
          },
          "quantity": "15.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f22",
            "name": "B2135"
          },
          "compliance_quantity": null,
          "id": "b6fbaa48-940b-41b4-9c21-15d2052c4855",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "d21aca51-edfe-4e7a-b1be-177647097ba3",
            "name": "Product 2133",
            "sku": "sku 2134",
            "updated_datetime": "2024-04-12T10:28:29.093943Z"
          },
          "quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f23",
            "name": "B2138"
          },
          "compliance_quantity": null,
          "id": "0f3a6c5b-e225-4746-af1c-6787da082954",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "375c4cb3-ad4c-472d-8e25-7505b9f91bd3",
            "name": "Product 2136",
            "sku": "sku 2137",
            "updated_datetime": "2024-04-12T10:28:29.101332Z"
          },
          "quantity": "5.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f24",
            "name": "B2141"
          },
          "compliance_quantity": null,
          "id": "de46a236-ea20-4029-b7f2-8999c3829097",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "5d3db440-9f82-4557-9994-f184002a99f2",
            "name": "Product 2139",
            "sku": "sku 2140",
            "updated_datetime": "2024-04-12T10:28:29.107821Z"
          },
          "quantity": "2.000000000"
        }
      ],
      "order_datetime": "2020-01-01T12:20:00.000000Z",
      "order_number": "SO-95",
      "owner": {
        "banned": false,
        "email": "owner-949@example.com",
        "full_name": "FirstName1896 LastName1897",
        "id": "00000000-0000-0000-0000-00000000129b"
      },
      "shipping_location": null,
      "status": "COMPLETED",
      "total": "320.00",
      "updated_datetime": "2024-04-12T10:28:29.121164Z"
    },
    {
      "billing_location": null,
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-000000001243",
        "name": "Company 941",
        "updated_datetime": "2024-04-12T10:28:28.942567Z"
      },
      "creator": {
        "banned": false,
        "email": "owner-931@example.com",
        "full_name": "FirstName1860 LastName1861",
        "id": "00000000-0000-0000-0000-000000001289"
      },
      "delivery_datetime": null,
      "due_datetime": "2024-04-12T10:28:28.955491Z",
      "id": "bd2056b3-503c-45b9-afaa-ca5e7d3d5863",
      "inserted_datetime": "2024-04-12T10:28:28.955852Z",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f0d",
            "name": "B2072"
          },
          "compliance_quantity": null,
          "id": "1a863b5d-7692-4263-b743-bccd75b1c2c3",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "8c5ca075-34c6-4c28-b6df-8a25916d9230",
            "name": "Product 2070",
            "sku": "sku 2071",
            "updated_datetime": "2024-04-12T10:28:28.962781Z"
          },
          "quantity": "15.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f0e",
            "name": "B2075"
          },
          "compliance_quantity": null,
          "id": "b368c7bd-49ce-4bd7-9c49-d81610778d04",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "7caf3b82-8cd8-4179-841b-3449b82438bb",
            "name": "Product 2073",
            "sku": "sku 2074",
            "updated_datetime": "2024-04-12T10:28:28.970571Z"
          },
          "quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f0f",
            "name": "B2078"
          },
          "compliance_quantity": null,
          "id": "f2ddb33c-bec9-4b47-983c-b4e646d26924",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "1f8d7d33-b5b1-462b-9214-04077092b952",
            "name": "Product 2076",
            "sku": "sku 2077",
            "updated_datetime": "2024-04-12T10:28:28.977716Z"
          },
          "quantity": "5.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000f10",
            "name": "B2083"
          },
          "compliance_quantity": null,
          "id": "6cd4e75f-cba2-44e9-a25d-122c97011f01",
          "location": null,
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "6a507ce8-1872-4d95-b463-22453238ae28",
            "name": "Product 2081",
            "sku": "sku 2082",
            "updated_datetime": "2024-04-12T10:28:28.984796Z"
          },
          "quantity": "2.000000000"
        }
      ],
      "order_datetime": "2020-01-01T12:00:00.000000Z",
      "order_number": "SO-91",
      "owner": {
        "banned": false,
        "email": "owner-931@example.com",
        "full_name": "FirstName1860 LastName1861",
        "id": "00000000-0000-0000-0000-000000001289"
      },
      "shipping_location": null,
      "status": "COMPLETED",
      "total": "320.00",
      "updated_datetime": "2024-04-12T10:28:28.998897Z"
    }
  ]
}

Get orders sorted by Order Date descendingly date and filtered by various attributes

Request

GET /public/v1/orders

Parameters

Parameter Description In Type Required Default Example
delivery_datetime Filter orders by the delivery datetime query string false 2022-07-10T00:00:00Z,
due_datetime Filter orders by the due datetime query string false ,2022-07-10T00:00:00Z
inserted_datetime Filter orders by their creation datetime query string false 2022-07-10T00:00:00Z,
order_datetime Filter orders by the order datetime query string false 2022-07-10T00:00:00Z,2022-07-11T00:00:00Z
page Pagination information body Page false
status Filter orders by their status. Accepted values are "PENDING", "PROCESSING", "READY_TO_SHIP", "DELIVERING", "DELIVERED", "COMPLETED" and "CANCELED". query array false ["PENDING","PROCESSING"]
updated_datetime Filter orders by the datetime they were most recently modified query string false ,2022-07-10T00:00:00Z

Responses

Status Description Schema
200 A list of orders Orders

Get an order

GET /orders/:id returns the expected order

GET /public/v1/orders/bb72ddad-727a-4cb8-8873-ff0fc35fa1a0
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiZDJkMjFkNzctYWJmYS00OGVmLTgzZGMtN2E0NjQ1ZGJmNzYwIiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQ1MDIiLCJ0eXAiOiJhY2Nlc3MifQ.NuEjc7qw3ODbf4vxLdbXorI1RqcLkBQqC1f7J5GA3TI

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 0f528ed4b6f489800000000000000001-03180d6f88ef20a4-0
{
  "data": {
    "billing_location": null,
    "charges": [],
    "company": {
      "id": "00000000-0000-0000-0000-00000000116c",
      "name": "Company 696",
      "updated_datetime": "2024-04-12T10:28:27.561934Z"
    },
    "creator": {
      "banned": false,
      "email": "owner-707@example.com",
      "full_name": "FirstName1412 LastName1413",
      "id": "00000000-0000-0000-0000-000000001198"
    },
    "delivery_datetime": null,
    "due_datetime": "2024-04-12T10:28:27.575405Z",
    "id": "bb72ddad-727a-4cb8-8873-ff0fc35fa1a0",
    "inserted_datetime": "2024-04-12T10:28:27.575790Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e61",
          "name": "B1562"
        },
        "compliance_quantity": null,
        "id": "b8806bba-50c7-4858-ab82-647bbd6df1c8",
        "location": null,
        "package": null,
        "price": "10.000000000",
        "price_base": "10",
        "product": {
          "id": "66c161af-213d-4aeb-8660-656052d1b040",
          "name": "Product 1560",
          "sku": "sku 1561",
          "updated_datetime": "2024-04-12T10:28:27.583667Z"
        },
        "quantity": "15.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e66",
          "name": "B1571"
        },
        "compliance_quantity": null,
        "id": "60f265bd-6633-4860-baff-2079e1441fad",
        "location": null,
        "package": null,
        "price": "10.000000000",
        "price_base": "10",
        "product": {
          "id": "93a9c3d1-36e4-474f-b00c-0ccc7bcfc00e",
          "name": "Product 1569",
          "sku": "sku 1570",
          "updated_datetime": "2024-04-12T10:28:27.592071Z"
        },
        "quantity": "10.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e67",
          "name": "B1574"
        },
        "compliance_quantity": null,
        "id": "371957b4-1da2-4948-8d6f-83986b5609f2",
        "location": null,
        "package": null,
        "price": "10.000000000",
        "price_base": "10",
        "product": {
          "id": "504acc18-02ec-4b22-b9b1-506a3c2fee07",
          "name": "Product 1572",
          "sku": "sku 1573",
          "updated_datetime": "2024-04-12T10:28:27.600409Z"
        },
        "quantity": "5.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e68",
          "name": "B1577"
        },
        "compliance_quantity": null,
        "id": "98dd62b6-e2fc-4cb3-adb5-1d3b4b6bc572",
        "location": null,
        "package": null,
        "price": "10.000000000",
        "price_base": "10",
        "product": {
          "id": "2c5fbf14-7250-44cf-9fa1-2d31218c227f",
          "name": "Product 1575",
          "sku": "sku 1576",
          "updated_datetime": "2024-04-12T10:28:27.608236Z"
        },
        "quantity": "2.000000000"
      }
    ],
    "order_datetime": "2024-04-12T10:28:27.575405Z",
    "order_number": "SO-60",
    "owner": {
      "banned": false,
      "email": "owner-707@example.com",
      "full_name": "FirstName1412 LastName1413",
      "id": "00000000-0000-0000-0000-000000001198"
    },
    "shipping_location": null,
    "status": "COMPLETED",
    "total": "320.00",
    "updated_datetime": "2024-04-12T10:28:27.624244Z"
  }
}

Get a single order given the ID

Request

GET /public/v1/orders/{id}

Parameters

Parameter Description In Type Required Default Example
id Order ID path string true

Responses

Status Description Schema
200 A single order Order

Upsert an order

POST /public/v1/orders creates an order (with product-tracked item)

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiNmJjNGJhYTAtMDNlMy00OWU2LWE2MjAtOWVhYzJkNDJiMmRlIiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQ0MDkiLCJ0eXAiOiJhY2Nlc3MifQ.aVI5pB8vRG9ENsinKy7kjny9tFt6GFZllaDIsUNy3R8
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-0000000004d7",
  "charges": [
    {
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "name": "C2",
      "price": "-5.0000",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "company_id": "00000000-0000-0000-0000-000000001127",
  "delivery_datetime": "2020-01-01T00:00:00.000000Z",
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-0000000004d7",
      "price_base": "10.000000000",
      "product_id": "b14b220e-5158-4fc3-8606-3363fcf6b6d0",
      "quantity": "1.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "shipping_location_id": "00000000-0000-0000-0000-0000000004d7",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 8d2acd4857a368000000000000000001-6d9c13bbfcd9eb72-0
{
  "data": {
    "billing_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-00000000137c",
      "id": "00000000-0000-0000-0000-0000000004d7",
      "name": "Place 197"
    },
    "charges": [
      {
        "id": "badb505f-9d82-42f3-a0eb-c465df0edfe5",
        "name": "C1",
        "percent": "10.0000",
        "price": "1.00",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "a0846f08-2040-49b8-b2a4-da757f5525d2",
        "name": "C2",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-000000001127",
      "name": "Company 611",
      "updated_datetime": "2024-04-12T10:28:27.194666Z"
    },
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-000000001139"
    },
    "delivery_datetime": "2020-01-01T00:00:00.000000Z",
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "5e0fa73b-c458-4c6e-9845-28ec4de6061a",
    "inserted_datetime": "2024-04-12T10:28:27.231958Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e3a",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "ba8cbd19-d686-47f7-92ec-c1228d18e71c",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000137c",
          "id": "00000000-0000-0000-0000-0000000004d7",
          "name": "Place 197"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "b14b220e-5158-4fc3-8606-3363fcf6b6d0",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:27.212070Z"
        },
        "quantity": "1.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-0000002",
    "owner": null,
    "shipping_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-00000000137c",
      "id": "00000000-0000-0000-0000-0000000004d7",
      "name": "Place 197"
    },
    "status": "PROCESSING",
    "total": "6.00",
    "updated_datetime": "2024-04-12T10:28:27.248882Z"
  }
}

POST /public/v1/orders applies the best fit price tier items to order items

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiMzcyNTAwY2YtMzkzMS00MzBjLTkwZjItYTRiMzE2MjQyODkzIiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQ1NjEiLCJ0eXAiOiJhY2Nlc3MifQ.d0vo5Am_5McRfdYnPXy1M3Mj4lFf19Cr-U4mrIBcmeg
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-00000000050e",
  "charges": [],
  "company_id": "00000000-0000-0000-0000-00000000119f",
  "delivery_datetime": "2020-01-01T00:00:00.000000Z",
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-00000000050e",
      "position": 1,
      "price_base": "100.000000000",
      "product_id": "bed04f50-622d-49e5-b257-8e291373c84f",
      "quantity": "100.000000000"
    },
    {
      "location_id": "00000000-0000-0000-0000-00000000050e",
      "position": 2,
      "price_base": "200.000000000",
      "product_id": "bed04f50-622d-49e5-b257-8e291373c84f",
      "quantity": "10.000000000"
    },
    {
      "location_id": "00000000-0000-0000-0000-00000000050e",
      "position": 3,
      "price_base": "300.000000000",
      "product_id": "bed04f50-622d-49e5-b257-8e291373c84f",
      "quantity": "20.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "shipping_location_id": "00000000-0000-0000-0000-00000000050e",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 9a07355970e660000000000000000001-f703f0801040b4c7-0
{
  "data": {
    "billing_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-00000000140c",
      "id": "00000000-0000-0000-0000-00000000050e",
      "name": "Place 252"
    },
    "charges": [],
    "company": {
      "id": "00000000-0000-0000-0000-00000000119f",
      "name": "Company 754",
      "updated_datetime": "2024-04-12T10:28:27.807875Z"
    },
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-0000000011d1"
    },
    "delivery_datetime": "2020-01-01T00:00:00.000000Z",
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "bc3d052c-ee3f-49b6-8c43-92f7820215f7",
    "inserted_datetime": "2024-04-12T10:28:27.864223Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e8c",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "80081d4c-1531-4eaa-bdc0-2b55035eae7e",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000140c",
          "id": "00000000-0000-0000-0000-00000000050e",
          "name": "Place 252"
        },
        "package": null,
        "price": "80.000000000",
        "price_base": "100.000000000",
        "product": {
          "id": "bed04f50-622d-49e5-b257-8e291373c84f",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:27.824726Z"
        },
        "quantity": "100.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e8c",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "9aa75684-b99d-48dc-8803-dae945cab507",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000140c",
          "id": "00000000-0000-0000-0000-00000000050e",
          "name": "Place 252"
        },
        "package": null,
        "price": "200.000000000",
        "price_base": "200.000000000",
        "product": {
          "id": "bed04f50-622d-49e5-b257-8e291373c84f",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:27.824726Z"
        },
        "quantity": "10.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e8c",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "5fcc9f33-f12e-4e98-a214-7a3ed713f95a",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000140c",
          "id": "00000000-0000-0000-0000-00000000050e",
          "name": "Place 252"
        },
        "package": null,
        "price": "285.000000000",
        "price_base": "300.000000000",
        "product": {
          "id": "bed04f50-622d-49e5-b257-8e291373c84f",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:27.824726Z"
        },
        "quantity": "20.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-0000002",
    "owner": null,
    "shipping_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-00000000140c",
      "id": "00000000-0000-0000-0000-00000000050e",
      "name": "Place 252"
    },
    "status": "PROCESSING",
    "total": "15700.00",
    "updated_datetime": "2024-04-12T10:28:27.879943Z"
  }
}

POST /public/v1/orders creates an order (with batch-tracked item)

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiN2FkNDY0MWYtYzJlYS00NTdmLWJiYTgtZWEzNjUxMzc5NGViIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjQwNjYiLCJ0eXAiOiJhY2Nlc3MifQ.dWW8sqW1newhOW0qBvRFivMl43Fu9V3_1Xr1atTD1bU
content-type: multipart/mixed; boundary=plug_conn_test
{
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "items": [
    {
      "batch_id": "00000000-0000-0000-0000-000000000ce1",
      "location_id": "00000000-0000-0000-0000-00000000046d",
      "price_base": "10.000000000",
      "quantity": "1.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: d1f50fc8453378000000000000000001-253144f5de250634-0
{
  "data": {
    "billing_location": null,
    "charges": [],
    "company": null,
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-000000000fe2"
    },
    "delivery_datetime": null,
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "42ea8d66-972e-401a-9701-6d9c624040f6",
    "inserted_datetime": "2024-04-12T10:28:25.821811Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000ce1",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "f5b38e9d-122f-4fa3-a60c-e15f2e031ed9",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000121f",
          "id": "00000000-0000-0000-0000-00000000046d",
          "name": "Place 91"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "c1529c7f-ff3d-4485-863c-80a6110052a3",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:25.801906Z"
        },
        "quantity": "1.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-0000002",
    "owner": null,
    "shipping_location": null,
    "status": "PROCESSING",
    "total": "10.00",
    "updated_datetime": "2024-04-12T10:28:25.821811Z"
  }
}

POST /public/v1/orders creates an order (with batch-tracked item without batch set)

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDgsImlhdCI6MTcxMjkxNzcwOCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiMTM5MzQxYjktZWMxMC00ODI0LTgzY2YtYTk5YzM4OTY0MDVjIiwibmJmIjoxNzEyOTE3NzA3LCJzdWIiOiJVc2VyOjQ3MzgiLCJ0eXAiOiJhY2Nlc3MifQ.FYV1F7zAXyYAFg6GIQlHm2_nx6H4a4EQeO3SXVPhpTQ
content-type: multipart/mixed; boundary=plug_conn_test
{
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-000000000544",
      "price_base": "10.000000000",
      "product_id": "ccb7dc16-33c1-4f0b-98d7-903e048c4e24",
      "quantity": "1.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 652b126f68aa50000000000000000001-b2c3d6b54f2af7a3-0
{
  "data": {
    "billing_location": null,
    "charges": [],
    "company": null,
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-000000001282"
    },
    "delivery_datetime": null,
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "c6b9a2d5-21ac-4cf7-81cb-2034958ad44e",
    "inserted_datetime": "2024-04-12T10:28:28.891298Z",
    "items": [
      {
        "batch": null,
        "compliance_quantity": null,
        "id": "ee0fbccd-937e-4422-8e67-1422cd434a98",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-0000000014c0",
          "id": "00000000-0000-0000-0000-000000000544",
          "name": "Place 306"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "ccb7dc16-33c1-4f0b-98d7-903e048c4e24",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:28.882295Z"
        },
        "quantity": "1.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-0000002",
    "owner": null,
    "shipping_location": null,
    "status": "PROCESSING",
    "total": "10.00",
    "updated_datetime": "2024-04-12T10:28:28.891298Z"
  }
}

POST /public/v1/orders creates an order (with package-tracked item)

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDgsImlhdCI6MTcxMjkxNzcwOCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiMTE5YTczODUtYWFiNC00NTNhLTk5MzctYTAwNjMyOWM3OGM3IiwibmJmIjoxNzEyOTE3NzA3LCJzdWIiOiJVc2VyOjQ3MjYiLCJ0eXAiOiJhY2Nlc3MifQ._jpq0R_Df6_Y9iwRLr3-SX2XZlu49_jXycquY38Xqeg
content-type: multipart/mixed; boundary=plug_conn_test
{
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "items": [
    {
      "compliance_quantity": "1.0000",
      "location_id": "00000000-0000-0000-0000-00000000053f",
      "package_id": "00000000-0000-0000-0000-000000000082",
      "price_base": "10.000000000",
      "quantity": "1.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 2f951b47a6eb2c000000000000000001-0f131ecae50c5e08-0
{
  "data": {
    "billing_location": null,
    "charges": [],
    "company": null,
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-000000001276"
    },
    "delivery_datetime": null,
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "b3e7535c-eda4-48c9-b184-2add1bcf9601",
    "inserted_datetime": "2024-04-12T10:28:28.823828Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000f01",
          "name": "B1"
        },
        "compliance_quantity": "1.0000",
        "id": "edb5b140-10aa-42f3-ba7c-3adb28844b1c",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-0000000014b7",
          "id": "00000000-0000-0000-0000-00000000053f",
          "name": "Place 301"
        },
        "package": {
          "batch_number": "B1",
          "compliance_label": "ABCDEF012345670000000107",
          "id": "00000000-0000-0000-0000-000000000082"
        },
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "24a062cc-0ced-4160-b454-500ac7952fa8",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:28.793041Z"
        },
        "quantity": "1.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-0000002",
    "owner": null,
    "shipping_location": null,
    "status": "PROCESSING",
    "total": "10.00",
    "updated_datetime": "2024-04-12T10:28:28.823828Z"
  }
}

POST /public/v1/orders creates an order (with package-tracked item without package set)

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDksImlhdCI6MTcxMjkxNzcwOSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiYTA5MjVkMmEtNDMwNS00MWZlLTg4MmMtZGM4YmM1NWQ2ZThiIiwibmJmIjoxNzEyOTE3NzA4LCJzdWIiOiJVc2VyOjQ4NjYiLCJ0eXAiOiJhY2Nlc3MifQ.lx9xpizh-hcZQBfYNHQYgSRKSFgkzlBVOc3WiQtjG9c
content-type: multipart/mixed; boundary=plug_conn_test
{
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-00000000056b",
      "price_base": "10.000000000",
      "product_id": "b926c2a1-2685-44d9-99c6-4f2cb1d4040d",
      "quantity": "1.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 1b0ff16bd92635000000000000000001-02aace82a7c78091-0
{
  "data": {
    "billing_location": null,
    "charges": [],
    "company": null,
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-000000001302"
    },
    "delivery_datetime": null,
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "443a0d74-8ecd-48fe-85dc-64d85304cc44",
    "inserted_datetime": "2024-04-12T10:28:29.857375Z",
    "items": [
      {
        "batch": null,
        "compliance_quantity": null,
        "id": "a2410c52-2103-424d-88d0-ed06157966d2",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000155b",
          "id": "00000000-0000-0000-0000-00000000056b",
          "name": "Place 345"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "b926c2a1-2685-44d9-99c6-4f2cb1d4040d",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:29.851598Z"
        },
        "quantity": "1.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-0000002",
    "owner": null,
    "shipping_location": null,
    "status": "PROCESSING",
    "total": "10.00",
    "updated_datetime": "2024-04-12T10:28:29.857375Z"
  }
}

POST /public/v1/orders updates an order

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDYsImlhdCI6MTcxMjkxNzcwNiwiaXNzIjoiRGlzdHJ1IiwianRpIjoiMTUzMDhjMjUtZDVkMC00MTFhLTk1YTEtMzEwYTNjNGY4Nzg1IiwibmJmIjoxNzEyOTE3NzA1LCJzdWIiOiJVc2VyOjQzMzMiLCJ0eXAiOiJhY2Nlc3MifQ.155-whpGx2bRbHSkd02N5Jjpc9Z6Bw9ELZYdW5S2wjU
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-0000000004c1",
  "charges": [
    {
      "id": "3c576c30-d978-4862-8bfa-e391b16ca651",
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "id": "1cc8bc25-bdd7-40f7-9756-5a5c0c3c43f1",
      "name": "C2",
      "price": "-5.00",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "company_id": "00000000-0000-0000-0000-0000000010da",
  "delivery_datetime": "2020-01-01T00:00:00.000000Z",
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "external_notes": "gonna make you sweat",
  "id": "49f9b800-9cf7-49a9-bfbb-2d690b83daad",
  "items": [
    {
      "id": "af56611b-afcf-47a5-b9c9-09654cd925fe",
      "location_id": "00000000-0000-0000-0000-0000000004c1",
      "price_base": "10.000000000",
      "product_id": "871d9932-751d-4160-b6ff-3c8056456324",
      "quantity": "2.000000000"
    },
    {
      "id": "5f3e9aa0-dd5d-4f37-88f7-905ebdaf1bd7",
      "location_id": "00000000-0000-0000-0000-0000000004c1",
      "price_base": "100.000000000",
      "product_id": "871d9932-751d-4160-b6ff-3c8056456324",
      "quantity": "3.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "shipping_location_id": "00000000-0000-0000-0000-0000000004c1",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: f05e3bc681b2c8000000000000000001-0a95fe2c76f4e665-0
{
  "data": {
    "billing_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-00000000132a",
      "id": "00000000-0000-0000-0000-0000000004c1",
      "name": "Place 175"
    },
    "charges": [
      {
        "id": "3c576c30-d978-4862-8bfa-e391b16ca651",
        "name": "C1",
        "percent": "10.0000",
        "price": "32.00",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "1cc8bc25-bdd7-40f7-9756-5a5c0c3c43f1",
        "name": "C2",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-0000000010da",
      "name": "Company 527",
      "updated_datetime": "2024-04-12T10:28:26.787040Z"
    },
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-0000000010ed"
    },
    "delivery_datetime": "2020-01-01T00:00:00.000000Z",
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "49f9b800-9cf7-49a9-bfbb-2d690b83daad",
    "inserted_datetime": "2024-04-12T10:28:26.815987Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000dff",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "af56611b-afcf-47a5-b9c9-09654cd925fe",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000132a",
          "id": "00000000-0000-0000-0000-0000000004c1",
          "name": "Place 175"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "871d9932-751d-4160-b6ff-3c8056456324",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:26.804004Z"
        },
        "quantity": "2.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000dff",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "5f3e9aa0-dd5d-4f37-88f7-905ebdaf1bd7",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000132a",
          "id": "00000000-0000-0000-0000-0000000004c1",
          "name": "Place 175"
        },
        "package": null,
        "price": "100.000000000",
        "price_base": "100.000000000",
        "product": {
          "id": "871d9932-751d-4160-b6ff-3c8056456324",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:26.804004Z"
        },
        "quantity": "3.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-33",
    "owner": null,
    "shipping_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-00000000132a",
      "id": "00000000-0000-0000-0000-0000000004c1",
      "name": "Place 175"
    },
    "status": "PROCESSING",
    "total": "347.00",
    "updated_datetime": "2024-04-12T10:28:26.869152Z"
  }
}

POST /public/v1/orders updates order items to re-apply the best fit price tier items

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDgsImlhdCI6MTcxMjkxNzcwOCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZjYyZDBmNDctZjBhZi00Zjc0LWE0ZWQtZjY1YmNiYjJhYTk1IiwibmJmIjoxNzEyOTE3NzA3LCJzdWIiOiJVc2VyOjQ2NTAiLCJ0eXAiOiJhY2Nlc3MifQ.2x4XAYKw8BI0KYFw9UQY8MqxdHDofl39qR8tYOY-qjs
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-00000000052a",
  "charges": [],
  "company_id": "00000000-0000-0000-0000-0000000011f8",
  "delivery_datetime": "2020-01-01T00:00:00.000000Z",
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-00000000052a",
      "position": 1,
      "price_base": "100.000000000",
      "product_id": "5a383722-63b9-49d9-bd61-ae5bdc1d70d9",
      "quantity": "100.000000000"
    },
    {
      "location_id": "00000000-0000-0000-0000-00000000052a",
      "position": 2,
      "price_base": "200.000000000",
      "product_id": "5a383722-63b9-49d9-bd61-ae5bdc1d70d9",
      "quantity": "10.000000000"
    },
    {
      "location_id": "00000000-0000-0000-0000-00000000052a",
      "position": 3,
      "price_base": "300.000000000",
      "product_id": "5a383722-63b9-49d9-bd61-ae5bdc1d70d9",
      "quantity": "20.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "shipping_location_id": "00000000-0000-0000-0000-00000000052a",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 600cadd478289c000000000000000001-20b3002977cf61ab-0
{
  "data": {
    "billing_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-000000001470",
      "id": "00000000-0000-0000-0000-00000000052a",
      "name": "Place 280"
    },
    "charges": [],
    "company": {
      "id": "00000000-0000-0000-0000-0000000011f8",
      "name": "Company 853",
      "updated_datetime": "2024-04-12T10:28:28.267121Z"
    },
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-00000000122a"
    },
    "delivery_datetime": "2020-01-01T00:00:00.000000Z",
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "a0eab967-a3b7-4d54-9173-d9929f637970",
    "inserted_datetime": "2024-04-12T10:28:28.317952Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000ed1",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "8ccaf309-9d2b-46bc-aea3-990b040de943",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-000000001470",
          "id": "00000000-0000-0000-0000-00000000052a",
          "name": "Place 280"
        },
        "package": null,
        "price": "80.000000000",
        "price_base": "100.000000000",
        "product": {
          "id": "5a383722-63b9-49d9-bd61-ae5bdc1d70d9",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:28.283619Z"
        },
        "quantity": "100.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000ed1",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "533252ab-b77e-4f3b-97c2-ad81ff586a13",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-000000001470",
          "id": "00000000-0000-0000-0000-00000000052a",
          "name": "Place 280"
        },
        "package": null,
        "price": "200.000000000",
        "price_base": "200.000000000",
        "product": {
          "id": "5a383722-63b9-49d9-bd61-ae5bdc1d70d9",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:28.283619Z"
        },
        "quantity": "10.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000ed1",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "f431974b-8b9b-45a8-906e-39b512e9a3d4",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-000000001470",
          "id": "00000000-0000-0000-0000-00000000052a",
          "name": "Place 280"
        },
        "package": null,
        "price": "285.000000000",
        "price_base": "300.000000000",
        "product": {
          "id": "5a383722-63b9-49d9-bd61-ae5bdc1d70d9",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:28.283619Z"
        },
        "quantity": "20.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-0000002",
    "owner": null,
    "shipping_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-000000001470",
      "id": "00000000-0000-0000-0000-00000000052a",
      "name": "Place 280"
    },
    "status": "PROCESSING",
    "total": "15700.00",
    "updated_datetime": "2024-04-12T10:28:28.336095Z"
  }
}

POST /public/v1/orders deleting order items & charges

POST /public/v1/orders
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiOTQwNjYwM2EtNTZlNC00ODZhLWI1MTQtZWNjMDFiZTA4ZmY5IiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQ0NDkiLCJ0eXAiOiJhY2Nlc3MifQ.pVvmiifhDgsS-zObGl42Pa-G-rf20bHR9SGMa7Vnqe8
content-type: multipart/mixed; boundary=plug_conn_test
{
  "billing_location_id": "00000000-0000-0000-0000-0000000004e5",
  "charges": [],
  "company_id": "00000000-0000-0000-0000-000000001141",
  "delivery_datetime": "2020-01-01T00:00:00.000000Z",
  "due_datetime": "2020-01-01T00:00:01.000000Z",
  "id": "ae775a43-0135-4962-942f-993c4103680e",
  "items": [
    {
      "id": "b3b2c979-d954-45f5-9be2-1347ac809b75",
      "location_id": "00000000-0000-0000-0000-0000000004e5",
      "price_base": "10.000000000",
      "product_id": "f3a6b2f5-f363-4708-9f0e-36b2cfe42482",
      "quantity": "1.000000000"
    }
  ],
  "order_datetime": "2020-01-01T00:00:02.000000Z",
  "shipping_location_id": "00000000-0000-0000-0000-0000000004e5",
  "status": "PROCESSING"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 482dd75f1399fc000000000000000001-2bbb271c0c61ed6e-0
{
  "data": {
    "billing_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-00000000139f",
      "id": "00000000-0000-0000-0000-0000000004e5",
      "name": "Place 211"
    },
    "charges": [],
    "company": {
      "id": "00000000-0000-0000-0000-000000001141",
      "name": "Company 645",
      "updated_datetime": "2024-04-12T10:28:27.361646Z"
    },
    "creator": {
      "banned": false,
      "email": "user1@a.com",
      "full_name": "John Foo",
      "id": "00000000-0000-0000-0000-000000001161"
    },
    "delivery_datetime": "2020-01-01T00:00:00.000000Z",
    "due_datetime": "2020-01-01T00:00:01.000000Z",
    "id": "ae775a43-0135-4962-942f-993c4103680e",
    "inserted_datetime": "2024-04-12T10:28:27.390284Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e47",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "b3b2c979-d954-45f5-9be2-1347ac809b75",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000139f",
          "id": "00000000-0000-0000-0000-0000000004e5",
          "name": "Place 211"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "f3a6b2f5-f363-4708-9f0e-36b2cfe42482",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:27.379246Z"
        },
        "quantity": "1.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:02.000000Z",
    "order_number": "SO-51",
    "owner": null,
    "shipping_location": {
      "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
      "company_id": "00000000-0000-0000-0000-00000000139f",
      "id": "00000000-0000-0000-0000-0000000004e5",
      "name": "Place 211"
    },
    "status": "PROCESSING",
    "total": "10.00",
    "updated_datetime": "2024-04-12T10:28:27.436426Z"
  }
}

Upsert a single order. To update an existing order, pass in an existing order ID in the id field. When updating an order, you must pass in all fields (no sparse update currently supported). Any existing order item or charge you do not pass in to items and charges respectively will be deleted

Request

POST /public/v1/orders

Parameters

Parameter Description In Type Required Default Example
company_id Company ID query string false
external_notes Notes that will eventually be shown to customers on their order slip / packing slip query string false
delivery_datetime The datetime on which the order was / will be delivered query string false
due_datetime The datetime by which the order should be completed for the customer query string false
id Unique ID for this order. If it exists, an update will be performed; otherwise, it will be used as the ID of a new order record query string false
order_datetime The datetime on which the order was placed query string false
charges The additional lines of Charge, Discount, or Tax added to this order body OrderChargesRequest false
items The order items present on this order body OrderItemsRequest false
billing_location_id The billing location's ID query string false
shipping_location_id The shipping location's ID query string false
status Filter orders by their status. Accepted values are "PENDING", "PROCESSING", "READY_TO_SHIP", "DELIVERING", "DELIVERED", "COMPLETED" and "CANCELED". query string false PENDING

Responses

Status Description Schema
200 A single order Order

Package

Get packages

GET /public/v1/packages returns packages related to the company

GET /public/v1/packages
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiOWMxOTZjMTktMTRhMy00MWJmLTk4ZDItODU4NDM0OWI4ZjVhIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM5MDUiLCJ0eXAiOiJhY2Nlc3MifQ.cH5XrcfW29gKGdMTG8nwVucGNn67mSOaIVZ2If901qc

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 229abd1a9eb6ee000000000000000001-7685df343069103a-0
{
  "data": [
    {
      "batch_number": null,
      "compliance_label": "ABCDEF012345670000000025",
      "id": "00000000-0000-0000-0000-000000000059",
      "license": {
        "license_number": "CDPH-00000019"
      },
      "primary_test_result": null
    },
    {
      "batch_number": null,
      "compliance_label": "ABCDEF012345670000000027",
      "id": "00000000-0000-0000-0000-00000000005a",
      "license": {
        "license_number": "CDPH-00000019"
      },
      "primary_test_result": {
        "cbd_mg_per_unit": "1",
        "cbd_mg_per_unit_total": "2",
        "cbd_percentage": "3",
        "cbd_percentage_total": "4",
        "mg_per_unit_type": "mg/mL",
        "name": "File.pdf",
        "thc_mg_per_unit": "5",
        "thc_mg_per_unit_total": "6",
        "thc_percentage": "7",
        "thc_percentage_total": "8"
      }
    }
  ]
}

Get packages sorted by their creation date and filtered by various attributes

Request

GET /public/v1/packages

Parameters

Parameter Description In Type Required Default Example
inserted_datetime Filter packages by their creation datetime query string false 2022-07-10T00:00:00Z,
page Pagination information body Page false
updated_datetime Filter packages by the datetime they were most recently modified query string false ,2022-07-10T00:00:00Z

Responses

Status Description Schema
200 A list of packages Packages

Product

Get products

GET /public/products returns products related to the company

GET /public/v1/products
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiYmExMTdkMTMtOGFlNi00Y2ZjLTlkNjMtZjU2YTNjYWJhYWY5IiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM4NjkiLCJ0eXAiOiJhY2Nlc3MifQ.maJjrg5ou3_hztJnkSFtmuvonHkD0rA6249bhtphjgc

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 7f798e8beaa6b0000000000000000001-a612dce799271cf4-0
{
  "data": [
    {
      "brand": {
        "id": "00000000-0000-0000-0000-000000000f67",
        "name": "Company 92",
        "updated_datetime": "2030-11-01T00:00:00.000000Z"
      },
      "category": {
        "id": "00000000-0000-0000-0000-000000000c3d",
        "name": "Some category 51"
      },
      "id": "d5406acc-1fd4-474b-bcdc-ce04db5774d3",
      "name": "Product 141",
      "sku": "sku 142",
      "unit_price": "1",
      "unit_type": {
        "name": "Gram"
      },
      "units_per_case": null,
      "updated_datetime": "2023-11-01T00:00:00.000000Z",
      "vendor": {
        "id": "00000000-0000-0000-0000-000000000f6c",
        "name": "Company 99",
        "updated_datetime": "2030-11-03T00:00:00.000000Z"
      }
    },
    {
      "brand": {
        "id": "00000000-0000-0000-0000-000000000f68",
        "name": "Company 97",
        "updated_datetime": "2030-11-02T00:00:00.000000Z"
      },
      "category": {
        "id": "00000000-0000-0000-0000-000000000c40",
        "name": "Some category 54"
      },
      "id": "f519e857-8196-4e17-99ca-4d536842eba5",
      "name": "Product 148",
      "sku": "sku 149",
      "unit_price": "1",
      "unit_type": {
        "name": "Pound"
      },
      "units_per_case": null,
      "updated_datetime": "2023-11-02T00:00:00.000000Z",
      "vendor": {
        "id": "00000000-0000-0000-0000-000000000f6f",
        "name": "Company 102",
        "updated_datetime": "2030-11-04T00:00:00.000000Z"
      }
    }
  ]
}

Get products sorted by their creation date and filtered by various attributes

Request

GET /public/v1/products

Parameters

Parameter Description In Type Required Default Example
inserted_datetime Filter products by their creation datetime query string false 2022-07-10T00:00:00Z,
page Pagination information body Page false
updated_datetime Filter products by the datetime they were most recently modified query string false ,2022-07-10T00:00:00Z

Responses

Status Description Schema
200 A list of products Products

Purchase

Get purchases

GET /public/v1/purchases returns purchases related to the company

GET /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiZjMzNTljODMtODQ3Ny00ODIxLThiMTUtNDZmOTY0ODcwZWM3IiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQzODUiLCJ0eXAiOiJhY2Nlc3MifQ.jFEplu8obcLIjf5oT15cgZpAcM9knMFwO4kwxN4kUOo

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 4f9d6152c608e4000000000000000001-48d9b540e9164033-0
{
  "data": [
    {
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-00000000111e",
        "name": "Company 601",
        "updated_datetime": "2024-04-12T10:28:27.150992Z"
      },
      "due_datetime": "2024-04-12T10:28:27.170608Z",
      "id": "00000000-0000-0000-0000-00000000028a",
      "inserted_datetime": "2024-04-12T10:28:27.171012Z",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e33",
            "name": "B1422"
          },
          "compliance_quantity": null,
          "id": "06cf74a4-df62-4ecc-9605-3f4edd98b912",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-000000001366",
            "id": "00000000-0000-0000-0000-0000000004d5",
            "name": "Place 195"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "bb9b8843-5a57-451d-bd65-1d20e9c89c3a",
            "name": "Product 1413",
            "sku": "sku 1414",
            "updated_datetime": "2024-04-12T10:28:27.176128Z"
          },
          "quantity": "15.000000000",
          "received_quantity": "0.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e34",
            "name": "B1423"
          },
          "compliance_quantity": null,
          "id": "aa339e5f-4832-472a-a9f1-4cc786ba74d7",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-000000001366",
            "id": "00000000-0000-0000-0000-0000000004d5",
            "name": "Place 195"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "1e49e3d0-cbfb-452a-acc8-573335d09e71",
            "name": "Product 1416",
            "sku": "sku 1417",
            "updated_datetime": "2024-04-12T10:28:27.181384Z"
          },
          "quantity": "10.000000000",
          "received_quantity": "0.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e35",
            "name": "B1426"
          },
          "compliance_quantity": null,
          "id": "42a0b5be-5f55-4595-87d6-7997061762c2",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-000000001366",
            "id": "00000000-0000-0000-0000-0000000004d5",
            "name": "Place 195"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "9e25db3f-73ed-4c71-bc99-73f046647b59",
            "name": "Product 1418",
            "sku": "sku 1419",
            "updated_datetime": "2024-04-12T10:28:27.186330Z"
          },
          "quantity": "5.000000000",
          "received_quantity": "0.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e36",
            "name": "B1427"
          },
          "compliance_quantity": null,
          "id": "98013732-64f1-4bfc-9390-9f63f34975d6",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-000000001366",
            "id": "00000000-0000-0000-0000-0000000004d5",
            "name": "Place 195"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "82a2b19e-6303-4e9f-b94f-7342abbb63f0",
            "name": "Product 1420",
            "sku": "sku 1421",
            "updated_datetime": "2024-04-12T10:28:27.191069Z"
          },
          "quantity": "2.000000000",
          "received_quantity": "0.000000000"
        }
      ],
      "order_datetime": "2024-04-12T10:28:27.170608Z",
      "purchase_number": "Purchase #29",
      "status": "PENDING",
      "total": "32.00",
      "updated_datetime": "2024-04-12T10:28:27.171012Z"
    },
    {
      "charges": [
        {
          "id": "bd564d58-1e32-4398-a45e-737eeee733d2",
          "name": "C1",
          "percent": "10.0000",
          "price": "1.00",
          "type": "CHARGE",
          "unit_type": "PERCENT"
        }
      ],
      "company": {
        "id": "00000000-0000-0000-0000-00000000111a",
        "name": "Company 597",
        "updated_datetime": "2030-11-01T00:00:00.000000Z"
      },
      "due_datetime": "2020-01-01T00:00:01.000000Z",
      "id": "00000000-0000-0000-0000-000000000289",
      "inserted_datetime": "2020-01-01T00:00:03.000000Z",
      "items": [
        {
          "batch": {
            "batch_number": "UID1",
            "id": "00000000-0000-0000-0000-000000000e29",
            "name": "B1"
          },
          "compliance_quantity": "1.0000",
          "id": "0577220d-4f7e-4b36-973f-9ef0f6a34ec7",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-000000001366",
            "id": "00000000-0000-0000-0000-0000000004cf",
            "name": "Place 189"
          },
          "package": {
            "batch_number": "B1",
            "compliance_label": "ABCDEF012345670000000101",
            "id": "00000000-0000-0000-0000-00000000007f"
          },
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "1944ea3e-34f6-4266-8dfa-9460dbcdebf4",
            "name": "P1",
            "sku": "SKU1",
            "updated_datetime": "2023-11-02T00:00:00.000000Z"
          },
          "quantity": "1.000000000",
          "received_quantity": "1.000000000"
        }
      ],
      "order_datetime": "2020-01-01T00:00:02.000000Z",
      "purchase_number": "SO-123",
      "status": "COMPLETED",
      "total": "10.00",
      "updated_datetime": "2020-01-01T00:00:04.000000Z"
    }
  ]
}

GET /public/v1/purchases allows filtering by several statuses

GET /public/v1/purchases?status[]=Completed&status[]=Pending
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiZGYzOTFhOTYtOGEzOS00OWFiLWExMjItZDMwN2Q4NjM1NjZhIiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQ0MzkiLCJ0eXAiOiJhY2Nlc3MifQ.lZJPg-OE-nMkTU1v43-1A9hnkgwxc9sdSe8vlUMq50Q

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 3d5f91e6c3a128000000000000000001-35e294f598d7a3f6-0
{
  "data": [
    {
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-00000000115f",
        "name": "Company 678",
        "updated_datetime": "2024-04-12T10:28:27.491029Z"
      },
      "due_datetime": "2024-04-12T10:28:27.506884Z",
      "id": "00000000-0000-0000-0000-00000000028e",
      "inserted_datetime": "2024-04-12T10:28:27.507301Z",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e59",
            "name": "B1538"
          },
          "compliance_quantity": null,
          "id": "b2947be7-5251-4a9b-81d5-676cd3d72198",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004f9",
            "name": "Place 231"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "982239ab-dc5d-4886-b519-4cb0536cacc9",
            "name": "Product 1530",
            "sku": "sku 1531",
            "updated_datetime": "2024-04-12T10:28:27.511893Z"
          },
          "quantity": "15.000000000",
          "received_quantity": "0.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e5a",
            "name": "B1539"
          },
          "compliance_quantity": null,
          "id": "f71d71d9-e6ea-4b0a-9f8f-4320db70b424",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004f9",
            "name": "Place 231"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "4877a5a8-07ed-4555-a24c-b2ad5831526a",
            "name": "Product 1532",
            "sku": "sku 1533",
            "updated_datetime": "2024-04-12T10:28:27.516878Z"
          },
          "quantity": "10.000000000",
          "received_quantity": "0.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e5b",
            "name": "B1540"
          },
          "compliance_quantity": null,
          "id": "905dd3e1-5bd6-4839-b1ed-aac5967374ef",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004f9",
            "name": "Place 231"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "c9185c57-2f19-4002-ad9f-8d3349dc7e8f",
            "name": "Product 1534",
            "sku": "sku 1535",
            "updated_datetime": "2024-04-12T10:28:27.521570Z"
          },
          "quantity": "5.000000000",
          "received_quantity": "0.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e5c",
            "name": "B1541"
          },
          "compliance_quantity": null,
          "id": "177a7369-4b0d-467c-9bb1-65656213788b",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004f9",
            "name": "Place 231"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "bf83e8d7-5fc5-48f5-8aae-aafb07ebd2d4",
            "name": "Product 1536",
            "sku": "sku 1537",
            "updated_datetime": "2024-04-12T10:28:27.526014Z"
          },
          "quantity": "2.000000000",
          "received_quantity": "0.000000000"
        }
      ],
      "order_datetime": "2020-01-01T12:30:00.000000Z",
      "purchase_number": "Purchase #33",
      "status": "PENDING",
      "total": "32.00",
      "updated_datetime": "2024-04-12T10:28:27.507301Z"
    },
    {
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-000000001153",
        "name": "Company 665",
        "updated_datetime": "2024-04-12T10:28:27.445653Z"
      },
      "due_datetime": "2024-04-12T10:28:27.460412Z",
      "id": "00000000-0000-0000-0000-00000000028d",
      "inserted_datetime": "2024-04-12T10:28:27.460793Z",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e54",
            "name": "B1521"
          },
          "compliance_quantity": null,
          "id": "c9e0f6db-ab00-4a77-bad1-7959d705a7fc",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004ee",
            "name": "Place 220"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "0e5e1f42-5063-4dfe-b28a-f1d8faf24ddb",
            "name": "Product 1513",
            "sku": "sku 1514",
            "updated_datetime": "2024-04-12T10:28:27.465518Z"
          },
          "quantity": "15.000000000",
          "received_quantity": "15.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e55",
            "name": "B1522"
          },
          "compliance_quantity": null,
          "id": "dc207f6f-0424-4353-9b8e-58b52ee1df53",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004ee",
            "name": "Place 220"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "ef61ba70-0c1f-4fff-9c0d-7c5575696847",
            "name": "Product 1515",
            "sku": "sku 1516",
            "updated_datetime": "2024-04-12T10:28:27.470217Z"
          },
          "quantity": "10.000000000",
          "received_quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e56",
            "name": "B1523"
          },
          "compliance_quantity": null,
          "id": "09b8b50a-9681-4057-9d46-03a62d3f8544",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004ee",
            "name": "Place 220"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "9a1455d6-510c-4054-acac-5228e7696a2f",
            "name": "Product 1517",
            "sku": "sku 1518",
            "updated_datetime": "2024-04-12T10:28:27.474818Z"
          },
          "quantity": "5.000000000",
          "received_quantity": "5.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e57",
            "name": "B1524"
          },
          "compliance_quantity": null,
          "id": "d49dcb30-aa9e-4135-a927-eaf49e47b55d",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004ee",
            "name": "Place 220"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "6a098570-931d-402e-95d1-f61c12ee0231",
            "name": "Product 1519",
            "sku": "sku 1520",
            "updated_datetime": "2024-04-12T10:28:27.479687Z"
          },
          "quantity": "2.000000000",
          "received_quantity": "2.000000000"
        }
      ],
      "order_datetime": "2020-01-01T12:20:00.000000Z",
      "purchase_number": "Purchase #32",
      "status": "COMPLETED",
      "total": "32.00",
      "updated_datetime": "2024-04-12T10:28:27.460793Z"
    },
    {
      "charges": [],
      "company": {
        "id": "00000000-0000-0000-0000-00000000113e",
        "name": "Company 641",
        "updated_datetime": "2024-04-12T10:28:27.351571Z"
      },
      "due_datetime": "2024-04-12T10:28:27.366802Z",
      "id": "00000000-0000-0000-0000-00000000028b",
      "inserted_datetime": "2024-04-12T10:28:27.367243Z",
      "items": [
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e49",
            "name": "B1488"
          },
          "compliance_quantity": null,
          "id": "b4f7f064-d58f-41c5-9c5a-f29ca0ad803f",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004e6",
            "name": "Place 212"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "2fe50c5a-b75e-4bf5-bc85-954e0c4a1eef",
            "name": "Product 1471",
            "sku": "sku 1472",
            "updated_datetime": "2024-04-12T10:28:27.371990Z"
          },
          "quantity": "15.000000000",
          "received_quantity": "15.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e4a",
            "name": "B1489"
          },
          "compliance_quantity": null,
          "id": "1e5daf63-2e24-42f5-af16-5da1ebfdd9bb",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004e6",
            "name": "Place 212"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "3ad18526-5677-403e-93c4-5a428d900eea",
            "name": "Product 1473",
            "sku": "sku 1474",
            "updated_datetime": "2024-04-12T10:28:27.376563Z"
          },
          "quantity": "10.000000000",
          "received_quantity": "10.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e4b",
            "name": "B1490"
          },
          "compliance_quantity": null,
          "id": "95b16780-a57a-422a-893c-166ae8950ba1",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004e6",
            "name": "Place 212"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "1e3e8e4d-e8d0-4203-bcec-2b1c9f776a6e",
            "name": "Product 1480",
            "sku": "sku 1481",
            "updated_datetime": "2024-04-12T10:28:27.381201Z"
          },
          "quantity": "5.000000000",
          "received_quantity": "5.000000000"
        },
        {
          "batch": {
            "batch_number": null,
            "id": "00000000-0000-0000-0000-000000000e4c",
            "name": "B1491"
          },
          "compliance_quantity": null,
          "id": "fc12403b-64f3-43a4-8e25-a72840949b6a",
          "location": {
            "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
            "company_id": "00000000-0000-0000-0000-00000000139c",
            "id": "00000000-0000-0000-0000-0000000004e6",
            "name": "Place 212"
          },
          "package": null,
          "price": "10.000000000",
          "price_base": "10",
          "product": {
            "id": "e04401ab-53a5-4e17-938b-d71d1bd19483",
            "name": "Product 1485",
            "sku": "sku 1486",
            "updated_datetime": "2024-04-12T10:28:27.385734Z"
          },
          "quantity": "2.000000000",
          "received_quantity": "2.000000000"
        }
      ],
      "order_datetime": "2020-01-01T12:00:00.000000Z",
      "purchase_number": "Purchase #30",
      "status": "COMPLETED",
      "total": "32.00",
      "updated_datetime": "2024-04-12T10:28:27.367243Z"
    }
  ]
}

Get purchases sorted by Order Date descendingly date and filtered by various attributes

Request

GET /public/v1/purchases

Parameters

Parameter Description In Type Required Default Example
due_datetime Filter purchases by the due datetime query string false ,2022-07-10T00:00:00Z
inserted_datetime Filter purchases by their creation datetime query string false 2022-07-10T00:00:00Z,
order_datetime Filter purchases by the order datetime query string false 2022-07-10T00:00:00Z,2022-07-11T00:00:00Z
page Pagination information body Page false
status Filter purchases by their status. Accepted values are "Completed", "Delivering", "Partially Received", "Pending", "Processing". query array false ["Pending","Processing"]
updated_datetime Filter purchases by the datetime they were most recently modified query string false ,2022-07-10T00:00:00Z

Responses

Status Description Schema
200 A list of purchases Purchases

Upsert a purchase order

POST /public/v1/purchases creates a purchase (with product-tracked item)

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiYjg3ZWJhZTYtYmE3NC00MjJhLWFmNjgtNDRjYzU1ZjM0M2EyIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM4NjYiLCJ0eXAiOiJhY2Nlc3MifQ.XkLPlHfrwMKlk2OsHk4TzIfKnqfS-6DUElT0rhXVLBA
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [
    {
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "name": "C2",
      "price": "-5.0000",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "company_id": "00000000-0000-0000-0000-000000000f5f",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-000000000434",
      "price": "10.000000000",
      "product_id": "77f0299b-93f6-4f44-bc38-301f6ef37f7e",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-000000000434",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: da7c210c01e420000000000000000001-e7ba880007e26355-0
{
  "data": {
    "charges": [
      {
        "id": "611efe34-c099-4417-b729-20fbe9fbe2f5",
        "name": "C1",
        "percent": "10.0000",
        "price": "1.00",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "3b82b601-dc6d-4021-b888-e0ff0e25375b",
        "name": "C2",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-000000000f5f",
      "name": "Company 82",
      "updated_datetime": "2024-04-12T10:28:25.199461Z"
    },
    "due_datetime": "2020-01-30T00:00:00.000000Z",
    "id": "00000000-0000-0000-0000-000000000269",
    "inserted_datetime": "2024-04-12T10:28:25.310659Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000c64",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "ee91516a-2af1-44dd-a9aa-36a5d29e80b9",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-00000000116a",
          "id": "00000000-0000-0000-0000-000000000434",
          "name": "Place 34"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "77f0299b-93f6-4f44-bc38-301f6ef37f7e",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:25.287202Z"
        },
        "quantity": "1.000000000",
        "received_quantity": "0.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:00.000000Z",
    "purchase_number": "PO-0000002",
    "status": "PENDING",
    "total": "6.00",
    "updated_datetime": "2024-04-12T10:28:25.336689Z"
  }
}

POST /public/v1/purchases creates a purchase (with batch-tracked item)

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDYsImlhdCI6MTcxMjkxNzcwNiwiaXNzIjoiRGlzdHJ1IiwianRpIjoiYjkyYTQ3MDMtNTU0Ny00ZmFiLTgxODgtMDI1YzZiN2ZkNTFhIiwibmJmIjoxNzEyOTE3NzA1LCJzdWIiOiJVc2VyOjQyMjgiLCJ0eXAiOiJhY2Nlc3MifQ.Jeo3JqJApIhUCXue3j0w8Ojeb8tg0NQZoh9NRwDRUOw
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [
    {
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "name": "C2",
      "price": "-5.0000",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "company_id": "00000000-0000-0000-0000-00000000107e",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "items": [
    {
      "batch_id": "00000000-0000-0000-0000-000000000dac",
      "location_id": "00000000-0000-0000-0000-0000000004a7",
      "price": "10.000000000",
      "product_id": "8230395b-3530-4ca1-82d1-db736a7d0379",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-0000000004a7",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 7ba3c5ee6ac488000000000000000001-d002526492c5a6fc-0
{
  "data": {
    "charges": [
      {
        "id": "bb9baf5e-aa18-4280-a00e-91775949d183",
        "name": "C1",
        "percent": "10.0000",
        "price": "1.00",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "e31359ea-b9d0-4cf9-b5c1-1fdc8f517793",
        "name": "C2",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-00000000107e",
      "name": "Company 425",
      "updated_datetime": "2024-04-12T10:28:26.405274Z"
    },
    "due_datetime": "2020-01-30T00:00:00.000000Z",
    "id": "00000000-0000-0000-0000-00000000027f",
    "inserted_datetime": "2024-04-12T10:28:26.435163Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000dac",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "ab50e9b2-834b-4886-a4c8-ae8a48c24e15",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-0000000012c2",
          "id": "00000000-0000-0000-0000-0000000004a7",
          "name": "Place 149"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "8230395b-3530-4ca1-82d1-db736a7d0379",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:26.423977Z"
        },
        "quantity": "1.000000000",
        "received_quantity": "0.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:00.000000Z",
    "purchase_number": "PO-0000002",
    "status": "PENDING",
    "total": "6.00",
    "updated_datetime": "2024-04-12T10:28:26.441711Z"
  }
}

POST /public/v1/purchases creates a purchase (with package-tracked item)

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiNThhNGNjNTgtNDYwYS00NWY1LWFjNWMtYjQ0MzhlYTE0MDE0IiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjQxMDIiLCJ0eXAiOiJhY2Nlc3MifQ.3c9CzvMzFw-z2v6n5ILhfEZ0jg0C1Hz_85cjDi2yv_U
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [
    {
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "name": "C2",
      "price": "-5.0000",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "company_id": "00000000-0000-0000-0000-00000000100e",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-000000000479",
      "price": "10.000000000",
      "product_id": "a374dba7-4240-4230-b226-ca405bb9770d",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-000000000479",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 8c5f1c7d217fb8000000000000000001-e0b934d60a52b102-0
{
  "data": {
    "charges": [
      {
        "id": "8984ffb8-e076-4b81-9bb0-b83c6bb34b89",
        "name": "C1",
        "percent": "10.0000",
        "price": "1.00",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "220138c2-429a-4602-90cf-9d0f8116c1db",
        "name": "C2",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-00000000100e",
      "name": "Company 298",
      "updated_datetime": "2024-04-12T10:28:25.941325Z"
    },
    "due_datetime": "2020-01-30T00:00:00.000000Z",
    "id": "00000000-0000-0000-0000-000000000272",
    "inserted_datetime": "2024-04-12T10:28:25.975293Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000d09",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "42be704d-c6cf-4bef-8f38-356f0a2702d1",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-000000001245",
          "id": "00000000-0000-0000-0000-000000000479",
          "name": "Place 103"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "a374dba7-4240-4230-b226-ca405bb9770d",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:25.963552Z"
        },
        "quantity": "1.000000000",
        "received_quantity": "0.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:00.000000Z",
    "purchase_number": "PO-0000002",
    "status": "PENDING",
    "total": "6.00",
    "updated_datetime": "2024-04-12T10:28:25.982327Z"
  }
}

POST /public/v1/purchases updates a purchase

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiZjM0ZGUwMGMtYzJiNi00MmM3LWJiNzAtYWIwY2M4OThkNWY3IiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQzNjciLCJ0eXAiOiJhY2Nlc3MifQ.JcevlhudQaOR3uoV_oy4ufze49Rjquuc_VKXEH3btAI
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [
    {
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    }
  ],
  "company_id": "00000000-0000-0000-0000-0000000010fd",
  "due_datetime": "2020-01-20T00:00:00.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-0000000004ca",
      "price": "10.000000000",
      "product_id": "ac6f5878-71e5-40c9-aa95-007af2a2d414",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-0000000004ca",
  "order_datetime": "2020-01-02T00:00:00.000000Z"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 5b68c7bb33d6d0000000000000000001-8179e58b4743d546-0
{
  "data": {
    "charges": [
      {
        "id": "775ec7ed-cfd9-447d-b8e8-ae21347f9be4",
        "name": "C1",
        "percent": "10.0000",
        "price": "1.00",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-0000000010fd",
      "name": "Company 566",
      "updated_datetime": "2024-04-12T10:28:26.978487Z"
    },
    "due_datetime": "2020-01-20T00:00:00.000000Z",
    "id": "00000000-0000-0000-0000-000000000288",
    "inserted_datetime": "2024-04-12T10:28:27.032695Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e1a",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "b26e3ba6-bf61-4795-a327-402b6450da8c",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-000000001350",
          "id": "00000000-0000-0000-0000-0000000004ca",
          "name": "Place 184"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "ac6f5878-71e5-40c9-aa95-007af2a2d414",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:27.010373Z"
        },
        "quantity": "1.000000000",
        "received_quantity": "0.000000000"
      }
    ],
    "order_datetime": "2020-01-02T00:00:00.000000Z",
    "purchase_number": "PO-0000002",
    "status": "PENDING",
    "total": "11.00",
    "updated_datetime": "2024-04-12T10:28:27.037268Z"
  }
}

POST /public/v1/purchases updates a purchase

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiZjM0ZGUwMGMtYzJiNi00MmM3LWJiNzAtYWIwY2M4OThkNWY3IiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQzNjciLCJ0eXAiOiJhY2Nlc3MifQ.JcevlhudQaOR3uoV_oy4ufze49Rjquuc_VKXEH3btAI
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [
    {
      "id": "775ec7ed-cfd9-447d-b8e8-ae21347f9be4",
      "name": "C1",
      "percent": "10.0000",
      "type": "CHARGE",
      "unit_type": "PERCENT"
    },
    {
      "name": "C2",
      "percent": null,
      "price": "-5.00",
      "type": "DISCOUNT",
      "unit_type": "PRICE"
    }
  ],
  "company_id": "00000000-0000-0000-0000-0000000010fd",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "id": "00000000-0000-0000-0000-000000000288",
  "items": [
    {
      "id": "b26e3ba6-bf61-4795-a327-402b6450da8c",
      "location_id": "00000000-0000-0000-0000-0000000004ca",
      "price": "10.000000000",
      "product_id": "ac6f5878-71e5-40c9-aa95-007af2a2d414",
      "quantity": "1.000000000"
    },
    {
      "batch_id": "00000000-0000-0000-0000-000000000e1c",
      "location_id": "00000000-0000-0000-0000-0000000004ca",
      "price": "5.000000000",
      "product_id": "987bdb4a-5964-4622-a171-ba4a7c663fba",
      "quantity": "2.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-0000000004ca",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
b3: 5b68c7bb33d6d0000000000000000001-d10746654c8cc59b-0
{
  "data": {
    "charges": [
      {
        "id": "775ec7ed-cfd9-447d-b8e8-ae21347f9be4",
        "name": "C1",
        "percent": "10.0000",
        "price": "2.00",
        "type": "CHARGE",
        "unit_type": "PERCENT"
      },
      {
        "id": "efd6360e-8a41-48f6-b01d-ef33c5337c1b",
        "name": "C2",
        "percent": null,
        "price": "-5.00",
        "type": "DISCOUNT",
        "unit_type": "PRICE"
      }
    ],
    "company": {
      "id": "00000000-0000-0000-0000-0000000010fd",
      "name": "Company 566",
      "updated_datetime": "2024-04-12T10:28:26.978487Z"
    },
    "due_datetime": "2020-01-30T00:00:00.000000Z",
    "id": "00000000-0000-0000-0000-000000000288",
    "inserted_datetime": "2024-04-12T10:28:27.032695Z",
    "items": [
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e1a",
          "name": "B1"
        },
        "compliance_quantity": null,
        "id": "b26e3ba6-bf61-4795-a327-402b6450da8c",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-000000001350",
          "id": "00000000-0000-0000-0000-0000000004ca",
          "name": "Place 184"
        },
        "package": null,
        "price": "10.000000000",
        "price_base": "10.000000000",
        "product": {
          "id": "ac6f5878-71e5-40c9-aa95-007af2a2d414",
          "name": "P1",
          "sku": "SKU1",
          "updated_datetime": "2024-04-12T10:28:27.010373Z"
        },
        "quantity": "1.000000000",
        "received_quantity": "0.000000000"
      },
      {
        "batch": {
          "batch_number": null,
          "id": "00000000-0000-0000-0000-000000000e1c",
          "name": "B2"
        },
        "compliance_quantity": null,
        "id": "47cafb3a-260e-409f-93ec-62118e4bafcb",
        "location": {
          "address": "123 Fake Street, Beverly Hills, CA, 90210, USA",
          "company_id": "00000000-0000-0000-0000-000000001350",
          "id": "00000000-0000-0000-0000-0000000004ca",
          "name": "Place 184"
        },
        "package": null,
        "price": "5.000000000",
        "price_base": "5.000000000",
        "product": {
          "id": "987bdb4a-5964-4622-a171-ba4a7c663fba",
          "name": "P2",
          "sku": "SKU2",
          "updated_datetime": "2024-04-12T10:28:27.022301Z"
        },
        "quantity": "2.000000000",
        "received_quantity": "0.000000000"
      }
    ],
    "order_datetime": "2020-01-01T00:00:00.000000Z",
    "purchase_number": "PO-0000002",
    "status": "PENDING",
    "total": "17.00",
    "updated_datetime": "2024-04-12T10:28:27.081330Z"
  }
}

POST /public/v1/purchases does not update a purchase that has moved beyond Pending status

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDYsImlhdCI6MTcxMjkxNzcwNiwiaXNzIjoiRGlzdHJ1IiwianRpIjoiODY1YTRlOWYtZGY4Ni00OWI5LTg0NWYtM2RmMDg0ZDcxZDg5IiwibmJmIjoxNzEyOTE3NzA1LCJzdWIiOiJVc2VyOjQxODkiLCJ0eXAiOiJhY2Nlc3MifQ.6epzgm5OJ_I2LhJJFpx2KV6M6R_GqLb6l12zrx_wdt0
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [],
  "company_id": "00000000-0000-0000-0000-00000000105c",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "id": "00000000-0000-0000-0000-000000000277",
  "items": [
    {
      "batch_id": "00000000-0000-0000-0000-000000000d8d",
      "id": "2d1bd372-781e-4cfa-ad52-f06a95f31aee",
      "location_id": "00000000-0000-0000-0000-000000000494",
      "price": "10.000000000",
      "product_id": "002093a9-98ad-417e-8a60-59dd720e15fe",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-000000000494",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

400
cache-control: max-age=0, private, must-revalidate
content-type: application/json; charset=utf-8
b3: 6278a1cd34d030000000000000000001-bfdd2bbf47c38611-0
{
  "errors": [
    {
      "context": {},
      "message": "Cannot change this PO through the Distru API because it's beyond Pending status",
      "pointer": [
        "status"
      ],
      "section": "body"
    }
  ]
}

POST /public/v1/purchases does not create a purchase with a company relationship that belongs to another company

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDYsImlhdCI6MTcxMjkxNzcwNiwiaXNzIjoiRGlzdHJ1IiwianRpIjoiZDBiYmQ3ZGQtMWE2Ny00MGVhLWJiZDMtYjNhMDRiYTk2ZGM2IiwibmJmIjoxNzEyOTE3NzA1LCJzdWIiOiJVc2VyOjQyNDciLCJ0eXAiOiJhY2Nlc3MifQ.zcmHmLKz7Ijfi0KTPTM010bJCONoGcE7ZnqEhtGW0U0
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [],
  "company_id": "00000000-0000-0000-0000-00000000108e",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-0000000004ad",
      "price": "10.000000000",
      "product_id": "c6924d22-0159-4ff5-a465-bb23596c6529",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-0000000004ad",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

400
cache-control: max-age=0, private, must-revalidate
content-type: application/json; charset=utf-8
b3: 403c8750bfedb0000000000000000001-e726c4ee37811de0-0
{
  "errors": [
    {
      "context": {},
      "message": "The provided supplier does not exist",
      "pointer": [
        "company_id"
      ],
      "section": "body"
    }
  ]
}

POST /public/v1/purchases does not create a purchase with a product that belongs to another company

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDUsImlhdCI6MTcxMjkxNzcwNSwiaXNzIjoiRGlzdHJ1IiwianRpIjoiMTM0Mzk5NWEtYTk4MC00NTUwLTk0NzYtYjU0ZGQ3ODI4ZDdkIiwibmJmIjoxNzEyOTE3NzA0LCJzdWIiOiJVc2VyOjM4MjAiLCJ0eXAiOiJhY2Nlc3MifQ.-hjMpCvc9_hDcPF48FF7wITqv70S48a1ruKwtqxiJxA
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [],
  "company_id": "00000000-0000-0000-0000-000000000f46",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-000000000421",
      "price": "10.000000000",
      "product_id": "7cabc20f-70ea-4886-ab59-bc8ab15c0f42",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-000000000421",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

400
cache-control: max-age=0, private, must-revalidate
content-type: application/json; charset=utf-8
b3: ccf00c17b81c30000000000000000001-d57a3c06af8366e8-0
{
  "errors": [
    {
      "context": {
        "id": "554e5022-926c-4acc-bd16-cb4685e063c1"
      },
      "message": "This record does not belong to your company.",
      "pointer": [
        "items",
        0,
        "product_id"
      ],
      "section": "body"
    }
  ]
}

POST /public/v1/purchases does not create a purchase with a batch that belongs to another company

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiODU3ZDI0MDUtNjhkOC00YjlkLWIwYjItMWM2YjI0ODBlMjc2IiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQ0MzEiLCJ0eXAiOiJhY2Nlc3MifQ.QhG_YNTmUytB_l2RbuTlJIYZQNdbKsk78rUulch_IFI
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [],
  "company_id": "00000000-0000-0000-0000-000000001136",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "items": [
    {
      "batch_id": "00000000-0000-0000-0000-000000000e42",
      "location_id": "00000000-0000-0000-0000-0000000004df",
      "price": "10.000000000",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-0000000004df",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

400
cache-control: max-age=0, private, must-revalidate
content-type: application/json; charset=utf-8
b3: d27f1a50b29ff8000000000000000001-b9d6c5aa7961e882-0
{
  "errors": [
    {
      "context": {
        "id": "fe887ee2-f8d3-4d56-9bf6-940c8aee357e"
      },
      "message": "This record does not belong to your company.",
      "pointer": [
        "items",
        0,
        "product_id"
      ],
      "section": "body"
    }
  ]
}

POST /public/v1/purchases does not create a purchase with a location that belongs to another company

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDcsImlhdCI6MTcxMjkxNzcwNywiaXNzIjoiRGlzdHJ1IiwianRpIjoiYzNhZTNlNDMtNDhiYi00MDhkLTk2YjMtZTI2YjE5ODZiOThkIiwibmJmIjoxNzEyOTE3NzA2LCJzdWIiOiJVc2VyOjQ0MTQiLCJ0eXAiOiJhY2Nlc3MifQ.NpNWNWYDGU2Uquk4TUOpC8QE6YO6GtJXgwkezK6nKx0
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [],
  "company_id": "00000000-0000-0000-0000-00000000112c",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-0000000004d8",
      "price": "10.000000000",
      "product_id": "6adf974e-7132-4126-9190-1e395f957c6b",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-0000000004d8",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

400
cache-control: max-age=0, private, must-revalidate
content-type: application/json; charset=utf-8
b3: 127c5bdf94dfec000000000000000001-893d635a1c538c37-0
{
  "errors": [
    {
      "context": {
        "id": "f41dd4e6-209e-4135-a4c4-d122663f4ce2"
      },
      "message": "This record does not belong to your company.",
      "pointer": [
        "items",
        0,
        "location_id"
      ],
      "section": "body"
    }
  ]
}

POST /public/v1/purchases does not create a purchase with a location different from the order items

POST /public/v1/purchases
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJEaXN0cnUiLCJleHAiOjE3MTU1MDk3MDgsImlhdCI6MTcxMjkxNzcwOCwiaXNzIjoiRGlzdHJ1IiwianRpIjoiY2YxNDAxMTYtNDVjZC00NTE1LTgxYTQtNDE2NTZmZTA3NjBhIiwibmJmIjoxNzEyOTE3NzA3LCJzdWIiOiJVc2VyOjQ2MTciLCJ0eXAiOiJhY2Nlc3MifQ.t-sdjludvaX5CHMX1OQFaxMcjP0-b7nUGdG6QSgYAvM
content-type: multipart/mixed; boundary=plug_conn_test
{
  "charges": [],
  "company_id": "00000000-0000-0000-0000-0000000011cf",
  "due_datetime": "2020-01-30T00:00:00.000000Z",
  "items": [
    {
      "location_id": "00000000-0000-0000-0000-00000000051e",
      "price": "10.000000000",
      "product_id": "495b5f06-a4d3-44de-84b8-769e7be05d7d",
      "quantity": "1.000000000"
    }
  ],
  "location_id": "00000000-0000-0000-0000-00000000051f",
  "order_datetime": "2020-01-01T00:00:00.000000Z"
}

Response

400
cache-control: max-age=0, private, must-revalidate
content-type: application/json; charset=utf-8
b3: da5fd6a373ad08000000000000000001-89e1c30bfa087aa2-0
{
  "errors": [
    {
      "context": {
        "id": "b8060d89-fdfc-4a0e-aecc-79bd0510f241"
      },
      "message": "Purchase item delivery location must be the same as purchase delivery location.",
      "pointer": [
        "items",
        0,
        "location_id"
      ],
      "section": "body"
    }
  ]
}

Upsert a single purchase order. To update an existing purchase order, pass in an existing purchase order ID in the id field. When updating a purchase order, you must pass in all fields (no sparse update currently supported). Any existing order item or charge you do not pass in to items and charges respectively will be deleted

Request

POST /public/v1/purchases

Parameters

Parameter Description In Type Required Default Example
id Unique ID for this purchase order. If it exists, an update will be performed; otherwise, it will be used as the ID of a new purchase order record query string false
description A description of the purchase order query string false
location_id The location into which the inventory in this purchase will be received query string false
company_id The company that is the supplier for this purchase order query string false
order_datetime The datetime on which the purchase order was placed query string false
due_datetime The datetime by which the purchase order should be paid query string false
charges The additional lines of Charge, Discount, or Tax added to this purchase order body PurchaseChargesRequest false
items The items present on this purchase order body PurchaseItemsRequest false
billing_location_id The billing location's ID query string false

Responses

Status Description Schema
200 A single purchase orders Purchase