Invoice

Upsert an invoice

Create or update a single invoice. This is one endpoint for both: omit id to create a new invoice (Distru assigns the ID and the human-readable invoice number), or pass an existing invoice's id to update it. Same URL, same request shape.

Every invoice bills an existing sales order, so order_id is required and each line item must reference an order item that belongs to that order. This endpoint bills existing order lines — it does not create, reserve, consume, or otherwise move inventory. Inventory is governed by the sales order and its fulfillment, not by invoicing. On save, Distru recalculates the invoice's charge amounts and total and recomputes its payment status from recorded payments; for an update that lowers the total below what has already been paid, the excess is reconciled into a customer credit automatically.

Updates are sparse: any top-level field you omit is left unchanged, and sending an explicit null clears that field. The items and charges collections are optional on update — omit either to leave the existing line items or charges untouched. When you DO send items or charges, that array is the complete set for that collection: any existing entry whose id you leave out is deleted, and passing [] clears them all. A line item or charge sent WITH an id is patched — merged onto the stored row, so you can change one field and omit the rest; one WITHOUT an id is a new entry. If any part of the request is rejected (a bad order item, a validation failure), the whole upsert fails and nothing is changed.

A voided invoice is frozen and cannot be edited through this endpoint — the request is rejected. An invoice is voided automatically when its sales order is canceled (and un-voided if that order later leaves the canceled status), so voiding is driven by the order, not set here.

Side effects reach other systems asynchronously. A successful 200 means the invoice was saved, not that downstream syncs finished: if the company is connected to QuickBooks Online the invoice is queued for sync there, and if the invoice's customer maps to a connected point-of-sale (Treez, Dutchie, or Blaze) it is queued for sync to that POS. Poll the relevant system to observe the synced result. Distru may also email the invoice PDF to the customer when the order is configured to do so.

Required permission: invoices_permissions_create to create a new invoice, or invoices_permissions_edit (plus access to the invoice under team restrictions) to update an existing one.

post/public/v1/invoices

Request body

idstring

ID for this invoice. Omit it to create a new invoice — Distru assigns the ID. Provide an existing invoice's ID to update that invoice; an ID that doesn't exist (or belongs to another company) returns a not-found error.

order_idstring required

The id of the sales order this invoice bills. Required. Determines the invoice's customer and the order items its line items may reference. The order must have a customer and a billing location, and must not be merged. Only set on create in practice — an invoice stays tied to the order it was created for.

due_datetimestring required

The datetime by which the customer should pay the invoice, as an ISO8601 datetime (e.g. 2026-08-30T00:00:00Z). Required on create; on update, omit to leave it unchanged.

invoice_datetimestring required

The datetime the invoice is dated for, as an ISO8601 datetime (e.g. 2026-08-20T00:00:00Z). Required on create; on update, omit to leave it unchanged. This is the date shown on the invoice and the key the list endpoint sorts and filters by.

billing_location_idstring

The id of the location to bill. Optional. Must be a location belonging to the order's customer; an ID that doesn't resolve to such a location is ignored.

owner_idstring

The id of the Distru user who owns this invoice. Optional. Must be a user the caller is allowed to assign under their team restrictions.

external_notesstring

Notes on this invoice that are visible to the customer. Optional.

internal_notesstring

Notes on this invoice that are only visible internally. Optional.

custom_dataobject

A map of custom field IDs to their values. Use GET /public/v1/custom-fields?parent_object=invoice to retrieve available custom fields, their IDs, and their types. The value format depends on the field's type: a text field takes a string, a date field takes a full ISO8601 datetime, and a checkbox field takes an array of its selected options.

Response

A single invoice

Changes

No recorded changes to this endpoint across all 1 revision of this API.