Apply tags to contacts matching a filter snapshot
const url = 'https://api.tryletterhead.com/api/v3/contacts/tags/matching';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"api":true,"tagsToApply":["engaged-readers"],"query":"newsletter fan","statuses":[1]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tryletterhead.com/api/v3/contacts/tags/matching \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "api": true, "tagsToApply": [ "engaged-readers" ], "query": "newsletter fan", "statuses": [ 1 ] }'Bulk-applies one or more tags to every contact matching a browse-filter snapshot β the same filter shape Search contacts and List/browse contacts accept (query, channels, statuses, tags, untagged, customFields, segmentId, a created-date window, plus an optional emails allow-list to target a hand-picked subset instead of a full-scan match). Any filter shape is accepted, including no filters at all β which targets your entire audience β so build the request from whichever narrowing fields you need.
Authorizations
Section titled βAuthorizations βRequest Body required
Section titled βRequest Body required βobject
Required. Set to true to authenticate with an API key.
1 or more tag names to apply.
Filter to contacts already carrying these tags (not to be confused with tagsToApply).
Optional allow-list β when present, only these emails (still narrowed by any other filters) are tagged.
Example
{ "api": true, "tagsToApply": [ "engaged-readers" ], "query": "newsletter fan", "statuses": [ 1 ]}Responses
Section titled β Responses β200 OK
object
object
Contacts matching the filter.
Contacts the tags were actually added to.
Example
{ "items": { "matched": 340, "updated": 312 }, "message": "Tags applied to matching contacts.", "total": 312}Still can’t find what you need? Contact support.