# Offers

> Source: https://developers.anymail.watch/offers/

An offer is a document you send with a tracked link. anymail records when the recipient opens it, how long they read and how far they get. The API creates an offer from HTML, which is the way to send an offer written by an AI assistant, and reads the statistics. Reading returns metadata and statistics. The content of the document is not returned.

| Method | Path | Action |
|---|---|---|
| `POST` | `/api/v1/offers` | Create an offer from HTML and send it |
| `GET` | `/api/v1/team` | List the people who can be the contact on an offer |
| `GET` | `/api/v1/offers` | List sent offers |
| `GET` | `/api/v1/offers/{id}` | Get an offer with its visits |

## Create an offer

`POST /api/v1/offers` turns an HTML document into a tracked offer page for one prospect. With `send` true, the default, it also emails the link. The mailbox is chosen automatically, with the same rotation, pauses and daily limits as the app, and the email counts toward the mailbox limit. The HTML is sanitised on the server: scripts and event handlers are removed. Use plain HTML with inline CSS.

| Field | Type | Notes |
|---|---|---|
| `prospect_id` | UUID | Required. |
| `html` | string | Required. The offer document. The whole request can be up to about 500 KB. |
| `subject` | string | Required when `send` is true. |
| `message` | string | The cover message in the email. Empty means the email contains only the link. |
| `message_format` | string | `plain` (default) or `html`. |
| `contact` | string | The salesperson shown on the offer page. An `id` from `GET /api/v1/team`. |
| `send` | boolean | Default `true`. `false` creates the link and sends nothing. |
| `email_gate` | boolean | Ask the reader for an email before showing the offer. Default `false`. |

```bash
curl -X POST "https://app.anymail.watch/api/v1/offers" \
  -H "Authorization: Bearer $ANYMAIL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"prospect_id":"4c0f0f9e-0000-4000-8000-000000000001","html":"<h1>Offer</h1><p>…</p>","subject":"Our offer","contact":"b2c3d4e5-0000-4000-8000-000000000009"}'
```

**Response `201`:** `{"id":"…","url":"https://…/offer/…","status":"sent","recipient":"ada@acme.com","mailbox_id":"…"}`. With `send: false`, `status` is `link_only` and `mailbox_id` is `null`.

| Status | Message |
|---|---|
| `400` | `` Unknown field(s): … ``, `` `prospect_id` must be a prospect id (uuid). ``, `` `html` is required … ``, `` `subject` is required when `send` is true. ``, `` `contact` is not a person in this workspace. … `` |
| `404` | `Prospect not found.` |
| `409` | The prospect is on the suppression list, or no mailbox can send now. Nothing was sent. |
| `502` | The mail server refused the message. The offer link was saved. |

Once the recipient opens the link, the signals `offer_opened`, `offer_read` and `offer_temperature_changed` reach your [webhooks](/webhooks/#events). To let a person review the page before it goes out, create the offer with `send: false`, open the `url`, and then send it.

## List the contacts

`GET /api/v1/team` returns `data`, a list of `{id, kind, name, title, email, phone, role}`. `kind` is `member` for a workspace member and `profile` for a salesperson without a login. Pass the `id` as `contact` when you create an offer.

## List offers

| Parameter | Type | Notes |
|---|---|---|
| `status` | string | One of `sent`, `opened`, `read`. The API applies it to the fetched page. See [Pagination](/pagination/). |
| `prospect_id` | UUID | Offers sent to one prospect. |
| `campaign_id` | UUID | Offers sent in one campaign. |
| `limit` | integer | 1 to 100. Default 50. |
| `cursor` | string | See [Pagination](/pagination/). |

```bash
curl "https://app.anymail.watch/api/v1/offers?status=read" \
  -H "Authorization: Bearer $ANYMAIL_TOKEN"
```

**Response `200`**

```json
{
  "data": [
    {
      "id": "9a1f0b2c-0000-4000-8000-000000000001",
      "prospect": { "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "email": "ada@example.com", "first_name": "Ada", "last_name": null },
      "company": { "id": "1b4e28ba-2fa1-11d2-883f-0016d3cca427", "name": "Example Ltd", "domain": "example.com" },
      "campaign": null,
      "document": { "format": "html_pasted", "label": "Proposal v2", "url": null, "path": "offers/example/proposal-v2.html" },
      "url": "https://app.anymail.watch/offer/Qm9…",
      "sent_at": "2026-09-01T10:00:00.000+00:00",
      "status": "opened",
      "visit_status": "returned",
      "visits": 2,
      "returns": 1,
      "total_active_seconds": 247,
      "progress": { "max_page_reached": 3, "total_pages": 6, "completed": false },
      "first_viewed_at": "2026-09-01T11:02:00.000+00:00",
      "last_viewed_at": "2026-09-02T09:15:00.000+00:00"
    }
  ],
  "next_cursor": null
}
```

### Two status fields

| Field | Values | Answers |
|---|---|---|
| `status` | `sent`, `opened`, `read` | Did the recipient read it? `read` means they reached the end (`completed`) or the last known page. |
| `visit_status` | `sent`, `viewed`, `returned` | How many times did they come back? 0, 1, or 2 or more visits. |

- `total_active_seconds` is the sum over all visits.
- `progress.total_pages` is `null` for a PDF without sections. For such a document `completed` is the only signal for `read`.
- `url` is the public address of the offer, the one the app shows under **Copy link**. It uses the white-label host when the workspace sets one.
- `campaign` is `null` when the offer was not sent from a campaign.

**Errors:** `400` for an invalid `status`, UUID, `limit` or `cursor`.

## Get an offer

`GET /api/v1/offers/{id}` returns the row above plus the visits and the reading time per page.

```bash
curl "https://app.anymail.watch/api/v1/offers/9a1f0b2c-0000-4000-8000-000000000001" \
  -H "Authorization: Bearer $ANYMAIL_TOKEN"
```

**Response `200`** (the fields of the list row are shortened)

```json
{
  "id": "9a1f0b2c-0000-4000-8000-000000000001",
  "status": "opened",
  "visits": 2,
  "visit_list": [
    {
      "session_id": "s2",
      "started_at": "2026-09-02T09:15:00.000+00:00",
      "active_seconds": 40,
      "device": "iPhone · Safari",
      "max_page_reached": 3,
      "completed": false,
      "visit_index": 2
    },
    {
      "session_id": "s1",
      "started_at": "2026-09-01T11:02:00.000+00:00",
      "active_seconds": 207,
      "device": "Mac · Chrome",
      "max_page_reached": 2,
      "completed": false,
      "visit_index": 1
    }
  ],
  "pages": [
    { "id": "sec1", "position": 0, "label": "Intro", "page_type": "cover", "visits_read": 2, "total_active_seconds": 70, "last_read_at": "2026-09-02T09:16:00.000+00:00" },
    { "id": "sec2", "position": 1, "label": "Pricing", "page_type": "pricing", "visits_read": 1, "total_active_seconds": 30, "last_read_at": null }
  ]
}
```

- `visit_list` holds up to the 200 latest visits, newest first. `visit_index` counts in time order, so `1` is the first visit.
- `device` is approximate, for example `Mac · Chrome`, `Unknown device` or `Automated client`.
- `pages` sums the reading time per page or section over all visits. It is empty for a PDF without sections.

**Errors:** `404` with `{"error":"Offer not found."}`.

## Related

- [Companies](/companies/)
- [Prospects](/prospects/)
- [Campaigns](/campaigns/)
