API Playground

Add or remove tags on one or more entities. This playground calls the live API and will modify data.

Authentication Required

You need to Login to test the API playground

Bulk tags

Add or remove tags across every entity in a scope — an explicit list of ids, or everything matching a filter tree.

Both endpoints take the same body and differ only in direction. Only MongoDB is written inside the request; the search index catches up from the Change Stream a moment later, so an immediate re-query may still show the previous tags.

Endpoint URL
POST https://api.commerceclarity.com/api/2026-05/entities/tags/add
POST https://api.commerceclarity.com/api/2026-05/entities/tags/remove

Body parameters

Send either ids or filters. If both are present, ids wins and filters is ignored.

ParameterTypeRequiredDescription
tagsarrayRequiredNon-empty array of tag names. Names the brand does not have yet are created on tags/add. No length limit.
idsarrayRequiredNon-empty array of entity _id strings. Required unless filters is sent.
filtersobjectRequiredFilter tree — the same one List / Query entities takes. Tags everything it matches. Required unless ids is sent.
filters.operatorstringRequiredand or or. Mandatory whenever filters is present.
filters.conditionsarrayOptionalAn empty or omitted condition list is the deliberate whole catalogue scope.
brand_idstringOptionalOverride the active brand.
A filters scope may resolve at most 5 000 entities. The count is checked before anything is written — including before any new tag is created — so a refused request leaves no trace. An ids scope is not capped.

Tag names

Names are trimmed, empties are dropped, and duplicates are removed case-insensitively — the first spelling in the array wins, so the same tag cannot end up stored twice under different casing. If nothing usable is left, the request is refused with 422 and the message No usable tag names were provided.

On tags/add, names that do not exist yet are created as tags of the active brand: tagging is also how the brand's tag catalogue grows.

Behaviour

  • Tags are an inventory-level property. They live on the product's inventory and are mirrored onto every linked entity for querying, so tagging one variant tags all of its siblings. This means updated can be higher than the number of entities in the scope.
  • Removing a tag an entity does not carry is a no-op. A caller working from a filter scope cannot know which tags the matched rows have, so it can safely send the brand's whole tag list and let the write sort it out.
  • Entities with no inventory carry no tags and are skipped.
  • Filter on tags with the inventory_tags field.

Request Examples

Add tags by ids
curl -X POST "https://api.commerceclarity.com/api/2026-05/entities/tags/add" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": ["black-friday", "clearance"],
    "ids": ["507f1f77bcf86cd799439011", "507f1f77bcf86cd799439012"]
  }'
Add a tag to every entity of a family
curl -X POST "https://api.commerceclarity.com/api/2026-05/entities/tags/add" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": ["black-friday"],
    "filters": {
      "operator": "and",
      "conditions": [
        { "field": "family_id", "op": "is", "value": "507f1f77bcf86cd7994390f0" }
      ]
    }
  }'
Remove a tag from everything that carries it
curl -X POST "https://api.commerceclarity.com/api/2026-05/entities/tags/remove" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": ["black-friday"],
    "filters": {
      "operator": "and",
      "conditions": [
        { "field": "inventory_tags", "op": "is", "value": "black-friday" }
      ]
    }
  }'

Response Example

Success Response
{
  "status": "success",
  "message": "Tags added",
  "updated": 51
}

message is Tags removed on the remove endpoint. updated counts the entities whose tags were touched, sibling variants included.

Error Response - Validation — validation
{
  "status": "error",
  "message": "The tags field is required."
}
Error Response - Validation — scope over the cap (422)
{
  "status": "error",
  "message": "The selection matches 12480 entities, more than the 5000 allowed for a single bulk action. Narrow the filters and try again.",
  "total": 12480,
  "limit": 5000
}
Error Response - Validation — scope could not be resolved (503)
{
  "status": "error",
  "message": "Unable to resolve the selected products: <reason>"
}