> For the complete documentation index, see [llms.txt](https://docs.mailofly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailofly.com/rest-api/api.md).

# API overview

REST API **v1** for Mailofly. Base URL: `https://www.mailofly.com`

## Authentication

Header: `Authorization: Bearer <key>`. Keys use the `mf_live_` prefix. Returns **401** when the key is missing, invalid, or expired.

```http
Authorization: Bearer mf_live_…
```

Create keys in the app under [API keys](/product-guides/api-keys.md).

## Responses & errors

Successful reads typically return `{ "data": … }`. Creates return **201** with `data`. Errors return 4xx/5xx with JSON such as:

```json
{
  "error": "Unauthorized",
  "message": "Invalid API key"
}
```

## Discovery

```bash
curl -sS "https://www.mailofly.com/api/v1" \
  -H "Accept: application/json"
```

No authentication required. Returns available resources and paths.

## Resources

| Resource                                          | Description             |
| ------------------------------------------------- | ----------------------- |
| [Accounts](/rest-api/accounts.md)                 | Sending identities      |
| [Segments](/rest-api/segments.md)                 | Audiences               |
| [Segment contacts](/rest-api/segment-contacts.md) | Membership in a segment |
| [Contacts](/rest-api/contacts.md)                 | People records          |
| [Templates](/rest-api/templates.md)               | Email content           |
| [Campaigns](/rest-api/campaigns.md)               | Campaigns, runs & send  |
| [Compose](/rest-api/compose.md)                   | One-off send            |
| [Mail logs](/rest-api/mail-logs.md)               | Delivery rows           |

## Interactive API explorer

The Mailofly web app includes a **Try it** panel for API requests at <https://www.mailofly.com/docs/api> (in-app docs with live request builder).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mailofly.com/rest-api/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
