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. Removing an assignment immediately untags the entity, and downstream features such as promotions or campaigns that filter by that label will no longer include the entity.

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 --location --request DELETE 'https://eu.api.capillarytech.com/v2/labels/assignments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic bmVlcmFqLmRvY3NlcDI1OjgyNmM0YzM0YTE2ODkxZjg0ZTdi' \
--data '{
  "entityType": "PRODUCT",
  "removals": [
    {
      "entityId": "505101",
      "labelIds": [116, 113]
    },
    {
      "entityId": "505102",
      "labelIds": [128,126]
    }
  ]
}'
curl --location --globoff --request DELETE '{{base_url}}/v2/labels/assignments' \
--header 'Content-Type: application/json' \
--data '{
  "entityType": "PRODUCT",
  "removals": [
    {
      "entityId": "1",
      "labelIds": [116]
    }
  ]
}'

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 — applies the label to a customer. PRODUCT — applies the label to a product. STORE — applies the label to a 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": "505102",
            "removedLabelIds": [
                128,
                126
            ]
        }
    ],
    "warnings": [
        {
            "code": 23051,
            "field": "labelIds",
            "labelExternalId": "505101",
            "message": "Label with id '116' is already inactive or expired for entity '505101'."
        },
        {
            "code": 23051,
            "field": "labelIds",
            "labelExternalId": "505101",
            "message": "Label with id '113' is already inactive or expired for entity '505101'."
        }
    ],
    "errors": []
}
{
    "data": [
        {
            "entityId": "505102",
            "removedLabelIds": [
                124
            ]
        }
    ],
    "warnings": [],
    "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).
.codenumberNumeric warning code.
.fieldstringName of the field that caused the warning.
.labelExternalIdstringExternal ID of the entity that triggered the warning. Present when entity-scoped.
.messagestringDescription of the warning.
errorsarrayList of errors for removal items that failed.
.codenumberNumeric error code.
.fieldstringName of the field that caused the error.
.labelExternalIdstringExternal ID of the entity that caused the error. Present when entity-scoped.
.messagestringDescription of the error.

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.

Body Params
string
enum
required
Allowed:
removals
array of objects
required
length ≤ 100
removals*
Headers
string
string
Responses

207

Partial success — some removed, some with warnings.

400

All removals failed validation.

Language
Credentials
Basic
base64
:
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json