Get inventory levels
Changed onGet on-hand inventory levels rolled up by a caller-chosen set of attributes. Each returned row is one group, and the groupings you request decides both how quantities are aggregated and which id fields (product_id, location_id, batch_number) appear on each row. Only active, positive-quantity, sellable stock is counted — inventory that has been consumed, voided, transferred out, or fully sold is excluded, as is any stock whose product has been deactivated. Results are always scoped to the company that owns the API key.
Results can be narrowed to specific products (product_ids), locations (location_ids), and batches (batch_ids), or by attributes of the underlying product — category, subcategory, group, strain, brand, vendor, tag, and SKU. All filters are AND-ed together; within a single multi-valued filter the values are OR-ed.
Groups with 0 active and 0 available quantity are omitted from the response. Groups are sorted ascending by the ids of the attributes they are grouped by, in the order those attributes appear in groupings.
Results are paginated. Page size is fixed by the server; the response next_page holds the URL of the following page, or null on the last page. Follow it to walk every group rather than building page selectors yourself. next_page carries an opaque page[after] cursor that resumes right after the last group of the page, so a group that appears or disappears between requests does not shift the pages after it.
Grouping by BATCH_NUMBER behaves specially: • Products that track inventory at the product level (not by batch) are excluded entirely — they only surface when you do not group by BATCH_NUMBER. • reserved cannot be determined at the batch/package granularity, so it is always returned as "0" and available equals active for every row.
This is a read-only endpoint. It returns eventually consistent data: a change to inventory (a sale, a receipt, an adjustment) can take up to roughly 1 second to be reflected here, so a value read immediately after a write may still be stale.
Required permission: products_permissions_view.
Request
- Base URLhttps://app.distru.com
- AuthHTTP bearer
Query parameters
Required. The attributes to roll inventory up by, in SCREAMING_CASE. Accepted values are PRODUCT, LOCATION and BATCH_NUMBER. PRODUCT must always be included; a request without it is rejected. The order you list attributes in is the order rows are sorted by (ascending on each attribute's id). Each requested attribute adds its id field to every returned row: PRODUCT → product_id, LOCATION → location_id, BATCH_NUMBER → batch_number; attributes you omit are not broken out and their id field is absent from the rows. Including BATCH_NUMBER also drops product-tracked products from the results and forces reserved to "0" (see the endpoint description).
Restrict the results to these products, each identified by its Distru product id. Omit to include every product in the company. Ids that do not belong to the company are silently ignored. When BATCH_NUMBER is in groupings, product-tracked products among these ids are still excluded, just as they are for an unfiltered request (see the groupings param).
Restrict the results to inventory held at these locations, each identified by its Distru location id. Omit to include every location. Applies whether or not LOCATION is in groupings; ids that do not belong to the company are silently ignored.
Restrict the results to inventory from these batches, each identified by its Distru batch id. Omit to include every batch. Applies whether or not BATCH_NUMBER is in groupings; ids that do not belong to the company are silently ignored.
Restrict the results to inventory of products in any of these product categories, each identified by its Distru product category id. Multiple ids are OR-ed. Omit to include every category; ids that do not belong to the company match nothing. At most 200 ids.
Restrict the results to inventory of products in any of these product subcategories, each identified by its Distru product subcategory id. Multiple ids are OR-ed. Omit to include every subcategory; ids that do not belong to the company match nothing. At most 200 ids.
Restrict the results to inventory of products in any of these product groups, each identified by its Distru product group id. Multiple ids are OR-ed. Omit to include every group; ids that do not belong to the company match nothing. At most 200 ids.
Restrict the results to inventory of products with any of these strains, each identified by its Distru strain id. Multiple ids are OR-ed. Omit to include every strain; ids that do not belong to the company match nothing. At most 200 ids.
Restrict the results to inventory of products with any of these brands, each identified by its Distru brand id (a company-relationship id, not a raw company id). Multiple ids are OR-ed. Omit to include every brand; ids that do not belong to the company match nothing. At most 200 ids.
Restrict the results to inventory of products supplied by any of these vendors, each identified by its Distru vendor id (a company-relationship id, not a raw company id). Multiple ids are OR-ed. Omit to include every vendor; ids that do not belong to the company match nothing. At most 200 ids.
Restrict the results to inventory of products carrying any of these tags, each identified by its Distru tag id. Multiple ids are OR-ed. Omit to include products regardless of tags; ids that do not belong to the company match nothing. At most 200 ids.
Restrict the results to inventory of products whose SKU exactly matches (case-insensitive) any value in the list. Multiple values are OR-ed. Omit to include every SKU. At most 200 values.
Page selector. Page size is fixed by the server; paginate by following the next_page URL in each response rather than building page selectors yourself — it is null on the last page. next_page uses page[after]=<cursor>, an opaque token marking where the next page resumes; pass it back exactly as given, and only to the endpoint that issued it. A cursor is tied to the groupings it was issued for: send the same groupings with it, or the request is rejected.
Response
A list of active and available quantity for each group
Changes
- info
added the new optional
queryrequest parameterpage
- info
- warning
deleted the
queryrequest parameterpage
- warning