REST API
Manage which contacts belong to a segment. Removing a link does not delete the contact.
/api/v1/segments/{id}/contactsReturns full contact rows for members of the segment.
Authentication: Authorization: Bearer with your Mailofly API key
Path parameters
| Field | Type | Description |
|---|---|---|
| id | uuid | Segment id. |
curl -sS -X GET "https://www.mailofly.com/api/v1/segments/00000000-0000-0000-0000-000000000001/contacts" \
-H "Accept: application/json" \
-H "Authorization: Bearer mf_live_your_key_here"Requests use https://www.mailofly.com
Response
Try it sends the request through this app to https://www.mailofly.com (no browser CORS issues).
Click Try it to run the example against the live API.
Example responses
{ "data": [ … ] }/api/v1/segments/{id}/contactsPass contact_id for an existing contact, or email (with optional name fields) to create-or-link. Removing membership does not delete the contact.
Authentication: Authorization: Bearer with your Mailofly API key
Path parameters
| Field | Type | Description |
|---|---|---|
| id | uuid | Segment id. |
Body — by email
{
"email": "user@example.com",
"first_name": "Ada"
}curl -sS -X POST "https://www.mailofly.com/api/v1/segments/00000000-0000-0000-0000-000000000001/contacts" \
-H "Accept: application/json" \
-H "Authorization: Bearer mf_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","first_name":"Ada"}'Requests use https://www.mailofly.com
Response
Try it sends the request through this app to https://www.mailofly.com (no browser CORS issues).
Click Try it to run the example against the live API.
Example responses
{ "data": { … } }/api/v1/segments/{id}/contacts/{contactId}Drops membership only; the contact record remains.
Authentication: Authorization: Bearer with your Mailofly API key
Path parameters
| Field | Type | Description |
|---|---|---|
| id | uuid | Segment id. |
| contactId | uuid | Contact id. |
curl -sS -X DELETE "https://www.mailofly.com/api/v1/segments/00000000-0000-0000-0000-000000000001/contacts/00000000-0000-0000-0000-000000000002" \
-H "Accept: application/json" \
-H "Authorization: Bearer mf_live_your_key_here"Requests use https://www.mailofly.com
Response
Try it sends the request through this app to https://www.mailofly.com (no browser CORS issues).
Click Try it to run the example against the live API.
Example responses
{ "ok": true }