Adding tags to tickets without overwriting existing tags

If you use the Update Ticket endpoint to add one or more tags to a ticket, the new tags replace any existing tags. To add tags without replacing any existing tags, use either the Update Many Tickets or Add Tags endpoints.

Option 1: Update Many Tickets

The Update Many Tickets endpoint lets you add tags without replacing the existing ones. You can also remove old tags without affecting existing tags.

The endpoint is expressed as follows:

PUT /api/v2/tickets/update_many.json?ids={ids}

It accepts a comma-separated list of up to 100 ticket ids. The ticket data is sent in a ticket object with the properties to be updated. Example:

curl https://{subdomain}.zendesk.com/api/v2/tickets/update_many.json?ids=1,2,3 \  -d '{"ticket": {"status": "solved"}}' \  -H "Content-Type: application/json" \  -v -u {email_address}:{password} -X PUT \

To add or remove tags, include the additional_tags or the remove_tags property, as described in the following sections.

Adding tags

To add tags to tickets, include the additional_tags property in the ticket object. The property takes an array of tags. Examples:

Bulk updates

curl https://{subdomain}.zendesk.com/api/v2/tickets/update_many.json?ids=1,2,3 \  -d '{"ticket": {"additional_tags":["new_tag_1"]}}' \  -H "Content-Type: application/json" \  -v -u {email_address}:{password} -X PUT

Batch updates

curl https://{subdomain}.zendesk.com/api/v2/tickets/update_many.json \  -d '{"tickets": [{ "id": 123, "additional_tags": "a_new_tag" }, { "id": 456, "additional_tags": "another_new_tag" }]}' \   -H "Content-Type: application/json" \  -v -u {email_address}:{password} -X PUT \

Removing tags

To remove selected tags from tickets, include the remove_tags property. Example:

curl https://{subdomain}.zendesk.com/api/v2/tickets/update_many.json?ids=1,2,3 \  -d '{"ticket": {"remove_tags":["old_tag_1"]}}' \  -H "Content-Type: application/json" \  -v -u {email_address}:{password} -X PUT

Option 2: Add Tags

The Add Tags endpoint lets you add tags to specific tickets, organizations, or users without replacing any existing tags.

To add ticket tags, the endpoint is expressed as follows:

PUT /api/v2/tickets/{ticket_id}/tags

The tags are sent in a tags object in the request body. Example:

curl https://{subdomain}.zendesk.com/api/v2/tickets/{ticket_id}/tags.json \  -d '{ "tags": ["customer"] }' \  -H "Content-Type: application/json" \  -v -u {email_address}:{password} -X PUT

To remove selected tags from tickets, use the Remove Tags endpoint.