# Distru API > Distru is an ERP for the cannabis industry. Its REST API manages the full supply chain — products, inventory, sales orders, invoices, purchases, manufacturing, and compliance syncing with state traceability systems (Metrc, BioTrack). All endpoints live under `https://app.distru.com/public/v1/`. Requests and responses are JSON. API access must be enabled for your account by a Distru representative; a sandbox environment is available on request. ## How agents should use this API - For reference material, fetch [the full documentation](https://apidocs.distru.dev/llms-full.txt) — the complete docs as one Markdown file, with one section per resource. Use [the OpenAPI 3.0 specification](https://apidocs.distru.dev/openapi.json) for exact request/response schemas and to generate typed clients. - Authenticate every request with `Authorization: Bearer ` plus `Content-Type: application/json` and `Accept: application/json`. An admin creates tokens in the Distru app under Settings → Integrations → Distru API. A token carries the creating admin's permissions — keep it server-side. - Treat every id as an opaque string. Never parse, construct, or guess ids. - Paginate by following the `next_page` URL in each list response until it is absent. Never assume a page size — the server may change it at any time. - Writes use upsert endpoints: one `POST` serves create and update (`id` absent → create, `id` present → update). Updates are sparse: an omitted field is left unchanged, `null` clears a field. Nested collections (`items`, `charges`) may be omitted entirely to leave existing rows untouched; sending one replaces the whole set (an existing row whose id you omit is deleted, `{"id": "..."}` alone keeps a row unchanged, an entry without an id is added) — see each endpoint's docs for its exact semantics. - Enums are SCREAMING_CASE in both requests and responses (`"COMPLETED"`, not `"completed"`), with a few exceptions — check the OpenAPI spec or the endpoint's docs for the exact values. - Array filters repeat a bracketed key (`?ids[]=a&ids[]=b`), max 200 values. Datetime filters are inclusive comma ranges: `?updated_datetime=,` (omit one side for open-ended). - Every error has one shape: `{ "errors": [ { "message": "...", "pointer": ["items", 0, "quantity"] } ] }` where `pointer` is the path to the offending request field (`["base"]` for whole-request errors). The only status codes are 200/201, 400 (bad input), 401 (bad token), 403 (missing permission), 404 (no such record for your company), and 429. The API never returns 422. - Only PDF endpoints (paths ending in `/pdf`) are rate limited: 20/minute and 1,000/day per account across all PDF endpoints. A 429 includes a `Retry-After` header — honor it; the window is sliding. - Webhooks push create/edit/delete events to your endpoint for the main entity types (orders, invoices, purchases, and more — see the webhooks docs). To maintain a near-real-time local copy of Distru records, periodically poll each list endpoint with an `updated_datetime` lower bound and upsert the results locally; this works for every entity type. - Breaking changes are announced only through the [email list](https://share.hsforms.com/1ui8lKXQ2RAaytYEyEphCiQ2usrt) — advise integrators to sign up. ## Documentation - [Full documentation](https://apidocs.distru.dev/llms-full.txt): Complete API docs as one Markdown file. - [Agent Skill](https://apidocs.distru.dev/SKILL.md): Installable SKILL.md teaching an agent this API's conventions — save it into your agent's skills directory. - [OpenAPI 3.0 specification](https://apidocs.distru.dev/openapi.json): Machine-readable schemas for every endpoint and model. - [Authentication](https://apidocs.distru.dev/#authentication): Creating and using API tokens. - [Handling errors](https://apidocs.distru.dev/#handling-errors): The error envelope and status codes. - [Pagination](https://apidocs.distru.dev/#pagination): Cursor pagination via `next_page` URLs. - [Sparse updates](https://apidocs.distru.dev/#sparse-updates): Upsert semantics for partial updates and nested collections. - [Webhooks](https://apidocs.distru.dev/#webhooks): Real-time create/edit/delete notifications. - [Rate limiting](https://apidocs.distru.dev/#rate-limiting): PDF download limits and `Retry-After`. - [Changelog](https://apidocs.distru.dev/#changelog): Dated API changes, newest first. ## Sales - [Order](https://apidocs.distru.dev/#order): Sales orders and their line items, charges, and status lifecycle. - [Invoice](https://apidocs.distru.dev/#invoice): Invoices generated from sales orders. - [Payment](https://apidocs.distru.dev/#payment): Payments applied to invoices. - [PaymentMethod](https://apidocs.distru.dev/#paymentmethod): Available payment methods. - [PaymentTerm](https://apidocs.distru.dev/#paymentterm): Payment terms (e.g. net-30). - [Credit](https://apidocs.distru.dev/#credit): Customer credits and their application. - [Return](https://apidocs.distru.dev/#return): Returns of sold inventory. - [Menu](https://apidocs.distru.dev/#menu): Sales menus controlling product visibility. - [PriceTier](https://apidocs.distru.dev/#pricetier): Tiered pricing rules applied to order items. ## Purchasing & manufacturing - [Purchase](https://apidocs.distru.dev/#purchase): Purchase orders; receiving moves inventory into a location. - [Assembly](https://apidocs.distru.dev/#assembly): Manufacturing runs consuming input inventory and producing outputs. - [Cost](https://apidocs.distru.dev/#cost): Costs attached to batches, packages, and products. - [CostType](https://apidocs.distru.dev/#costtype): Categories for costs. ## Inventory & compliance - [Inventory](https://apidocs.distru.dev/#inventory): Current inventory quantities by product, batch, and location. - [Package](https://apidocs.distru.dev/#package): Compliance packages, including Metrc-synced operations. - [Batch](https://apidocs.distru.dev/#batch): Production batches tying inventory to test results and costs. - [Bin](https://apidocs.distru.dev/#bin): Storage bins within locations. - [Location](https://apidocs.distru.dev/#location): Licensed locations inventory lives in. - [StockAdjustment](https://apidocs.distru.dev/#stockadjustment): Manual inventory adjustments. - [Metrc](https://apidocs.distru.dev/#metrc): Metrc-specific resources such as transfers and items. - [TestResult](https://apidocs.distru.dev/#testresult): Lab test results attached to batches. ## Catalog - [Product](https://apidocs.distru.dev/#product): The product catalog. - [ProductCategory](https://apidocs.distru.dev/#productcategory): Product categories. - [ProductSubcategory](https://apidocs.distru.dev/#productsubcategory): Product subcategories. - [ProductGroup](https://apidocs.distru.dev/#productgroup): Groupings of related products. - [ProductPosMapping](https://apidocs.distru.dev/#productposmapping): Mappings between Distru products and POS systems. - [OfficialProductCategory](https://apidocs.distru.dev/#officialproductcategory): State-defined product categories. - [Strain](https://apidocs.distru.dev/#strain): Cannabis strains. - [UnitType](https://apidocs.distru.dev/#unittype): Units of measure. - [Tag](https://apidocs.distru.dev/#tag): Tags for organizing records. ## Companies & people - [Company](https://apidocs.distru.dev/#company): Customer and vendor companies. - [CompanyGroup](https://apidocs.distru.dev/#companygroup): Groupings of related companies. - [Contact](https://apidocs.distru.dev/#contact): Contacts at companies. - [User](https://apidocs.distru.dev/#user): Users in your Distru account. - [Driver](https://apidocs.distru.dev/#driver): Delivery drivers. - [Vehicle](https://apidocs.distru.dev/#vehicle): Delivery vehicles. ## Other - [CustomField](https://apidocs.distru.dev/#customfield): Custom field definitions; values ride on records as `custom_data`. - [FileAttachment](https://apidocs.distru.dev/#fileattachment): Files attached to records. - [Task](https://apidocs.distru.dev/#task): Tasks and to-dos. - [Tax](https://apidocs.distru.dev/#tax): Tax definitions applied to orders. - [Reports](https://apidocs.distru.dev/#reports): Prebuilt report data (COGS, transaction history, and more).