openapi: 3.2.0
info:
title: LeafLink Marketplace V2 Line Items 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:
- description: The LineItem model represents a single entry in an itemized purchase order.
name: line-items
paths:
/line-items/:
get:
operationId: line-items_list
summary: List line items
description: "List line items for all active companies where the user has the Manage Orders Received permission.\n
\n
Line items can also be retrieved by order via /orders-received/{order_number}/line-items\n
or by company via /companies/{company_id}/line-items/"
parameters:
- name: expand
in: query
description: Expand an id field into its full object. Supported values include `product`.
required: false
schema:
type: string
- name: id
in: query
description: Filter by id
required: false
schema:
type: number
- name: product__name
in: query
description: Filter by product name.
required: false
schema:
type: string
- name: product_id
in: query
description: Filter by product id.
required: false
schema:
type: string
- name: order
in: query
description: Filter by order number or external_id_seller. Multiple values may be separated by commas.
required: false
schema:
type: string
- name: is_sample
in: query
description: Filter by sample status.
required: false
schema:
type: string
- name: order__created_on__gte
in: query
description: Filter by Order created_on, greater than or equal to
required: false
schema:
type: string
- name: order__created_on__lte
in: query
description: Filter by Order created_on, less than or equal to
required: false
schema:
type: string
- name: order__ship_date__gte
in: query
description: Filter by Order ship_date, greater than or equal to
required: false
schema:
type: string
- name: order__ship_date__lte
in: query
description: Filter by Order ship_date, less than or equal to
required: false
schema:
type: string
- name: order__modified__gte
in: query
description: Filter by Order modified, greater than or equal to
required: false
schema:
type: string
- name: order__modified__lte
in: query
description: Filter by Order modified, less than or equal to
required: false
schema:
type: string
- name: order__customer__cities
in: query
description: Filter by Order Customer cities, separated by commas.
required: false
schema:
type: string
- name: order__customer__managers
in: query
description: Filter by Order Customer managers, separated by commas.
required: false
schema:
type: string
- name: order__customers
in: query
description: Filter by Order Customer, separated by commas.
required: false
schema:
type: string
- name: company_slug
in: query
description: Filter by seller company slug
required: false
schema:
type: string
- name: order__service_zone
in: query
description: Filter by order__service_zone
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
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
count:
type: integer
next:
type:
- string
- 'null'
format: uri
previous:
type:
- string
- 'null'
format: uri
results:
type: array
items:
$ref: '#/components/schemas/LineItemResponse'
tags:
- line-items
post:
operationId: line-items_create
summary: Create line item
description: "Create a line item for an existing order.\n\n > ⚠️ **WARNING - BETA FEATURE**\n >\n > This API is in active development and is subject to change.\n"
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LineItemCreate'
example:
product: 2093
quantity: 10
notes: Please include sample
ordered_unit_price:
amount: 108
currency: USD
sale_price:
amount: 99
currency: USD
order: 93b532b3-a125-4cd2-9b71-9996b1e164ce
x-s2o-overloaded: true
responses:
'201':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/LineItemResponse'
tags:
- line-items
x-s2o-warning: Operation line-items_create has multiple requestBodies
/line-items/{id}/:
parameters:
- name: id
in: path
description: A unique integer value identifying this ordered product.
required: true
schema:
type: integer
get:
operationId: line-items_read
summary: Retrieve a line item
description: Retrieve an individual line item
parameters:
- name: expand
in: query
description: Expand an id field into its full object. Supported values include `product`.
required: false
schema:
type: string
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/LineItemResponse'
tags:
- line-items
patch:
operationId: line-items_partial_update
summary: Update a line item
description: Update an existing line item
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LineItemUpdate'
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/LineItemResponse'
tags:
- line-items
delete:
operationId: line-items_delete
summary: Delete a line item
description: Delete a line item
responses:
'204':
description: ''
tags:
- line-items
/orders-received/{number}/line-items/:
parameters:
- name: number
in: path
description: Order number
required: true
schema:
type: string
get:
operationId: orders-received-line-items_list
summary: List line items
description: List line items for an order.
responses:
'200':
description: ''
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LineItemResponse'
tags:
- line-items
components:
schemas:
LineItemCreate:
required:
- ordered_unit_price
- quantity
- sale_price
- product
type: object
title: Line Item
properties:
ordered_unit_price:
description: Price at the time the order was placed
required:
- amount
- currency
type: object
properties:
amount:
title: Amount
type: string
format: decimal
currency:
title: Currency
type: string
minLength: 1
sale_price:
description: Sale price for this order
required:
- amount
- currency
type: object
properties:
amount:
title: Amount
type: string
format: decimal
currency:
title: Currency
type: string
minLength: 1
quantity:
title: Quantity
description: Number of units ordered
type: string
format: decimal
product:
title: Product
description: id for the product
type: string
order:
title: Order
description: The number of the order this line item is attached to. Optional for line items embedded in an order object.
type:
- string
- 'null'
format: uuid
notes:
title: Notes
description: Notes for this specific ordered product
type:
- string
- 'null'
is_sample:
title: Is sample
description: Is this line item a sample?
type: boolean
unit_multiplier:
title: Unit multiplier
description: How many individual units are sold when compared to the assigned unit of measure
type: integer
is_medical_line_item:
title: Is medical line item
description: Is this a medical line item?
type: boolean
is_packed:
title: Is packed
description: Is the line-item packed?
type: boolean
packed_at:
title: Packed at
description: Date and time this line-item was packed
type:
- string
- 'null'
format: date-time
packed_by:
title: CompanyStaff user
description: The CompanyStaff user that packed this product
type:
- integer
- 'null'
unit_of_measure:
title: Unit of measure
description: Units this product is measured in
type: string
readOnly: true
position:
title: Position
description: Position for this line item in the displayed list of line items on the order
type:
- integer
- 'null'
batch:
title: Batch
description: Batch that should be displayed in invoice.
type:
- integer
- 'null'
package_tags:
title: Package tags
description: Tags associated to line items via attached packages.
type: string
readOnly: true
wholesale_price:
title: Wholesale price
description: Wholesale Price
type:
- string
- 'null'
format: decimal
LineItemUpdate:
type: object
properties:
ordered_unit_price:
description: Price at the time the order was placed
required:
- amount
- currency
type: object
properties:
amount:
title: Amount
type: string
format: decimal
currency:
title: Currency
type: string
minLength: 1
quantity:
title: Quantity
description: Number of units ordered
type: string
format: decimal
notes:
title: Notes
description: Notes for this specific ordered product
type:
- string
- 'null'
is_sample:
title: Is sample
description: Is this line item a sample?
type: boolean
sale_price:
description: Alternative sale price
required:
- amount
- currency
type: object
properties:
amount:
title: Amount
type: string
format: decimal
currency:
title: Currency
type: string
minLength: 1
is_packed:
title: Is packed
description: Is the line-item packed?
type: boolean
packed_at:
title: Packed at
description: Date and time this line-item was packed
type:
- string
- 'null'
format: date-time
packed_by:
title: CompanyStaff user
description: The CompanyStaff user that packed this product
type:
- integer
- 'null'
position:
title: Position
description: Position for this line item in the displayed list of line items on the order
type:
- integer
- 'null'
batch:
title: Batch
description: Batch that should be displayed in invoice.
type:
- integer
- 'null'
LineItemResponse:
type: object
properties:
id:
title: Id
description: id of the line item
type: integer
ordered_unit_price:
description: Price at the time the order was placed
required:
- amount
- currency
type: object
properties:
amount:
title: Amount
type: string
format: decimal
currency:
title: Currency
type: string
minLength: 1
quantity:
title: Quantity
description: Number of units ordered
type: string
format: decimal
order:
title: Order
description: The number of the order this line item is attached to. `number` or `order_number` on the order object.
type:
- string
- 'null'
format: uuid
product:
title: Product
description: id for the product
type: string
notes:
title: Notes
description: Notes for this specific ordered product
type:
- string
- 'null'
is_sample:
title: Is sample
description: Is this line item a sample?
type: boolean
sale_price:
description: Alternative sale price
required:
- amount
- currency
type: object
properties:
amount:
title: Amount
type: string
format: decimal
currency:
title: Currency
type: string
minLength: 1
unit_multiplier:
title: Unit multiplier
description: How many individual units are sold when compared to the assigned unit of measure
type: integer
is_medical_line_item:
title: Is medical line item
description: Is this a medical line item?
type: boolean
is_packed:
title: Is packed
description: Is the line-item packed?
type: boolean
packed_at:
title: Packed at
description: Date and time this line-item was packed
type:
- string
- 'null'
format: date-time
packed_by:
title: CompanyStaff user
description: The CompanyStaff user that packed this product
type:
- integer
- 'null'
unit_of_measure:
title: Unit of measure
description: Units this product is measured in
type: string
readOnly: true
position:
title: Position
description: Position for this line item in the displayed list of line items on the order
type:
- integer
- 'null'
bulk_units:
title: Bulk units
description: The number of units of bulk available. quantity / unit_multiplier
type: integer
on_sale:
title: On sale
description: Is this line item on sale?
type: boolean
is_backorder:
title: Is backorder
description: Is this line item backordered?
type:
- boolean
- 'null'
order_id:
title: Order id
type: string
readOnly: true
batch:
title: Batch
description: Batch that should be displayed in invoice.
type:
- integer
- 'null'
package_tags:
title: Package tags
description: Tags associated to line items via attached packages.
type: string
readOnly: true
frozen_data:
title: Frozen data
type: object
wholesale_price:
title: Wholesale price
description: Wholesale Price
type:
- string
- 'null'
format: decimal
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