Skip to main content
POST
Create a product group

Authorizations

x-api-key
string
header
required

API key for authentication. You can find your API key in the Creem dashboard under Settings > API Keys.

Headers

If-None-Match
string

Send * to create only: when a product group of the store already has the external_id, the call answers 412 (precondition_failed) and writes nothing. Only * is accepted on a request with an external_id (any other value answers 400); without one the header is ignored.

Query Parameters

dry_run
boolean

Send true to preview the write: the request runs as it would and is rolled back, so nothing is written. The answer is the one the real call would give: the same status (201 for a create) and errors, and the product group with write_result.dry_run true. The id of a product group a dry run would create is never stored: a GET of it answers 404. A product id or external_id that names no product of the store is a reference_not_found warning (path, key) instead of a 400: on a create that entry is left out of the answer, and on an update the stored members stay as they are. false or no parameter is a real call; any other value answers 400.

Body

application/json
name
string

The name of the product group, 3 to 255 characters. Required when creating a product group. On an existing group (by external_id) a different name renames it.

description
string | null

A description of the product group. On an existing group (by external_id), send null to clear it.

external_id
string

Your own key for this product group. Unique per store, case-sensitive; 1 to 255 characters: letters, digits, _, -, . and :. With a key the call is an upsert: it creates the group when the key is new (201) and updates the group that holds it otherwise (200). Send If-None-Match: * to create only.

Example:

"pro-plans"

products
object[]

The products of the group, in display order, each named by exactly one of id or external_id. Required when creating a product group, with at least one product. On an existing group (by external_id) it is the complete ordered member list: products it does not contain are removed, its order is the display order, and [] removes every member; omit it to leave the members unchanged. A product already in another group answers 409 with code product_already_grouped.

Maximum array length: 100
upgrades_enabled
boolean

Whether customers can switch between the products of this group. Defaults to true on a create.

upgrade_behavior
enum<string> | null

How a switch between the products of this group is billed. On an existing group (by external_id), send null to clear it.

Available options:
proration-charge-immediately,
proration-charge,
proration-none
upsells_enabled
boolean

Whether the products of this group are offered as checkout upsells. Defaults to true on a create.

is_active
boolean

Whether the product group is active. Stored and returned; it does not yet stop upgrades or upsells. Defaults to true on a create.

Response

Only with an external_id: a product group of the store already had the key, and it was updated (write_result.result updated) or already matched the request (unchanged).

id
string
required

Unique identifier for the object.

mode
enum<string>
required

String representing the environment.

Available options:
test,
prod,
sandbox
object
string
required

String representing the object's type. Objects of the same type share the same value.

Example:

"product_group"

name
string
required

The name of the product group.

description
string | null
required

A description of the product group.

external_id
string | null
required

Your own key for this product group, or null when it has none.

products
object[]
required

The products in the group, in display order. A product is in one group at a time.

upgrades_enabled
boolean
required

Whether customers can switch between the products of this group.

upgrade_behavior
enum<string> | null
required

How a switch between the products is billed, or null for the default.

Available options:
proration-charge-immediately,
proration-charge,
proration-none
upsells_enabled
boolean
required

Whether the products of this group are offered as checkout upsells.

is_active
boolean
required

Whether the product group is active. Stored and returned; it does not yet stop upgrades or upsells.

created_at
string<date-time>
required

Creation date of the product group.

Example:

"2023-01-01T00:00:00Z"

updated_at
string<date-time>
required

Last updated date of the product group.

Example:

"2023-01-01T00:00:00Z"

write_result
object
required

What this write did and should tell you.