Segments and contacts
Manage the contacts and segments you send broadcasts to.
- POSTCreate a segment
/segments - GETRetrieve a segment
/segments/{id} - GETList segments
/segments - GETList a segment's contacts
/segments/{id}/contacts - DELETEDelete a segment
/segments/{id} - POSTCreate a contact
/contacts - GETRetrieve a contact
/contacts/{id|email} - GETList contacts
/contacts - PATCHUpdate a contact
/contacts/{id|email} - POSTAdd a contact to a segment
/contacts/{id|email}/segments/{segment_id} - DELETERemove a contact from a segment
/contacts/{id|email}/segments/{segment_id} - DELETEDelete a contact
/contacts/{id|email}
Contacts can belong to any number of segments. They're separate from iResendly Marketing's contacts. Plan limits: 1,000, 10,000 or 50,000 contacts and 1, 10 or 100 segments. A spam complaint unsubscribes the contact automatically.
curl -X POST 'https://api.iresendly.com/segments' \
-H 'Authorization: Bearer irs_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"name": "Newsletter"
}'{
"object": "segment",
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"name": "Newsletter"
}Retrieve a segment
/segments/{id}One segment with its contact count (unsubscribed contacts included).
idstringrequiredThe segment id.
curl -X GET 'https://api.iresendly.com/segments/{id}' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"object": "segment",
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"name": "Newsletter",
"contacts_count": 1204
}curl -X GET 'https://api.iresendly.com/segments' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"object": "list",
"has_more": false,
"data": [
{
"object": "segment",
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"name": "Newsletter",
"contacts_count": 1204
}
]
}List a segment's contacts
/segments/{id}/contactsThe contacts in one segment.
idstringrequiredThe segment id.
limitnumberResults per page, 1–100. Default 20.
afterstringReturn results after this id (next page).
beforestringReturn results before this id (previous page). Don't send with
after.
curl -X GET 'https://api.iresendly.com/segments/{id}/contacts' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"object": "list",
"has_more": false,
"data": [
{
"object": "contact",
"id": "479e3145-dd38-476b-932c-529ceb705947",
"email": "steve@example.com"
}
]
}Delete a segment
/segments/{id}Deletes the segment. Its contacts are kept.
idstringrequiredThe segment id.
curl -X DELETE 'https://api.iresendly.com/segments/{id}' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"object": "segment",
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"deleted": true
}Create a contact
/contactsCreates the contact, or, if the email already exists, updates it and adds the segments.
emailstringrequiredThe contact's address.
first_name · last_namestringUsed by
{{{FIRST_NAME}}}and{{{LAST_NAME}}}.unsubscribedbooleanOpted out of broadcasts.
propertiesobjectCustom fields (string, number or null), usable as
{{{key}}}. Updates merge into existing ones.segments{ id }[]Segments to add the contact to.
curl -X POST 'https://api.iresendly.com/contacts' \
-H 'Authorization: Bearer irs_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"email": "steve@example.com",
"first_name": "Steve",
"segments": [
{
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf"
}
]
}'{
"object": "contact",
"id": "479e3145-dd38-476b-932c-529ceb705947"
}Retrieve a contact
/contacts/{id|email}By id or by email address.
id|emailstringrequiredThe contact id or email.
curl -X GET 'https://api.iresendly.com/contacts/{id|email}' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"object": "contact",
"id": "479e3145-dd38-476b-932c-529ceb705947",
"email": "steve@example.com",
"first_name": "Steve",
"unsubscribed": false,
"segments": [
{
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf"
}
]
}List contacts
/contactsAll contacts, or one segment's with segment_id.
segment_idstringOnly this segment's contacts.
limitnumberResults per page, 1–100. Default 20.
afterstringReturn results after this id (next page).
beforestringReturn results before this id (previous page). Don't send with
after.
curl -X GET 'https://api.iresendly.com/contacts' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"object": "list",
"has_more": false,
"data": []
}Update a contact
/contacts/{id|email}Change names, properties or unsubscribed.
id|emailstringrequiredThe contact id or email.
curl -X PATCH 'https://api.iresendly.com/contacts/{id|email}' \
-H 'Authorization: Bearer irs_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"unsubscribed": true
}'{
"object": "contact",
"id": "479e3145-dd38-476b-932c-529ceb705947"
}Add a contact to a segment
/contacts/{id|email}/segments/{segment_id}Adds an existing contact to a segment.
id|emailstringrequiredThe contact id or email.
segment_idstringrequiredThe segment id.
curl -X POST 'https://api.iresendly.com/contacts/{id|email}/segments/{segment_id}' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf"
}Remove a contact from a segment
/contacts/{id|email}/segments/{segment_id}Takes the contact out of the segment. The contact itself is kept.
id|emailstringrequiredThe contact id or email.
segment_idstringrequiredThe segment id.
curl -X DELETE 'https://api.iresendly.com/contacts/{id|email}/segments/{segment_id}' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
"deleted": true
}Delete a contact
/contacts/{id|email}Deletes the contact from every segment.
id|emailstringrequiredThe contact id or email.
curl -X DELETE 'https://api.iresendly.com/contacts/{id|email}' \
-H 'Authorization: Bearer irs_xxxxxxxxx'{
"object": "contact",
"contact": "479e3145-dd38-476b-932c-529ceb705947",
"deleted": true
}