Create labels

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

Create one or more labels for an organization in a single request. A label is a metadata tag that you can apply to customers, products, or stores to enable segmentation and filtering. You can create up to 10 labels per request.

Example request

curl -X POST "https://{host}/v2/labels" \
  -H "Authorization: Basic {base64_credentials}" \
  -H "Content-Type: application/json" \
  -d '{
    "labels": [
      {
        "name": "Summer Sale",
        "externalId": "summer-sale-2026",
        "description": "Labels for summer sale products",
        "entityType": "PRODUCT",
        "expiryConfig": {
          "type": "FIXED_DATE",
          "expiryDate": "2027-12-31T23:59:59+05:30"
        }
      }
    ]
  }'

Prerequisites

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

Body parameters

FieldTypeRequiredDescription
labelsarrayRequiredList of labels to create. Maximum 10 labels per request.
.namestringRequiredName of the label. Must be unique within the same entityType for the organization. Max 255 characters.
.externalIdstringConditionalExternal identifier for the label. Must be unique within the same entityType for the organization. Max 255 characters. Required when the org has external ID enforcement enabled.
.descriptionstringOptionalDescription of the label. Max 1,024 characters.
.entityTypeenumRequiredEntity type the label applies to. Supported values: CUSTOMER, PRODUCT, STORE. Case-sensitive.
.expiryConfigobjectOptionalExpiry configuration for the label. If omitted, the label does not expire.
..typeenumRequiredExpiry type. Supported values: NONE, FIXED_DATE, RELATIVE. Case-sensitive.
..expiryDatestringConditionalRequired when type is FIXED_DATE. Expiry date in ISO-8601 format: YYYY-MM-DDThh:mm:ssZ (for example, 2026-12-31T23:59:59+05:30). Must be a future date.
..unitenumConditionalRequired when type is RELATIVE. Duration unit. Supported values: DAYS, MONTHS, YEARS.
..valuenumberConditionalRequired when type is RELATIVE. Duration value. Must be a non-negative integer.
..roundingUnitstringOptionalRounding unit for the expiry duration. Applicable when type is RELATIVE.

Example response

{
  "data": [
    {
      "id": 108,
      "externalId": "summer-sale-2026"
    }
  ],
  "warnings": [],
  "errors": []
}

Partial failure (HTTP 207):

{
  "data": [
    {
      "id": 108,
      "externalId": "summer-sale-2026"
    }
  ],
  "warnings": [],
  "errors": [
    {
      "code": 23019,
      "field": "name",
      "labelExternalId": "clearance-2026",
      "message": "A label with the name 'Clearance' already exists for entity type 'PRODUCT'."
    }
  ]
}

Response parameters

FieldTypeDescription
dataarrayList of successfully created labels.
.idnumberUnique identifier assigned to the created label.
.externalIdstringExternal identifier of the created label.
warningsarrayList of warnings. Empty when no warnings occur.
errorsarrayList of errors for labels that failed to create.
.codenumberNumeric error code.
.fieldstringName of the field that caused the error.
.labelExternalIdstringExternal ID of the label item that failed.
.messagestringDescription of the error.

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

Error & warning codes

CodeError numberTypeDescription
LABEL_NAME_REQUIRED23001ErrorLabel name is required. HTTP 400.
LABEL_EXPIRY_DATE_PAST23004ErrorExpiry date must be a future date. HTTP 400.
LABEL_UNSUPPORTED_TIME_UNIT23005ErrorUnsupported time unit. Supported values: DAYS, MONTHS, YEARS. HTTP 400.
LABEL_INVALID_ENTITY_TYPE23006ErrorInvalid entity type. Supported values: CUSTOMER, PRODUCT, STORE. HTTP 400.
LABEL_NAME_TOO_LONG23007ErrorLabel name must not exceed 255 characters. HTTP 400.
LABEL_EXTERNAL_ID_TOO_LONG23008ErrorExternal ID must not exceed 255 characters. HTTP 400.
LABEL_DESCRIPTION_TOO_LONG23009ErrorDescription must not exceed 1,024 characters. HTTP 400.
LABEL_RELATIVE_EXPIRY_UNIT_REQUIRED23010Errorunit is required when expiryConfig.type is RELATIVE. HTTP 400.
LABEL_RELATIVE_EXPIRY_VALUE_REQUIRED23011Errorvalue must be a non-negative integer when expiryConfig.type is RELATIVE. HTTP 400.
LABEL_FIXED_EXPIRY_DATE_REQUIRED23012ErrorexpiryDate is required when expiryConfig.type is FIXED_DATE. HTTP 400.
LABEL_INVALID_EXPIRY_CONFIG_TYPE23013ErrorInvalid expiry config type. Supported values: NONE, FIXED_DATE, RELATIVE. HTTP 400.
LABEL_INVALID_EXPIRY_DATE_FORMAT23014ErrorInvalid expiry date format. Expected ISO-8601 format: YYYY-MM-DDThh:mm:ssZ. HTTP 400.
LABEL_LOCK_FAILED23015ErrorCould not acquire lock for the label. Another operation is in progress. Retry after a short delay. HTTP 409.
LABEL_DUPLICATE_NAME23019ErrorA label with the same name already exists for this entity type. HTTP 409.
LABEL_DUPLICATE_EXTERNAL_ID23020ErrorA label with the same external ID already exists for this entity type. HTTP 409.
LABEL_BATCH_SIZE_EXCEEDED23021ErrorMaximum 10 labels can be created in a single request. HTTP 400.
LABEL_REQUEST_BODY_EMPTY23022ErrorRequest body must contain at least one label. HTTP 400.
LABEL_ITEM_NULL23023ErrorLabel item must not be null. HTTP 400.
LABEL_EXTERNAL_ID_REQUIRED23030ErrorExternal ID is required. HTTP 400.
Body Params
labels
array of objects
length ≤ 10
labels
Headers
string
string
Responses

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