Create Unit Group Associated Unit

Beta
POST/v1/catalog/unit-groups/{unit_group_id}/units

Idempotent with Idempotency-Key header. Learn more

Adds a unit to a unit group so that products using the group can be ordered in it.

A unit can appear in a group only once, so use the update endpoint to change the discount or visibility of a unit that is already associated. Units cannot be added to system unit groups.

Permissions requiredValues:unit_groups:update
The role behind your API key or agent must grant every one of these permissions.
unit_group_idstring

Unit group ID.

include[]optional arrayenumValues:unit

Sub-objects to expand in the response. When omitted, sub-objects are returned as null.

unit_idstring

ID of the unit to associate with the group.

The unit's dimension must match the group's type.

discount_percentageoptional number

Share of the unit's price removed when an order is placed in this unit. Defaults to 1.

Expressed as a decimal fraction rather than a whole number, so 0.1 is a 10% discount. Send 0 explicitly for no discount — omitting the field stores a discount of 1, which removes the entire price.

discount_fixedoptional number

Flat amount subtracted from the unit's price when an order is placed in this unit. Defaults to 0.

Subtracted before discount_percentage is applied.

customer_portal_visibilityoptional stringenumValues:visiblehidden

Whether the unit is shown to customers in the customer portal. Defaults to visible.

idstring

Unit group unit ID.

objectstringenumValues:unit_group_unit

Resource type identifier.

unitunitExpandablenullable

The unit this association refers to.

idstring

Unit ID.

objectstringenumValues:unit

Resource type identifier.

namestring

Display name of the unit (e.g. "Gram", "Kilogram").

abbreviationstring

Short abbreviation for the unit (e.g. "g", "kg").

typestringenumValues:currencyquantitytime

The dimension this unit measures, such as mass, volume, or currency.

A unit can only be converted to another unit of the same dimension. The quantity dimension is for discrete countable items rather than a physical measure.

ratio_numeratorstring (decimal)

Numerator of the ratio that converts a quantity in this unit into the dimension's base unit.

A quantity is converted with value × (ratio_numerator / ratio_denominator) + (offset_numerator / offset_denominator), so a kilogram in a gram-based dimension has a numerator of 1000 and a denominator of 1.

ratio_denominatorstring (decimal)

Denominator of the ratio that converts a quantity in this unit into the dimension's base unit.

Cannot be zero.

offset_numeratorstring (decimal)

Numerator of the conversion offset, applied after the ratio for scales that do not share a zero point, such as temperature.

Zero for units that convert by ratio alone.

offset_denominatorstring (decimal)

Denominator of the conversion offset applied after the ratio.

Never zero; a unit with no offset carries a numerator of 0 over a denominator of 1.

is_base_unitboolean

Whether this is the base unit for its dimension.

Every other unit's conversion ratio is expressed relative to the base unit. Base units are platform-defined; units created through the API are never base units.

ownerownernullable

Owner of this resource.

Always returned as null in this endpoint.
created_atstring (date-time)

When this unit was created.

updated_atstring (date-time)

When this unit was last updated.

discount_percentagenumber

Share of the unit's price removed when an order is placed in this unit.

Expressed as a decimal fraction rather than a whole number, so 0.1 is a 10% discount and 0 is no discount.

discount_fixednumber

Flat amount subtracted from the unit's price when an order is placed in this unit.

Subtracted before discount_percentage is applied.

customer_portal_visibilitystringenumValues:visiblehidden

Whether this unit is shown to customers in the customer portal.

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

Responses

201

Successful response for Create Unit Group Associated Unit