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.
Bash
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"
}
]
}'
Requires authentication with a valid bearer token.
The token must have write access to the Labels resource.
Field Type Required Description entityTypeenum Required Entity type to assign labels to. One of: CUSTOMER, PRODUCT, STORE. assignmentsarray Required List of assignment objects. Maximum 10 per request. .entityIdstring Required Identifier of the entity receiving the label. .labelNamestring Conditional Display name of the label to assign. Required if labelExternalId is not provided. .labelExternalIdstring Conditional Caller-defined identifier of the label to assign. Required if labelName is not provided. .expiryDatestring Optional Date when this assignment expires. Format: YYYY-MM-DD. Must be a future date.
JSON
{
"data": [
{
"assignmentId": 5001,
"entityId": "SKU-001",
"labelId": 101,
"labelName": "Summer Sale",
"labelExternalId": "SUMMER_SALE",
"expiryDate": "2026-08-31"
}
],
"warnings": [],
"errors": []
}
Field Type Description dataarray Assignments created successfully. .assignmentIdinteger System-assigned unique identifier for this assignment. .entityIdstring Entity identifier from the request. .labelIdinteger System-assigned identifier of the label. .labelNamestring Display name of the assigned label. .labelExternalIdstring Caller-defined identifier of the assigned label, or null if not set. .expiryDatestring Expiry date in YYYY-MM-DD format, or null if no expiry was set. warningsarray Non-fatal issues. Each item includes a code and message. errorsarray Assignments that failed to create. Each item includes a code, message, and the rejected input.
Code Error number Type Description LABEL_INVALID_ENTITY_TYPE23006 Error entityType is not one of CUSTOMER, PRODUCT, STORE. HTTP 400.ASSIGNMENT_BATCH_SIZE_EXCEEDED23032 Error More than 10 assignments in a single request. HTTP 400.