---
title: "Upsert a product group"
method: POST
path: "/public/v1/product-groups"
tags: ["ProductGroup"]
---

# 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`.

## Request body

- object
  - `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, required — 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 `200`

The updated product group

## Other responses

- `201` — The created product group
- `400` — Invalid parameters
- `401` — Missing or invalid API token
- `403` — The API token lacks the required permission
- `404` — Not Found

---

[API](https://skmtc.dev/distru/apis/distru-api.md) · [All operations](https://skmtc.dev/distru/apis/distru-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/distru/distru-api/revisions/eb775b7b6ee0/schema)
