Remove label assignments

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

Remove one or more label assignments from entities in a single request. Each removal item targets one entity and specifies which labels to remove by label ID, name, or external ID. You can process up to 100 removal items per request.

Example request

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

Prerequisites

  • Basic authentication (Authorization: Basic {base64_credentials}) or OAuth (X-CAP-API-OAUTH-TOKEN).

Body parameters

FieldTypeRequiredDescription
entityTypeenumRequiredEntity type for all removals in this request. Supported values: CUSTOMER, PRODUCT, STORE. Case-sensitive.
removalsarrayRequiredList of removal items. Maximum 100 items per request.
.entityIdstringRequiredIdentifier of the entity to remove labels from.
.labelIdsarrayConditionalList of label IDs to remove. Provide exactly one of labelIds, labelNames, or labelExternalIds.
.labelNamesarrayConditionalList of label names to remove. Provide exactly one of labelIds, labelNames, or labelExternalIds.
.labelExternalIdsarrayConditionalList of label external IDs to remove. Provide exactly one of labelIds, labelNames, or labelExternalIds.

Example response

{
  "data": [
    {
      "entityId": "<ENTITY_ID>",
      "removedLabelIds": [109]
    }
  ],
  "warnings": [],
  "errors": []
}

Already-inactive warning (HTTP 200):

{
  "warnings": [
    {
      "code": 23051,
      "field": "labelIds",
      "labelExternalId": "<ENTITY_ID>",
      "message": "Label with id '109' is already inactive or expired for entity '<ENTITY_ID>'."
    }
  ],
  "errors": []
}

Response parameters

FieldTypeDescription
dataarrayList of entities for which labels were successfully removed.
.entityIdstringIdentifier of the entity.
.removedLabelIdsarrayList of label IDs that were removed from the entity.
warningsarrayList of non-blocking warnings (for example, label already inactive).
errorsarrayList of errors for removal items that failed.

Note: If some removal items succeed and others fail, the API returns HTTP 207. If all removal items fail, the API returns HTTP 400. If all removal items succeed, the API returns HTTP 200.

Error & warning codes

CodeError numberTypeDescription
ASSIGNMENT_REQUEST_BODY_EMPTY23031ErrorRequest body must contain at least one removal item. HTTP 400.
ASSIGNMENT_BATCH_SIZE_EXCEEDED23032ErrorMaximum 100 removal items can be processed 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_NOT_ASSIGNED_TO_ENTITY23050ErrorThe label is not assigned to this entity. HTTP 400.
ASSIGNMENT_ALREADY_INACTIVE23051WarningThe label assignment is already inactive or expired for this entity.
ASSIGNMENT_REMOVAL_ENTITY_ID_REQUIRED23052ErrorentityId is required for each removal item. HTTP 400.
ASSIGNMENT_REMOVAL_LABEL_IDS_REQUIRED23053ErrorAt least one of labelIds, labelNames, or labelExternalIds is required for each removal item. HTTP 400.
ASSIGNMENT_LOCK_FAILED23055ErrorCould not acquire lock for the entity. Retry after a short delay. HTTP 409.
ASSIGNMENT_REMOVAL_LABEL_IDENTIFIER_AMBIGUOUS23058ErrorOnly one of labelIds, labelNames, or labelExternalIds is allowed per removal item. HTTP 400.
Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here!