Create label assignments

Create label assignments (POST)

Assigns one or more labels to entities in bulk. An organization can create up to 10 assignments per request. Returns HTTP 201 if all succeed, HTTP 207 if some fail, or HTTP 400 if all fail.

Example request

curl -X POST "https://{host}/api_gateway/v2/labels/assignments" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "entityType": "PRODUCT",
    "assignments": [
      {
        "entityId": "SKU-001",
        "labelName": "Summer Sale",
        "expiryDate": "2026-08-31"
      }
    ]
  }'

Prerequisites

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

Body parameters

FieldTypeRequiredDescription
entityTypeenumRequiredEntity type to assign labels to. One of: CUSTOMER, PRODUCT, STORE.
assignmentsarrayRequiredList of assignment objects. Maximum 10 per request.
.entityIdstringRequiredIdentifier of the entity receiving the label.
.labelNamestringConditionalDisplay name of the label to assign. Required if labelExternalId is not provided.
.labelExternalIdstringConditionalCaller-defined identifier of the label to assign. Required if labelName is not provided.
.expiryDatestringOptionalDate when this assignment expires. Format: YYYY-MM-DD. Must be a future date.

Example response

{
  "data": [
    {
      "assignmentId": 5001,
      "entityId": "SKU-001",
      "labelId": 101,
      "labelName": "Summer Sale",
      "labelExternalId": "SUMMER_SALE",
      "expiryDate": "2026-08-31"
    }
  ],
  "warnings": [],
  "errors": []
}

Response parameters

FieldTypeDescription
dataarrayAssignments created successfully.
.assignmentIdintegerSystem-assigned unique identifier for this assignment.
.entityIdstringEntity identifier from the request.
.labelIdintegerSystem-assigned identifier of the label.
.labelNamestringDisplay name of the assigned label.
.labelExternalIdstringCaller-defined identifier of the assigned label, or null if not set.
.expiryDatestringExpiry date in YYYY-MM-DD format, or null if no expiry was set.
warningsarrayNon-fatal issues. Each item includes a code and message.
errorsarrayAssignments that failed to create. Each item includes a code, message, and the rejected input.

Error & warning codes

CodeError numberTypeDescription
LABEL_INVALID_ENTITY_TYPE23006ErrorentityType is not one of CUSTOMER, PRODUCT, STORE. HTTP 400.
ASSIGNMENT_BATCH_SIZE_EXCEEDED23032ErrorMore than 10 assignments in a single request. HTTP 400.