APIProduct group

Upsert a product group

POST
/public/v1/product-groups

Creates or updates a single product group. Pass id to update the matching group; omit id to create a new one. A create returns 201, an update returns 200.

name is the only editable field and is required on both create and update; the update replaces the group's name. A group's name must be unique within the company, compared case-insensitively (Flower and flower collide) — a duplicate is rejected with a 400. The name may contain only letters, digits, spaces, underscores, and the characters ~ # - $ / | % & ' ( ) .; any other special character, and two colons in a row (::), are rejected with a 400.

Assigning products to a group is not done here: a product's group is set on the product itself, not on this endpoint. This endpoint only defines the group's identity.

Required permission: settings_permissions_product_groups.

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

application/json
  1. body
id?string

The Distru ID of the product group to update, as returned in a product group response. Present updates that group; absent creates a new one.

name*string

The group's display name. Required on both create and update. Must be unique within the company, compared case-insensitively (Flower and flower collide). May contain only letters, digits, spaces, underscores, and the characters ~ # - $ / | % & ' ( ) .; any other special character, and two colons in a row (::), are rejected with a 400.

Response Body

The updated product group

*/*
  1. response

A single product group

data?

A product group

Example Request
curl -X POST 'https://app.distru.com/public/v1/product-groups' \  -H 'Content-Type: application/json' \  -d '{  "name": "Flower - Indoor"}'
Example Response
{  "data": {    "id": "string",    "inserted_datetime": "string",    "name": "string",    "updated_datetime": "string"  }}