openapi: 3.2.0
info:
title: LeafLink Marketplace V2 Buyer Orders API
description: '# Introduction
## HTTP Request Notes
All endpoints covered in this document are preceded by `https://{{domain}}/api/v2/` unless otherwise noted.
Available domains
- `app.leaflink.com` - production environment
- `www.sandbox.leaflink.com` - sandbox environment
- `www.leaflink-integrations.leaflink.com` - integrations sandbox environment
[Learn more about sandbox environments](https://developer.leaflink.com/brands/api/authorization/#sandbox-environments)
Request paths must end in a slash character (''/''). Those that do not will return a 400 (Bad Request) response.
## Dynamic Responses
Some of our API endpoints support dynamic responses. These
are responses that vary in content and/or object level payload size
according to request path or query parameters.
Available parameters are listed beneath endpoint definitions.
'
termsOfService: https://leaflink.com/terms-and-conditions/
contact:
email: support@leaflink.com
version: ''
servers:
- url: https://app.leaflink.com/api/v2
security:
- Token: []
tags:
- name: buyer-orders
paths:
/buyer/orders/:
get:
operationId: buyer-orders_list
summary: List orders
description: List orders sent
parameters:
- name: seller
in: query
description: Filter results by seller id
schema:
type: string
- name: fields_include
in: query
description: Include only specific fields in the response, separated by commas.
schema:
type: string
- name: fields_exclude
in: query
description: Exclude specific fields in the response, separated by commas.
schema:
type: string
- name: fields_add
in: query
description: Include additional fields in the response. Available values include `created_by` and `last_changed_by`
schema:
type: string
- name: include_children
in: query
description: Include additional fields in the response. Available values include `line_items`, `customer`, and `sales_reps`
schema:
type: string
- name: seller__slug__iexact
in: query
description: Filter results the company slug on the seller side of the order. Case-insensitive exact match.
required: false
schema:
type: string
- name: modified__gte
in: query
description: Filter by the modified date, greater than or equal to
required: false
schema:
type: string
- name: modified__lte
in: query
description: Filter by the modified date, less than or equal to
required: false
schema:
type: string
- name: modified__gt
in: query
description: Filter by the modified date, greater than
required: false
schema:
type: string
- name: modified__lt
in: query
description: Filter by the modified date, less than
required: false
schema:
type: string
- name: external_id_seller
in: query
description: Filter by the number assigned to the order by the seller company
required: false
schema:
type: string
- name: external_id_seller__icontains
in: query
description: 'Filter by the number assigned to the order by the seller company. Case-insensitive containment match: returns orders that contain the string'
required: false
schema:
type: string
- name: created_on__gte
in: query
description: Filter by the created_on date, greater than or equal to
required: false
schema:
type: string
- name: created_on__lte
in: query
description: Filter by the created_on date, less than or equal to
required: false
schema:
type: string
- name: created_on__gt
in: query
description: Filter by the created_on date, greater than
required: false
schema:
type: string
- name: created_on__lt
in: query
description: Filter by the created_on date, less than
required: false
schema:
type: string
- name: order_id
in: query
description: Filter by the external_id_seller or the number
required: false
schema:
type: string
- name: number
in: query
description: Filter by the unique order number generated by LeafLink.
required: false
schema:
type: string
- name: status
in: query
description: Filter by status.
required: false
schema:
type: string
enum:
- submitted
- accepted
- backorder
- fulfilled
- shipped
- complete
- rejected
- combined
- cancelled
- name: brand
in: query
description: Filter by brand id
required: false
schema:
type: number
- name: brand__in
in: query
description: Filter by multiple brand ids, separated by commas
required: false
schema:
type: number
- name: paid
in: query
description: Filter by paid status
required: false
schema:
type: string
- name: sales_rep
in: query
description: Filter by the user id of the sales rep assigned to an order. This is the id field on the company-staff object.
required: false
schema:
type: number
- name: classification
in: query
description: Filter by the classification of the license-type associated to the order
required: false
schema:
type: string
- name: user
in: query
description: Filter by the username, first name, or last name of the last person who edited the order
required: false
schema:
type: string
- name: connected_to_metrc
in: query
description: Filter by whether or not they have metrc packages associated with their line items
required: false
schema:
type: string
- name: manual
in: query
description: Filter by whether or not orders were manually created by the company on the seller side of the order
required: false
schema:
type: string
- name: company_slug
in: query
description: Filter by the slug of seller company
required: false
schema:
type: string
- name: service_zone
in: query
description: Filter Orders by service zone of customers
required: false
schema:
type: number
- name: limit
in: query
description: Number of results to return per page.
required: false
schema:
type: integer
- name: offset
in: query
description: The initial index from which to return the results.
required: false
schema:
type: integer
- name: external_id_key
in: query
description: Filter for orders that match external_ids key:values. Must be used with external_id_values.
schema:
type: string
- name: external_id_values
in: query
description: Filter for orders that match external_ids key:values. Multiple values separated by a comma. Must be used with external_id_key.
schema:
type: string
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
count:
type: integer
next:
type: string
format: uri
previous:
type: string
format: uri
results:
type: array
items:
$ref: '#/components/schemas/BuyerOrderResponse'
example:
count: 1
next: null
previous: null
results:
- id: d8240c79-7c90-4177-8c46-919b5577a4c0
short_id: 5577a4c0
status: Shipped
type: Adult Use
buyer:
id: 4231
name: Green Fields
address: 123 Yale St
unit_number: null
city: Denver
state: CO
zip: '80033'
phone: null
licenses:
- id: 4344
number: 402R-00000
type: Recreational
classification: Store
email: greenfields@gmail.com
seller:
id: 2499
name: Liquid Labs
address: 8001 East Boulder Street, Suite A
unit_number: null
city: Denver
state: CO
zip: '80036'
phone: 123-456-7890
licenses:
- id: 2400
number: 404R-00001
type: Recreational
classification: MIPS
- id: 4949
number: 404-00002
type: Medical
classification: MIPS
source: BGO
created_by:
id: 4265
name: John Doe
username: johngreenfields
email: john@greeenfields.com
created_on: '2020-07-12T10:40:00.681487-06:00'
last_edited_on: '2020-07-14T14:13:53.753792-06:00'
currency: USD
line_items:
- product:
id: 237808
sku: 3bb8021c3a214690f0e9
name: Cartridge - Blueberry
brand:
id: 312
name: Premium Cartridges
unit_of_measure: Unit
unit_denomination: One
base_unit_of_measure: Gram
base_units_per_unit: null
sold_in_multiples: true
units_per_case: 10
category:
name: Cartridges
slug: cartridge
description: Cartridge
sub_category:
id: 10
name: Disposable
slug: disposable
description: Disposable
category: 1
quantity: 1
sold_by: Case
price: 220
total: 220
- product:
id: 357811
sku: 14632acc1f10568a0dec
name: Cartridge - Strawberry
brand:
id: 312
name: Premium Cartridges
unit_of_measure: Unit
unit_denomination: One
base_unit_of_measure: Gram
base_units_per_unit: null
sold_in_multiples: true
units_per_case: 10
category:
name: Cartridges
slug: cartridge
description: Cartridge
sub_category:
id: 10
name: Disposable
slug: disposable
description: Disposable
category: 1
quantity: 2
sold_by: Case
price: 200
total: 400
subtotal: 620
shipping_charge: 0
discount: 0
tax: 0
total: 620
payable_to:
name: Labs Capital
address: 321 Broad Street, Suite 12
city: Denver
state: CO
zipcode: '80001'
payment_term: null
payment_methods: []
payment_due_date: null
ship_date: null
shipping_details: null
is_delivered: false
delivered_date: null
notes: ''
sales_reps:
- Lauren Doe
delivery_address:
address: 17034 Highway 17
city: Moffat
state: CO
unit_number: 1A
zipcode: '81143'
tags:
- buyer-orders
components:
schemas:
ProductSubcategoryResponse:
type: object
properties:
id:
type: integer
description: Unique id generated by LeafLink.
name:
type: string
slug:
type: string
description:
type: string
category:
type: integer
description: The id for the category this subcategory belongs to. See `id` in the product-categories response.
BuyerLicense:
type: object
properties:
id:
type: string
number:
type: string
type:
type: string
classification:
type: string
ProductCategoryResponse:
type: object
properties:
id:
type: integer
description: Unique id generated by LeafLink.
name:
type: string
slug:
type: string
description:
type: string
OrderAddress:
type: object
title: Delivery Address
description: Read only delivery address as provided during order creation.
readOnly: true
properties:
address:
title: Address
type: string
unit_number:
title: Unit Number
type: string
city:
title: City
type: string
state:
title: State
description: State abbreviation
type: string
zipcode:
title: Zip Code
type: string
BuyerOrderResponse:
type: object
properties:
id:
format: uuid
description: Unique id generated by LeafLink
type: string
short_id:
description: The _Order No._ displayed in the user interface
type: string
status:
description: Order status
type: string
enum:
- Draft
- Submitted
- Accepted
- Backorder
- Fulfilled
- Shipped
- Complete
- Rejected
- Combined
- Cancelled
type:
description: License type for the order
type: string
buyer:
type: object
description: Company on the buy side of the order
properties:
id:
type: string
name:
type: string
address:
type: string
unit_number:
type: string
city:
type: string
state:
type: string
zip:
type: string
email:
type: string
phone:
type: string
licenses:
type: array
items:
$ref: '#/components/schemas/BuyerLicense'
seller:
type: object
description: Company on the sell side of the order
properties:
id:
type: string
name:
type: string
address:
type: string
unit_number:
type: string
city:
type: string
state:
type: string
zip:
type: string
phone:
type: string
licenses:
type: array
items:
$ref: '#/components/schemas/BuyerLicense'
source:
description: Describes whether this was a buyer or seller generated order `"BGO"` `"SGO"`
type: string
created_by:
description: User who created the order. If BGO, full staff member details. If SGO, the staff member's name.
type: object
properties:
id:
type: string
description: null if SGO
name:
type: string
username:
type: string
description: null if SGO
email:
type: string
description: null if SGO
created_on:
description: Date and time that the order was created
type: string
format: date-time
last_edited_on:
description: Date and time that the order was last edited
type: string
format: date-time
currency:
description: Currency used in the order
type: string
line_items:
type: array
items:
type: object
properties:
product:
type: object
properties:
id:
type: string
sku:
type: string
name:
type: string
brand:
type: objet
properties:
id:
type: string
name:
type: string
unit_of_measure:
type: string
unit_denomination:
type: string
base_unit_of_measure:
type: string
base_units_per_unit:
type: integer
sold_in_multiples:
type: boolean
units_per_case:
type: integer
category:
$ref: '#/components/schemas/ProductCategoryResponse'
sub_category:
$ref: '#/components/schemas/ProductSubcategoryResponse'
quantity:
type: integer
sold_by:
type: string
price:
type: number
total:
type: number
subtotal:
type: number
shipping_charge:
type: number
discount:
type: number
tax:
type: number
total:
type: number
payable_to:
type: object
properties:
name:
type: string
address:
type: string
city:
type: string
state:
type: string
zip:
type: string
payment_term:
$ref: '#/components/parameters/PaymentTerm'
payment_methods:
$ref: '#/components/parameters/PaymentMethods'
payment_due_date:
description: Date the payment is due
type: string
format: date
ship_date:
description: Date and time the order was shipped
type: string
format: date-time
shipping_details:
type: string
description: Shipping notes added by the seller
is_delivered:
type: boolean
delivered_date:
type: string
description: Date and time the order was delivered
notes:
type: string
description: Additional notes added by the seller
sales_reps:
description: Names of the sales reps assigned to the order
type: array
items:
type: string
delivery_address:
$ref: '#/components/schemas/OrderAddress'
example:
id: d8240c79-7c90-4177-8c46-919b5577a4c0
short_id: 5577a4c0
status: Shipped
type: Adult Use
buyer:
id: 4231
name: Green Fields
address: 123 Yale St
unit_number: null
city: Denver
state: CO
zip: '80033'
phone: null
licenses:
- id: 4344
number: 402R-00000
type: Recreational
classification: Store
email: greenfields@gmail.com
seller:
id: 2499
name: Liquid Labs
address: 8001 East Boulder Street, Suite A
unit_number: null
city: Denver
state: CO
zip: '80036'
phone: 123-456-7890
licenses:
- id: 2400
number: 404R-00001
type: Recreational
classification: MIPS
- id: 4949
number: 404-00002
type: Medical
classification: MIPS
source: BGO
created_by:
id: 4265
name: John Doe
username: johngreenfields
email: john@greeenfields.com
created_on: '2020-07-12T10:40:00.681487-06:00'
last_edited_on: '2020-07-14T14:13:53.753792-06:00'
currency: USD
line_items:
- product:
id: 237808
sku: 3bb8021c3a214690f0e9
name: Cartridge - Blueberry
brand:
id: 312
name: Premium Cartridges
unit_of_measure: Unit
unit_denomination: One
base_unit_of_measure: Gram
base_units_per_unit: null
sold_in_multiples: true
units_per_case: 10
category:
id: 1
name: Cartridges
slug: cartridge
description: Cartridge
sub_category:
id: 10
name: Disposable
slug: disposable
description: Disposable
category: 1
quantity: 1
sold_by: Case
price: 220
total: 220
- product:
id: 357811
sku: 14632acc1f10568a0dec
name: Cartridge - Strawberry
brand:
id: 312
name: Premium Cartridges
unit_of_measure: Unit
unit_denomination: One
base_unit_of_measure: Gram
base_units_per_unit: null
sold_in_multiples: true
units_per_case: 10
category:
id: 1
name: Cartridges
slug: cartridge
description: Cartridge
sub_category:
id: 10
name: Disposable
slug: disposable
description: Disposable
category: 1
quantity: 2
sold_by: Case
price: 200
total: 400
subtotal: 620
shipping_charge: 0
discount: 0
tax: 0
total: 620
payable_to:
name: Labs Capital
address: 321 Broad Street, Suite 12
city: Denver
state: CO
zipcode: '80001'
payment_term: null
payment_methods: []
payment_due_date: null
ship_date: null
shipping_details: null
is_delivered: false
delivered_date: null
notes: ''
sales_reps:
- Lauren Doe
delivery_address:
address: 17034 Highway 17
city: Moffat
state: CO
unit_number: 1A
zipcode: '81143'
parameters:
PaymentTerm:
name: payment_term
title: Payment Term
description: 'Deprecated field, please use payment_option instead
Customer''s payment terms
Enum: "llf" "cod" "net3" "net7"
"net10" "net14" "net15" "net20"
"net30" "net60" "net90" "prepay" "consign"
Deprecated values (will be mapped appropriately):
(1, "Cash") replaced with "cod"
(2, "Net 7") replaced with "net7"
(3, "Net 15") replaced with "net15",
(4, "Net 30") replaced with "net30"
(5, "Net 10") replaced with "net10"
(6, "Net 20") replaced with "net20
(7, "Net 60") replaced with "net60"
(8, "Net 3") replaced with "net3"
(9, "Net 14") replaced with "net14"
(10, "Pre-Payment") replaced with "prepay"
(11, "LeafLink Financial - Net 30") replaced with "llf" with payment_methods ["ach"]
(12, "Consignment") replaced with "consign"
(13, "LeafLink Financial - Net 15") replaced with "llf" with payment_methods ["ach"]
(14, "Net 90") replaced with "net90"
(15, "Wire on Delivery") replaced with "cod" with payment_methods ["wire"]
(20, "COD") replaced with "cod"
(21, "LeafLink Financial") replaced with "llf" with payment_methods ["ach"]
'
schema:
type: string
PaymentMethods:
name: payment_methods
title: Payment Methods
description: 'Deprecated field, please use payment_option instead
Customer''s payment method
Enum: "cash" "check" "wire" "ach"'
schema:
type: array
items:
type: string
securitySchemes:
Token:
description: 'You must authenticate your requests by including your API key in each request header as described below.
Requests should include a header named `Authorization`, with the value `App {MY_API_KEY}`. Note the single space in the header value.
Example: `Authorization: App MY_API_KEY`
[Learn more about generating your key](https://developer.leaflink.com/brands/api/getting-started/)
**Legacy API keys:** If you are not using an Application API key, your authorization header should include the string `Token` and access will be scoped to all companies under which the user exists as a companystaff.
Example: `Authorization: Token MY_API_KEY`
'
in: header
name: Authorization
type: apiKey
x-tagGroups:
- name: Orders
tags:
- order-object
- orders-received
- order-payments
- order-sales-reps
- order-event-logs
- line-item-object
- line-items
- name: Products
tags:
- product-object
- products
- product-categories
- product-subcategories
- listing-states
- product-images
- product-lines
- strains
- name: Batches
tags:
- batch-object
- batches
- product-batch-object
- product-batches
- batch-document-object
- batch-documents
- name: Inventory Items
tags:
- inventory-item-object
- inventory-items
- name: Facilities
tags:
- facility-object
- facilities
- name: Customers
tags:
- customer-object
- customers
- contacts
- activity-entries
- customer-statuses
- customer-tiers
- credits
- customer-tags
- name: Company Information
tags:
- companies
- company-staff
- licenses
- license-types
- brands
- promocodes
- reports
- name: Buyer Orders
tags:
- buyer-order-object
- buyer-orders
- name: Retailer Inventory
tags:
- retailer-inventory