APIProduct

Bulk update products

POST
/public/v1/products/bulk-update

Set the same values on up to 200 products in one call, and get back one result per product. Send the product IDs in product_ids and the fields to set in changes. Use it for catalog changes shared by many products, such as reassigning owners, moving products to another category or vendor, or setting a price or a custom field; for values that differ per product (name, SKU, unit type), tags or menus, use POST /public/v1/products on each product.

changes is sparse: a field you omit is left unchanged on every product, and a field sent as null is cleared, except those a product can't be without (vendor_id, category_id, unit_price, is_featured), which refuse null. custom_data itself can't be null: clear custom fields one by one with a null value. Listed products are updated whether active or inactive.

Changing the owner (owner_id, null included) also updates every package of each product, about 1,000 packages a second, so it is limited by the products' package count too: the listed products may have up to 50000 packages in total, counting every package ever made of them, finished and inactive ones included. Above that the request is refused with a 400; send fewer products per request.

The request is checked as a whole first. It is refused, and no product is changed, when product_ids is empty, has more than 200 entries, lists an ID that doesn't exist for your company (404) or that your team can't see (403), when changes is empty or invalid (an unknown or another company's ID, an owner you can't assign, a subcategory that isn't in category_id, an unknown custom field, a value of the wrong type), when the package limit above is passed, or when the change would break a product rule for any listed product (for example a quantity_available_threshold_max below a product's quantity_available_threshold_min; the error names those products).

Then the products are saved in groups, each group on its own, in name order. A product that fails doesn't stop the others, and the ones saved stay saved, even when a later group fails or the request is cut off. The 200 response lists every product, in name order, each with a status: • UPDATED: saved. Also returned when the product already had these values. • FAILED: not saved; message says why.

A request that times out may have saved some products and may still be saving: wait, read them back with GET /public/v1/products/{id}, then resend only the products not yet changed, in smaller requests.

A saved product has the same effects as a single update: webhooks fire, a new unit_price updates linked LeafLink products when your LeafLink settings sync prices, and a new unit_cost updates the default cost of the products' inventory in the background. No inventory moves, and nothing is sent to Metrc or BioTrack.

Required permission: products_permissions_edit, plus access to every listed product under team restrictions.

Authorization

Bearer
headerAuthorizationBearer <token>

API token generated in Distru (Settings → Distru API). Send it on every request as Authorization: Bearer YOUR_API_TOKEN.

Request Body

The products and the changes

application/json
  1. body
changes*

The fields to set on every listed product. Omit a field to leave it unchanged; send null to clear it, where the field allows it.

product_ids*array<string>

The IDs of the products to update, 1 to 200 entries, repeats included. Every one must be a product of your company that your team can see, active or inactive. A repeated ID gets one result.

Response Body

One result per product

*/*
  1. response
data*array<>

One result per product, in name order.

Example Request
curl -X POST 'https://app.distru.com/public/v1/products/bulk-update' \  -H 'Content-Type: application/json' \  -d '{  "changes": {    "brand_id": null,    "category_id": "00000000-0000-0000-0000-000000000348",    "custom_data": {      "102": "X"    },    "description": "D",    "is_featured": true,    "owner_id": "00000000-0000-0000-0000-000000001266",    "quantity_available_threshold_min": 2,    "subcategory_id": "00000000-0000-0000-0000-00000000031c",    "unit_price": "12.5",    "vendor_id": "00000000-0000-0000-0000-00000000054d"  },  "product_ids": [    "0a0cbff4-cfa4-41fe-bc01-80c59d4f3920",    "prod_cfd5a278-e0b9-4563-b3f5-b2630185080d",    "0a0cbff4-cfa4-41fe-bc01-80c59d4f3920"  ]}'
Example Response
{  "data": [    {      "message": null,      "product_id": "cfd5a278-e0b9-4563-b3f5-b2630185080d",      "status": "UPDATED"    },    {      "message": null,      "product_id": "0a0cbff4-cfa4-41fe-bc01-80c59d4f3920",      "status": "UPDATED"    }  ]}