> 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/campaigns.md).

# Campaigns, runs & send

Campaign CRUD, run history, and the send endpoint (queues delivery like “Send now” in the app).

## GET `/api/v1/campaigns`

**List campaigns**

Lists campaigns for the user.

### Examples

#### 200 — OK

```json
{ "data": [ … ] }
```

### cURL

```bash
curl -sS -X GET "https://www.mailofly.com/api/v1/campaigns" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## POST `/api/v1/campaigns`

**Create campaign**

schedule\_type: manual | scheduled\_once | recurring | recurring\_new\_contacts. For scheduled\_once set scheduled\_at (ISO 8601). For recurring set recurrence\_interval (≥1) and recurrence\_unit: day | week | month.

### Request body — Body

```json
{
  "title": "April newsletter",
  "description": "Internal note",
  "segment_id": "uuid",
  "template_id": "uuid",
  "schedule_type": "manual"
}
```

### Examples

#### 201 — Created

```json
{ "data": { … } }
```

### cURL

```bash
curl -sS -X POST "https://www.mailofly.com/api/v1/campaigns" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"title":"April newsletter","segment_id":"uuid","template_id":"uuid","schedule_type":"manual"}'
```

## GET `/api/v1/campaigns/{id}`

**Get campaign**

Fetch one campaign.

### Examples

#### 200 — OK

```json
{ "data": { … } }
```

### cURL

```bash
curl -sS -X GET "https://www.mailofly.com/api/v1/campaigns/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## PATCH `/api/v1/campaigns/{id}`

**Update campaign**

Partial update.

### Request body — Body

```json
{ "title": "Renamed" }
```

### Examples

#### 200 — OK

```json
{ "data": { … } }
```

### cURL

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

## DELETE `/api/v1/campaigns/{id}`

**Delete campaign**

Deletes the campaign.

### Examples

#### 200 — OK

```json
{ "ok": true }
```

### cURL

```bash
curl -sS -X DELETE "https://www.mailofly.com/api/v1/campaigns/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## GET `/api/v1/campaigns/{id}/runs`

**List campaign runs**

Runs for the campaign, newest first. Items include aggregate counts from mail logs: total, sent, failed, pending, etc.

### Examples

#### 200 — OK

```json
{ "data": [ … ] }
```

### cURL

```bash
curl -sS -X GET "https://www.mailofly.com/api/v1/campaigns/00000000-0000-0000-0000-000000000001/runs" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## POST `/api/v1/campaigns/{id}/send`

**Send campaign**

Queues delivery to the segment audience. Requires segment and template. JSON aliases: sendNow, senderAccountIds. Omit sender\_account\_ids for default account selection.

### Request body — Body

```json
{
  "send_now": true,
  "sender_account_ids": ["00000000-0000-0000-0000-000000000002"]
}
```

### Examples

#### 200 — OK

```json
{ "ok": true, "campaign_id": "…", "contacts_messaged": 10 }
```

### cURL

```bash
curl -sS -X POST "https://www.mailofly.com/api/v1/campaigns/00000000-0000-0000-0000-000000000001/send" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"send_now":true,"sender_account_ids":["00000000-0000-0000-0000-000000000002"]}'
```

## Related

* [Product: Campaigns](/product-guides/campaigns.md)
* [Compose API](/rest-api/compose.md)
* [Mail logs API](/rest-api/mail-logs.md)
* [← API overview](/rest-api/api.md)


---

# 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/campaigns.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.
