Contents

POST [/instances/$INSTANCE]/private/units#

Create a custom measurement unit or reactivate a previously disabled one.

Required permission: units-write

Request:

The request must be a UnitAddRequest.

Response:

204 No content:

The backend added the unit.

409 Conflict:

A built-in unit with the same short name already exists.

interface UnitAddRequest {
  // Short identifier to reference the unit from products and orders.
  unit: string;

  // Human-readable long label (e.g. "kilogram").
  unit_name_long: string;

  // Human-readable short label (e.g. "kg").
  unit_name_short: string;

  // Optional translations for the long label keyed by BCP 47 language tags.
  unit_name_long_i18n?: { [lang_tag: string]: string };

  // Optional translations for the short label keyed by BCP 47 language tags.
  unit_name_short_i18n?: { [lang_tag: string]: string };

  // Defaults to false; set to true to enable fractional quantities.
  unit_allow_fraction?: boolean;

  // Fractional precision (0-6). Ignored when unit_allow_fraction is false.
  unit_precision_level?: Integer;

  // Defaults to true.
  unit_active?: boolean;
}