Create label assignments

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Assign one or more labels to entities in a single request. Each assignment links a label to an entity (customer, product, or store) and optionally sets an expiry date for the assignment. You can create up to 100 assignments per request.

Example request

curl -X POST "https://{host}/v2/labels/assignments" \
  -H "Authorization: Basic {base64_credentials}" \
  -H "Content-Type: application/json" \
  -d '{
    "entityType": "CUSTOMER",
    "assignments": [
      {
        "entityId": "<ENTITY_ID>",
        "labelName": "VIP"
      }
    ]
  }'

Prerequisites

  • Basic authentication (Authorization: Basic {base64_credentials}) or OAuth (X-CAP-API-OAUTH-TOKEN).
  • The label must already exist and be active. Create labels using Create labels.

Body parameters

FieldTypeRequiredDescription
entityTypeenumRequiredEntity type for all assignments in this request. Supported values: CUSTOMER, PRODUCT, STORE. Case-sensitive.
assignmentsarrayRequiredList of label assignments to create. Maximum 100 assignments per request.
.entityIdstringRequiredIdentifier of the entity to assign the label to.
.labelNamestringConditionalName of the label to assign. Either labelName or labelExternalId is required — not both.
.labelExternalIdstringConditionalExternal ID of the label to assign. Either labelName or labelExternalId is required — not both.
.expiryDatestringOptionalDate when the assignment expires. Format: yyyy-MM-dd (for example, 2026-12-31). Must be a future date. Requires org timezone to be configured.

Example response

{
  "data": [
    {
      "assignmentId": 1,
      "entityId": "<ENTITY_ID>",
      "labelId": 109,
      "labelName": "VIP",
      "labelExternalId": "vip-tier",
      "expiryDate": "2027-06-04T18:29:59Z"
    }
  ],
  "warnings": [],
  "errors": []
}

Response parameters

FieldTypeDescription
dataarrayList of successfully created assignments.
.assignmentIdnumberUnique identifier of the created assignment.
.entityIdstringIdentifier of the entity the label was assigned to.
.labelIdnumberUnique identifier of the assigned label.
.labelNamestringName of the assigned label.
.labelExternalIdstringExternal identifier of the assigned label.
.expiryDatestringExpiry date and time of the assignment in UTC, in ISO-8601 format. When the label has a RELATIVE expiry config, this is computed automatically from the label definition.
warningsarrayList of warnings. Empty when no warnings occur.
errorsarrayList of errors for assignments that failed.
.codenumberNumeric error code.
.fieldstringName of the field that caused the error.
.messagestringDescription of the error.

Note: If some assignments are created and others fail, the API returns HTTP 207. If all assignments fail, the API returns HTTP 400. If all assignments are created successfully, the API returns HTTP 200.

Note: When expiryDate is provided and the org does not have a timezone configured, the API returns HTTP 400 with no response body. Contact your Capillary account team to configure org timezone.

Error & warning codes

CodeError numberTypeDescription
ASSIGNMENT_REQUEST_BODY_EMPTY23031ErrorRequest body must contain at least one assignment. HTTP 400.
ASSIGNMENT_BATCH_SIZE_EXCEEDED23032ErrorMaximum 100 assignments can be created in a single request. HTTP 400.
ASSIGNMENT_ENTITY_TYPE_REQUIRED23033ErrorentityType is required. HTTP 400.
ASSIGNMENT_INVALID_ENTITY_TYPE23034ErrorInvalid entity type. Supported values: CUSTOMER, PRODUCT, STORE. HTTP 400.
ASSIGNMENT_LABEL_IDENTIFIER_REQUIRED23035ErrorEither labelName or labelExternalId is required. HTTP 400.
ASSIGNMENT_LABEL_NOT_FOUND23037ErrorNo active label found for the given identifier and entity type. HTTP 400.
ASSIGNMENT_LABEL_IDENTIFIER_AMBIGUOUS23038ErrorlabelName and labelExternalId resolve to different labels. Provide only one. HTTP 400.
ASSIGNMENT_EXPIRY_DATE_PAST23039ErrorExpiry date must be a future date. HTTP 400.
ASSIGNMENT_INVALID_EXPIRY_DATE_FORMAT23040ErrorInvalid expiry date format. Expected: yyyy-MM-dd (for example, 2026-08-31). HTTP 400.
ASSIGNMENT_MAX_LABELS_PER_ENTITY23043ErrorEntity already has the maximum number of active labels allowed. HTTP 400.
ASSIGNMENT_ALREADY_EXISTS23044ErrorThis label is already assigned to the entity. HTTP 409.
ASSIGNMENT_ENTITY_NOT_FOUND23045ErrorEntity with the given ID does not exist. HTTP 400.
ASSIGNMENT_LOCK_FAILED23055ErrorCould not acquire lock for the entity. Another assignment operation is in progress. Retry after a short delay. HTTP 409.
ORG_TIMEZONE_NOT_CONFIGURED23056ErrorThe organization does not have a timezone configured. HTTP 400.
Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here!