Create labels

Create labels (POST)

Creates one or more labels in bulk. Labels classify entities such as customers, products, or stores. An organization can create up to 10 labels per request.

Example request

curl -X POST "https://{host}/api_gateway/v2/labels" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "labels": [
      {
        "name": "Summer Sale",
        "externalId": "SUMMER_SALE",
        "description": "Products eligible for summer promotions",
        "entityType": "PRODUCT",
        "expiryConfig": {
          "type": "FIXED_DATE",
          "date": "2026-08-31T23:59:59Z"
        }
      }
    ]
  }'

Prerequisites

  • Requires authentication with a valid bearer token.
  • The token must have write access to the Labels resource.

Body parameters

FieldTypeRequiredDescription
labelsarrayRequiredList of label objects to create. Maximum 10 per request.
.namestringRequiredDisplay name for the label. Max 255 characters. Must be unique within the entity type for the org.
.externalIdstringOptionalCaller-defined identifier. Max 255 characters. Must be unique within the entity type if provided.
.descriptionstringOptionalHuman-readable description. Max 1024 characters.
.entityTypeenumRequiredEntity type this label applies to. One of: CUSTOMER, PRODUCT, STORE.
.expiryConfigobjectOptionalExpiry settings for the label. If omitted, the label does not expire.
..typeenumRequiredExpiry type. One of: NONE, FIXED_DATE, RELATIVE.
..datestringConditionalRequired when type is FIXED_DATE. ISO-8601 UTC date-time (YYYY-MM-DDThh:mm:ssZ). Must be a future date.
..durationintegerConditionalRequired when type is RELATIVE. Positive integer representing the number of duration units.
..durationTypeenumConditionalRequired when type is RELATIVE. One of: DAYS, MONTHS, YEARS.

Example response

{
  "data": [
    {
      "id": 101,
      "externalId": "SUMMER_SALE"
    }
  ],
  "warnings": [],
  "errors": []
}

Response parameters

FieldTypeDescription
dataarrayLabels created successfully in this request.
.idintegerSystem-generated unique identifier assigned to the label.
.externalIdstringCaller-defined identifier supplied in the request, or null if not provided.
warningsarrayNon-fatal issues. Each item includes a code and message.
errorsarrayLabels that failed to create. Each item includes a code, message, and the rejected input.

Error & warning codes

CodeError numberTypeDescription
LABEL_NAME_REQUIRED23001ErrorLabel name is missing. HTTP 400.
LABEL_INVALID_ENTITY_TYPE23006ErrorentityType is not one of CUSTOMER, PRODUCT, STORE. HTTP 400.
LABEL_NAME_TOO_LONG23007Errorname exceeds 255 characters. HTTP 400.
LABEL_EXTERNAL_ID_TOO_LONG23008ErrorexternalId exceeds 255 characters. HTTP 400.
LABEL_DESCRIPTION_TOO_LONG23009Errordescription exceeds 1024 characters. HTTP 400.
LABEL_DUPLICATE_NAME23019ErrorA label with this name already exists for the entity type in this org. HTTP 409.
LABEL_DUPLICATE_EXTERNAL_ID23020ErrorA label with this external ID already exists for the entity type in this org. HTTP 409.
LABEL_BATCH_SIZE_EXCEEDED23021ErrorMore than 10 labels in a single request. HTTP 400.