DELETE /api/v1/contacts/{contactId}/tags/{tagId}
Detaches a tag from a contact. Idempotent: removing a tag the contact does not carry answers
200 too.
Authorization
| Role in the organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Refused — 403 |
Path parameters
| Parameter | Type | Description |
|---|---|---|
contactId | string | Required. The contact to untag |
tagId | string | Required. The tag to detach — the tag itself is untouched |
Example
bash
curl -X DELETE -H "x-api-key: $AGENTMAIL_API_KEY" \
"https://www.agentsmail.io/api/v1/contacts/$CONTACT_ID/tags/$TAG_ID"Response
200 OK— the call succeeded.401 Unauthorized— missing or invalid key, or its owner left the organization.403 Forbidden— the key's owner is amemberof the organization, not anadmin.404 Not Found— no such resource, or it belongs to another organization. The API never confirms that an id exists to a caller who has no right to it.429 Too Many Requests— over 120 requests in a minute for this key.
Response fields
Idempotent: detaching a tag the contact never carried answers the same way.| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the operation was successful |
data.id | string | Identifier of the contact |
data.email | string | Its address — unique inside its list |
data.firstName / lastName | string \ | null |
data.status | string | pending, subscribed, unsubscribed, bounced, complained |
data.listId | string | The list it belongs to — a contact belongs to exactly one |
data.list | object | {id, name} of that list |
data.tags | array | {id, name} of every tag carried |
data.createdAt / updatedAt | string | ISO dates |
Example response
json
{
"success": true,
"data": {
"id": "4d19c0a2",
"email": "ada@example.com",
"firstName` / `lastName": "value",
"status": "subscribed",
"listId": "0b7c51e8",
"list": {
"id": "0b7c51e8",
"name": "Newsletter"
},
"tags": [
{
"id": "7c2ef4b1",
"name": "vip"
}
],
"createdAt` / `updatedAt": "value"
}
}