Skip to content

Merge multiple tags

Request

Merge multiple tags into a single target tag. This is essential for cleaning up duplicate tags.

Common use cases:

  • Combine case variations: "Newsletter", "newsletter", "NEWSLETTER" → "newsletter"
  • Consolidate similar tags: "vip", "VIP Customer", "vip-member" → "VIP"
  • Fix duplicates after import: "customer-2024", "customer-2025" → "customer"

How it works:

  1. For each contact with any source tag:
    • Adds target tag (if not already present)
    • Removes all source tags
  2. Atomic operation (all or nothing)
  3. Returns count of affected contacts

Example: If contact has tags ["Newsletter", "newsletter"], merging both into "newsletter" results in just ["newsletter"].

Note: You can include the target tag in source_tags array - it will handle this correctly.

Security
ApiKeyAuth
Bodyapplication/jsonrequired
source_tagsArray of strings, non-emptyrequired

Array of tag names to merge (must contain at least one tag)

Example:
[ "Newsletter", "newsletter", "NEWSLETTER" ]
target_tagstring, [ 1 .. 50 ] characters^[a-zA-Z0-9\s\-_]+$required

Target tag name (will be created if doesn't exist)

Example:"newsletter"
curl -i -X POST \
  https://api.mailerlogic.net/api/v1/contacts/tags/merge \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: YOUR_API_KEY_HERE' \
  -d '{
    "source_tags": [
      "Newsletter",
      "newsletter",
      "NEWSLETTER"
    ],
    "target_tag": "newsletter"
  }'

Responses

Tags merged successfully

Bodyapplication/json
successboolean
Example:true
dataobject
Response
{ "success": true, "data": { "source_tags": [], "target_tag": "newsletter", "contacts_affected": 150, "tags_removed": 298, "tags_added": 23 } }