Tags API
Tag and untag records in bulk
Both endpoints take the same body and require write:tags.
| Field | Required | Description |
|---|---|---|
entity | Yes | CONTACT, LEAD, COMPANY or DEAL. Case-insensitive |
recordIds | Yes | 1 to 500 agentlyleads record IDs, all of type entity |
tagIds | Yes | 1 to 50 tag IDs |
Every record and every tag is checked against your workspace before anything is written. If any one is missing, the request fails with 404 and nothing is changed, so a typo can't leave half a list tagged.
POST /api/v1/tags/assign
Adds every tag to every record. Tags a record already has are left as they are, so repeating the call is harmless.
POST /api/v1/tags/assign HTTP/1.1
Host: agentlyleads.com
Authorization: Bearer alk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
{
"entity": "CONTACT",
"recordIds": ["cmq2cont0alk34567891", "cmq2cont1alk34567892"],
"tagIds": ["cmq5tag00alk34567890"]
}Response: 200
{
"entity": "CONTACT",
"recordIds": ["cmq2cont0alk34567891", "cmq2cont1alk34567892"],
"tagIds": ["cmq5tag00alk34567890"],
"updated": 2
}Duplicate IDs in either list are collapsed before the write.
POST /api/v1/tags/unassign
Removes every tag from every record. A tag a record doesn't have is ignored. The tags stay in the workspace; only the link to these records goes. Same body and response as assign.