Skip to main content
Allows you to update tags to multiple contacts at once, you can add or remove tags from the contacts
POST https://services.leadconnectorhq.com/contacts/bulk/tags/update/{type}

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Body

contacts
string[]
required
list of contact ids to be processed
tags
string[]
required
list of tags to be added or removed
locationId
string
default:"asdrwHvLUxlfw5SqKVCN"
required
account id from where the bulk request is executed
removeAllTags
boolean
default:"false"
Option to implement remove all tags. if true, all tags will be removed from the contacts. Can only be used with remove type.

Respuestas

succeded
boolean
default:"True"
required
Indicates if the operation was successful
errorCount
number
default:"0"
required
Number of errors encountered during the operation
responses
string[]
required
Responses for each contact processed
{
  "succeded": true,
  "errorCount": 0,
  "responses": [
    {
      "contactId": "qFSqySFkVvNzOSqgGqFi",
      "message": "Tags updated",
      "type": "success",
      "oldTags": [
        "tag-1",
        "tag-2"
      ],
      "tagsAdded": [],
      "tagsRemoved": []
    },
    {
      "contactId": "abcdef",
      "message": "contact id is not a valid firebase id",
      "type": "error"
    },
    {
      "contactId": "qFSqySFkVvNzOSqgGqFi",
      "message": "contact is deleted",
      "type": "error"
    },
    {
      "contactId": "3ualbhnV7j3n3a9r2moD",
      "message": "contact does not belong to account",
      "type": "error"
    }
  ]
}
{}
{}

Ejemplo

curl -X POST 'https://services.leadconnectorhq.com/contacts/bulk/tags/update/YOUR_type' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "contacts": [
    "qFSqySFkVvNzOSqgGqFi",
    "abcdef",
    "qFSqySFkVvNzOSqgGqFi",
    "3ualbhnV7j3n3a9r2moD"
  ],
  "tags": [
    "tag-1",
    "tag-2"
  ],
  "locationId": "asdrwHvLUxlfw5SqKVCN",
  "removeAllTags": "false"
}'
const response = await fetch('https://services.leadconnectorhq.com/contacts/bulk/tags/update/YOUR_type', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"contacts": ["qFSqySFkVvNzOSqgGqFi", "abcdef", "qFSqySFkVvNzOSqgGqFi", "3ualbhnV7j3n3a9r2moD"], "tags": ["tag-1", "tag-2"], "locationId": "asdrwHvLUxlfw5SqKVCN", "removeAllTags": "false"}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'POST',
    'https://services.leadconnectorhq.com/contacts/bulk/tags/update/YOUR_type',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"contacts": ["qFSqySFkVvNzOSqgGqFi", "abcdef", "qFSqySFkVvNzOSqgGqFi", "3ualbhnV7j3n3a9r2moD"], "tags": ["tag-1", "tag-2"], "locationId": "asdrwHvLUxlfw5SqKVCN", "removeAllTags": "false"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/contacts/bulk/tags/update/YOUR_type');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
        'Version: 2021-07-28',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode({'contacts': ['qFSqySFkVvNzOSqgGqFi', 'abcdef', 'qFSqySFkVvNzOSqgGqFi', '3ualbhnV7j3n3a9r2moD'], 'tags': ['tag-1', 'tag-2'], 'locationId': 'asdrwHvLUxlfw5SqKVCN', 'removeAllTags': 'false'}),
]);
$data = json_decode(curl_exec($ch), true);