REST API

Segments

Contact segments (audiences). Used by campaigns as the recipient set.

GET/api/v1/segments

List segments

Lists contact segments (audiences), ordered by name. Used by campaigns as the recipient set.

Authentication: Authorization: Bearer with your Mailofly API key

cURL
curl -sS -X GET "https://www.mailofly.com/api/v1/segments" \
  -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": [ … ] }
GET/api/v1/segments
POST/api/v1/segments

Create segment

Creates a segment with a non-empty name.

Authentication: Authorization: Bearer with your Mailofly API key

Request body

{ "name": "Newsletter" }
cURL
curl -sS -X POST "https://www.mailofly.com/api/v1/segments" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"Newsletter"}'

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": { "id": "uuid", "name": "Newsletter" } }
POST/api/v1/segments
GET/api/v1/segments/{id}

Get segment

Fetch one segment.

Authentication: Authorization: Bearer with your Mailofly API key

Path parameters

FieldType
iduuid
cURL
curl -sS -X GET "https://www.mailofly.com/api/v1/segments/00000000-0000-0000-0000-000000000001" \
  -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": { … } }
GET/api/v1/segments/{id}
PATCH/api/v1/segments/{id}

Update segment

Body must include a non-empty name.

Authentication: Authorization: Bearer with your Mailofly API key

Path parameters

FieldType
iduuid

Request body

{ "name": "Renamed" }
cURL
curl -sS -X PATCH "https://www.mailofly.com/api/v1/segments/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"Renamed"}'

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": { … } }
PATCH/api/v1/segments/{id}
DELETE/api/v1/segments/{id}

Delete segment

Deletes the segment. Contacts are not deleted.

Authentication: Authorization: Bearer with your Mailofly API key

Path parameters

FieldType
iduuid
cURL
curl -sS -X DELETE "https://www.mailofly.com/api/v1/segments/00000000-0000-0000-0000-000000000001" \
  -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 }
DELETE/api/v1/segments/{id}