Skip to main content

REST API v1

API Reference

All 93 endpoints. Click any one to see the fields you send and the shape you get back. Prefer to generate a client? Take the OpenAPI spec.

Base URL https://tweak.email/api/v1 Auth Authorization: Bearer <key> Keys: every paid plan, in the app under Settings → API Guides and concepts

Identity

Who the presented key belongs to

GET /me

Returns the owning team, whether its plan includes API access, the key's scopes and expiry, and the applicable rate limit. Answers even when the plan has no API access (every other endpoint is then a 403 `plan_required`), so an integration can tell why.

Response

data object
data.team object
data.api_key object or null
data.rate_limit object

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/me \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "team": {
            "id": 9,
            "name": "Acme",
            "plan": "business",
            "api_access": true,
            "required_plan": null,
            "on_trial": false,
            "trial_ends_at": null
        },
        "api_key": {
            "id": 4,
            "name": "CRM sync",
            "scopes": [
                "contacts:read",
                "contacts:write"
            ],
            "legacy": false,
            "expires_at": null
        },
        "rate_limit": {
            "requests_per_minute": 600
        }
    }
}

Contacts

Contacts, lists, tags, and segments

GET /contacts

Requires scope contacts:read

Cursor-paginated. Filterable by status, tag, list, segment, and modification time.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.
status string
Filter by contact status.
active pending unsubscribed bounced
tag_id integer
Only contacts carrying this tag.
list_id integer
Only contacts on this list.
segment_id integer
Only contacts matching this saved segment.
updated_since string
ISO 8601 timestamp. Only contacts modified since. Use this to run an incremental sync.
include string
Comma-separated relations to embed: tags, lists.

Response

data array of object
data.id integer
data.email string
data.first_name string or null
data.last_name string or null
data.status string
active pending unsubscribed bounced
data.metadata object
data.subscribed_at string or null
data.unsubscribed_at string or null
data.confirmed_at string or null
data.consent_source string or null
How consent was obtained: `api`, `import`, `manual`, `signup_form`, `embedded_form`, or the value your integration supplied. Older records confirmed by e-mail may say `double_opt_in`; confirmation is now recorded in `confirmed_at` instead.
data.consent_attested_at string or null
When the sender attested that this contact gave permission to be emailed.
data.soft_bounce_count integer
data.created_at string or null
data.updated_at string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/contacts \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 42,
            "email": "jane@example.com",
            "first_name": "Jane",
            "last_name": "Okonkwo",
            "status": "active",
            "metadata": {
                "company": "Acme",
                "city": "Copenhagen"
            },
            "subscribed_at": "2026-08-01T09:15:00+00:00",
            "unsubscribed_at": null,
            "confirmed_at": null,
            "consent_source": "signup_form",
            "consent_attested_at": "2026-08-01T09:15:00+00:00",
            "soft_bounce_count": 0,
            "created_at": "2026-08-01T09:15:00+00:00",
            "updated_at": "2026-08-09T14:02:00+00:00"
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /contacts

Requires scope contacts:write

Upserts on email address. An existing contact that has unsubscribed or bounced keeps that status regardless of what is sent. Use `status_if_new` to control only what a brand-new contact is created as. When the request creates a contact (or restores a deleted one), `consent_attested` must be `true` (your confirmation that the person gave permission to receive email from you and was not taken from a purchased, rented or scraped list), otherwise the request is refused with 422. An update of an existing contact does not need it, so a sync that only changes metadata can leave it out.

Tags can be given by id (`tag_ids`) or by name (`tags`); a name your team has no tag for creates that tag.

`metadata` is merged into what is stored: keys you send overwrite, a key sent as `null` is removed (so is one sent as an empty string), and keys you leave out are kept. Send `"metadata": null` to clear it all.

Re-adding the address of a deleted contact restores that contact with the data you send (201). A deleted contact who had unsubscribed or bounced comes back with that status.

Creating a contact as `active` starts your active sequences with the signup trigger, including those limited to a list the contact is added to, as adding the contact in the app does. A contact created as `pending`, and a restored contact, does not start them.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

email string Required
first_name string
last_name string
metadata object or null
Arbitrary key/value data, addressable as merge tags. Merged into what is stored: keys you send overwrite, a key sent as `null` is removed (so is one sent as an empty string), keys you leave out are kept. `null` clears it all. A key that is one of your contact fields is stored in that field's type (`"1200"` becomes 1200 for a number field; a date field takes `YYYY-MM-DD` or a full ISO 8601 date-time, stored as its date); a value that cannot be converted is a 422 naming the key (`metadata.seats`) and the type expected. Other keys are stored as sent.
status_if_new string
Status for a contact that does not already exist. Has no effect on an existing contact.
active pending
tag_ids array of integer
Tags to add, by id. Ids that are not your team's are skipped.
tags array of string
Tags to add, by name (matched without regard to case). A name your team has no tag for creates that tag.
list_ids array of integer
consent_source string
Where consent was captured. Recorded for compliance evidence.
consent_ip string
consent_attested boolean
Required, and must be `true`, when the request creates a contact (or restores a deleted one): confirms this person gave permission to receive email from you and was not taken from a purchased, rented or scraped list. Recorded as `consent_attested_at` on the new contact. Not needed to update an existing contact.

Response

201
Created: no contact had this address, or a deleted one was restored.
200
An existing contact was updated.
data object
data.id integer
data.email string
data.first_name string or null
data.last_name string or null
data.status string
active pending unsubscribed bounced
data.metadata object
data.subscribed_at string or null
data.unsubscribed_at string or null
data.confirmed_at string or null
data.consent_source string or null
How consent was obtained: `api`, `import`, `manual`, `signup_form`, `embedded_form`, or the value your integration supplied. Older records confirmed by e-mail may say `double_opt_in`; confirmation is now recorded in `confirmed_at` instead.
data.consent_attested_at string or null
When the sender attested that this contact gave permission to be emailed.
data.soft_bounce_count integer
data.created_at string or null
data.updated_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/contacts \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"jane@example.com","first_name":"Jane","last_name":"Okonkwo","metadata":{"company":"Acme","plan":"pro"},"status_if_new":"active","tag_ids":[3,8],"tags":["customer","newsletter"],"list_ids":[1],"consent_source":"signup_form","consent_ip":"203.0.113.24","consent_attested":true}'

Request body

{
    "email": "jane@example.com",
    "first_name": "Jane",
    "last_name": "Okonkwo",
    "metadata": {
        "company": "Acme",
        "plan": "pro"
    },
    "status_if_new": "active",
    "tag_ids": [
        3,
        8
    ],
    "tags": [
        "customer",
        "newsletter"
    ],
    "list_ids": [
        1
    ],
    "consent_source": "signup_form",
    "consent_ip": "203.0.113.24",
    "consent_attested": true
}

Response 201

{
    "data": {
        "id": 42,
        "email": "jane@example.com",
        "first_name": "Jane",
        "last_name": "Okonkwo",
        "status": "active",
        "metadata": {
            "company": "Acme",
            "city": "Copenhagen"
        },
        "subscribed_at": "2026-08-01T09:15:00+00:00",
        "unsubscribed_at": null,
        "confirmed_at": null,
        "consent_source": "signup_form",
        "consent_attested_at": "2026-08-01T09:15:00+00:00",
        "soft_bounce_count": 0,
        "created_at": "2026-08-01T09:15:00+00:00",
        "updated_at": "2026-08-09T14:02:00+00:00"
    }
}
POST /contacts/bulk

Requires scope contacts:write

Up to 1,000 per call. Returns a per-row result so a partial success is legible. Every row that creates a contact (or restores a deleted one) needs an attestation: `consent_attested: true` for the whole batch, or on that row. Without it the whole batch is refused with 422, naming each such row (`contacts.3.consent_attested`). Rows that only update existing contacts need none. Metadata is merged per contact exactly as on the single upsert, and deleted addresses are restored. `tags` (names) and `tag_ids` apply to every contact in the batch. A row that creates an `active` contact starts your active signup-triggered sequences, including those limited to a list the contact is added to; a restored or `pending` contact does not start them.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

contacts array of object Required
contacts.email string Required
contacts.first_name string
contacts.last_name string
contacts.metadata object or null
Arbitrary key/value data, addressable as merge tags. Merged into an existing contact's metadata, as on the single upsert, with values for your contact fields converted to the field's type (or refused, naming `contacts.N.metadata.key`).
contacts.status_if_new string
Status for a contact that does not already exist. Has no effect on an existing contact.
active pending
contacts.consent_attested boolean
This row's attestation, for a batch that does not attest as a whole. Needed (as `true`) only when the row creates a contact.
tag_ids array of integer
Applied to every contact in the batch.
tags array of string
Tag names applied to every contact in the batch; missing tags are created.
list_ids array of integer
Applied to every contact in the batch.
consent_attested boolean
`true` confirms every contact in the batch gave permission to receive email from you and the list is not purchased, rented or scraped. Needed when the batch creates contacts, unless each such row attests itself. Recorded as `consent_attested_at` on each new contact.
consent_source string
Where consent was captured, applied to new contacts in the batch. Defaults to `api`.

Response

data array of object
data.email string
data.id integer
data.created boolean
True for a new (or restored) contact.
data.status string
created integer
updated integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/contacts/bulk \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contacts":[{"email":"jane@example.com","first_name":"Jane","last_name":"Okonkwo","metadata":{"company":"Acme"},"status_if_new":"active","consent_attested":true}],"tag_ids":[3],"tags":["imported"],"list_ids":[1],"consent_attested":true,"consent_source":"signup_form"}'

Request body

{
    "contacts": [
        {
            "email": "jane@example.com",
            "first_name": "Jane",
            "last_name": "Okonkwo",
            "metadata": {
                "company": "Acme"
            },
            "status_if_new": "active",
            "consent_attested": true
        }
    ],
    "tag_ids": [
        3
    ],
    "tags": [
        "imported"
    ],
    "list_ids": [
        1
    ],
    "consent_attested": true,
    "consent_source": "signup_form"
}

Response 200

{
    "data": [
        {
            "email": "jane@example.com",
            "id": 42,
            "created": true,
            "status": "active"
        }
    ],
    "created": 1,
    "updated": 0
}
GET /contacts/{contact}

Requires scope contacts:read

Accepts either a numeric id or an email address.

Path parameters

contact string Required
Contact id, or the contact's email address.

Response

data object
data.id integer
data.email string
data.first_name string or null
data.last_name string or null
data.status string
active pending unsubscribed bounced
data.metadata object
data.subscribed_at string or null
data.unsubscribed_at string or null
data.confirmed_at string or null
data.consent_source string or null
How consent was obtained: `api`, `import`, `manual`, `signup_form`, `embedded_form`, or the value your integration supplied. Older records confirmed by e-mail may say `double_opt_in`; confirmation is now recorded in `confirmed_at` instead.
data.consent_attested_at string or null
When the sender attested that this contact gave permission to be emailed.
data.soft_bounce_count integer
data.created_at string or null
data.updated_at string or null

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/contacts/:contact \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "email": "jane@example.com",
        "first_name": "Jane",
        "last_name": "Okonkwo",
        "status": "active",
        "metadata": {
            "company": "Acme",
            "city": "Copenhagen"
        },
        "subscribed_at": "2026-08-01T09:15:00+00:00",
        "unsubscribed_at": null,
        "confirmed_at": null,
        "consent_source": "signup_form",
        "consent_attested_at": "2026-08-01T09:15:00+00:00",
        "soft_bounce_count": 0,
        "created_at": "2026-08-01T09:15:00+00:00",
        "updated_at": "2026-08-09T14:02:00+00:00"
    }
}
PATCH /contacts/{contact}

Requires scope contacts:write

Setting `status` to `unsubscribed` also creates a suppression; setting it back to `active` lifts only the unsubscribe suppression, never a bounce or complaint. `metadata` is merged as on the upsert.

Path parameters

contact string Required
Contact id, or the contact's email address.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

first_name string or null
last_name string or null
metadata object or null
Merged into the stored metadata: keys you send overwrite, a key sent as `null` is removed (so is one sent as an empty string), keys you leave out are kept. `null` clears it all. Values for your contact fields are converted to the field's type, or refused with 422 naming the key.
status string
active pending unsubscribed
tag_ids array of integer
Replaces the contact's tags. Sent with `tags`, the contact gets the tags of both.
tags array of string
Replaces the contact's tags, by name; a name your team has no tag for creates that tag.
list_ids array of integer
Replaces the contact's list memberships.

Response

data object
data.id integer
data.email string
data.first_name string or null
data.last_name string or null
data.status string
active pending unsubscribed bounced
data.metadata object
data.subscribed_at string or null
data.unsubscribed_at string or null
data.confirmed_at string or null
data.consent_source string or null
How consent was obtained: `api`, `import`, `manual`, `signup_form`, `embedded_form`, or the value your integration supplied. Older records confirmed by e-mail may say `double_opt_in`; confirmation is now recorded in `confirmed_at` instead.
data.consent_attested_at string or null
When the sender attested that this contact gave permission to be emailed.
data.soft_bounce_count integer
data.created_at string or null
data.updated_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/contacts/:contact \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"first_name":"Jane","last_name":"Okonkwo","metadata":{"plan":"pro","city":null},"status":"active","tag_ids":[3,8],"tags":["customer"],"list_ids":[1]}'

Request body

{
    "first_name": "Jane",
    "last_name": "Okonkwo",
    "metadata": {
        "plan": "pro",
        "city": null
    },
    "status": "active",
    "tag_ids": [
        3,
        8
    ],
    "tags": [
        "customer"
    ],
    "list_ids": [
        1
    ]
}

Response 200

{
    "data": {
        "id": 42,
        "email": "jane@example.com",
        "first_name": "Jane",
        "last_name": "Okonkwo",
        "status": "active",
        "metadata": {
            "company": "Acme",
            "city": "Copenhagen"
        },
        "subscribed_at": "2026-08-01T09:15:00+00:00",
        "unsubscribed_at": null,
        "confirmed_at": null,
        "consent_source": "signup_form",
        "consent_attested_at": "2026-08-01T09:15:00+00:00",
        "soft_bounce_count": 0,
        "created_at": "2026-08-01T09:15:00+00:00",
        "updated_at": "2026-08-09T14:02:00+00:00"
    }
}
DELETE /contacts/{contact}

Requires scope contacts:write

Soft delete: the contact disappears from every endpoint (a second delete is a 404) and can be re-added with the upsert. Sends the `contact.deleted` webhook. For GDPR erasure use the erase endpoint instead.

Path parameters

contact string Required
Contact id, or the contact's email address.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.deleted boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/contacts/:contact \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "deleted": true
    }
}
POST /contacts/{contact}/tags

Requires scope contacts:write

By id (`tag_ids`), by name (`tags`, creating any tag your team does not have yet), or both. Adding a tag fires any tag-triggered sequence enrolment, exactly as it does in the app, and sends `contact.updated` when the contact's tags changed.

Path parameters

contact string Required
Contact id or email address.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

tag_ids array of integer
Tags by id. Ids that are not your team's are skipped.
tags array of string
Tags by name, matched without regard to case; missing tags are created.

Response

data object
data.id integer
data.email string
data.first_name string or null
data.last_name string or null
data.status string
active pending unsubscribed bounced
data.metadata object
data.subscribed_at string or null
data.unsubscribed_at string or null
data.confirmed_at string or null
data.consent_source string or null
How consent was obtained: `api`, `import`, `manual`, `signup_form`, `embedded_form`, or the value your integration supplied. Older records confirmed by e-mail may say `double_opt_in`; confirmation is now recorded in `confirmed_at` instead.
data.consent_attested_at string or null
When the sender attested that this contact gave permission to be emailed.
data.soft_bounce_count integer
data.created_at string or null
data.updated_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/contacts/:contact/tags \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tag_ids":[3],"tags":["vip"]}'

Request body

{
    "tag_ids": [
        3
    ],
    "tags": [
        "vip"
    ]
}

Response 200

{
    "data": {
        "id": 42,
        "email": "jane@example.com",
        "first_name": "Jane",
        "last_name": "Okonkwo",
        "status": "active",
        "metadata": {
            "company": "Acme",
            "city": "Copenhagen"
        },
        "subscribed_at": "2026-08-01T09:15:00+00:00",
        "unsubscribed_at": null,
        "confirmed_at": null,
        "consent_source": "signup_form",
        "consent_attested_at": "2026-08-01T09:15:00+00:00",
        "soft_bounce_count": 0,
        "created_at": "2026-08-01T09:15:00+00:00",
        "updated_at": "2026-08-09T14:02:00+00:00"
    }
}
DELETE /contacts/{contact}/tags/{tag}

Requires scope contacts:write

Sends `contact.updated` when the contact had the tag. An unknown tag is a 404; no tag is created.

Path parameters

contact string Required
Contact id or email address.
tag string Required
Tag id, or the tag's name (URL-encoded, matched without regard to case) when it is not a number.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.email string
data.first_name string or null
data.last_name string or null
data.status string
active pending unsubscribed bounced
data.metadata object
data.subscribed_at string or null
data.unsubscribed_at string or null
data.confirmed_at string or null
data.consent_source string or null
How consent was obtained: `api`, `import`, `manual`, `signup_form`, `embedded_form`, or the value your integration supplied. Older records confirmed by e-mail may say `double_opt_in`; confirmation is now recorded in `confirmed_at` instead.
data.consent_attested_at string or null
When the sender attested that this contact gave permission to be emailed.
data.soft_bounce_count integer
data.created_at string or null
data.updated_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/contacts/:contact/tags/:tag \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "email": "jane@example.com",
        "first_name": "Jane",
        "last_name": "Okonkwo",
        "status": "active",
        "metadata": {
            "company": "Acme",
            "city": "Copenhagen"
        },
        "subscribed_at": "2026-08-01T09:15:00+00:00",
        "unsubscribed_at": null,
        "confirmed_at": null,
        "consent_source": "signup_form",
        "consent_attested_at": "2026-08-01T09:15:00+00:00",
        "soft_bounce_count": 0,
        "created_at": "2026-08-01T09:15:00+00:00",
        "updated_at": "2026-08-09T14:02:00+00:00"
    }
}
POST /contacts/{contact}/erase

Requires scope contacts:write

Permanently removes the contact and anonymises their delivery events. The suppression record is deliberately retained so an erased opt-out is never lost. Sends `contact.deleted` with `erased: true` and no email address.

Path parameters

contact string Required
Contact id or email address.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.contacts_deleted integer
data.events_anonymized integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/contacts/:contact/erase \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "contacts_deleted": 1,
        "events_anonymized": 1
    }
}
GET /lists

Requires scope contacts:read

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.name string
data.description string or null
data.is_default boolean
data.opt_in_mode string
single double
data.contacts_count integer
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/lists \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 7,
            "name": "Newsletter",
            "description": "Monthly product news",
            "is_default": false,
            "opt_in_mode": "single",
            "contacts_count": 1280
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /lists

Requires scope contacts:write

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
description string
opt_in_mode string
Double opt-in creates new contacts as `pending` until they confirm.
single double

Response

data object
data.id integer
data.name string
data.description string or null
data.is_default boolean
data.opt_in_mode string
single double
data.contacts_count integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/lists \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Newsletter","description":"Monthly product news","opt_in_mode":"single"}'

Request body

{
    "name": "Newsletter",
    "description": "Monthly product news",
    "opt_in_mode": "single"
}

Response 201

{
    "data": {
        "id": 7,
        "name": "Newsletter",
        "description": "Monthly product news",
        "is_default": false,
        "opt_in_mode": "single",
        "contacts_count": 1280
    }
}
GET /lists/{list}

Requires scope contacts:read

Path parameters

list integer Required
List id.

Response

data object
data.id integer
data.name string
data.description string or null
data.is_default boolean
data.opt_in_mode string
single double
data.contacts_count integer

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/lists/:list \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 7,
        "name": "Newsletter",
        "description": "Monthly product news",
        "is_default": false,
        "opt_in_mode": "single",
        "contacts_count": 1280
    }
}
PATCH /lists/{list}

Requires scope contacts:write

Path parameters

list integer Required
List id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
description string
opt_in_mode string
Double opt-in creates new contacts as `pending` until they confirm.
single double

Response

data object
data.id integer
data.name string
data.description string or null
data.is_default boolean
data.opt_in_mode string
single double
data.contacts_count integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/lists/:list \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Newsletter","description":"Monthly product news","opt_in_mode":"single"}'

Request body

{
    "name": "Newsletter",
    "description": "Monthly product news",
    "opt_in_mode": "single"
}

Response 200

{
    "data": {
        "id": 7,
        "name": "Newsletter",
        "description": "Monthly product news",
        "is_default": false,
        "opt_in_mode": "single",
        "contacts_count": 1280
    }
}
DELETE /lists/{list}

Requires scope contacts:write

The default list cannot be deleted.

Path parameters

list integer Required
List id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.deleted boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/lists/:list \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "deleted": true
    }
}
GET /lists/{list}/contacts

Requires scope contacts:read

Path parameters

list integer Required
List id.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.email string
data.first_name string or null
data.last_name string or null
data.status string
active pending unsubscribed bounced
data.metadata object
data.subscribed_at string or null
data.unsubscribed_at string or null
data.confirmed_at string or null
data.consent_source string or null
How consent was obtained: `api`, `import`, `manual`, `signup_form`, `embedded_form`, or the value your integration supplied. Older records confirmed by e-mail may say `double_opt_in`; confirmation is now recorded in `confirmed_at` instead.
data.consent_attested_at string or null
When the sender attested that this contact gave permission to be emailed.
data.soft_bounce_count integer
data.created_at string or null
data.updated_at string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/lists/:list/contacts \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 42,
            "email": "jane@example.com",
            "first_name": "Jane",
            "last_name": "Okonkwo",
            "status": "active",
            "metadata": {
                "company": "Acme",
                "city": "Copenhagen"
            },
            "subscribed_at": "2026-08-01T09:15:00+00:00",
            "unsubscribed_at": null,
            "confirmed_at": null,
            "consent_source": "signup_form",
            "consent_attested_at": "2026-08-01T09:15:00+00:00",
            "soft_bounce_count": 0,
            "created_at": "2026-08-01T09:15:00+00:00",
            "updated_at": "2026-08-09T14:02:00+00:00"
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /lists/{list}/contacts

Requires scope contacts:write

Ids belonging to another team are silently skipped and reported in the `skipped` count.

Path parameters

list integer Required
List id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

contact_ids array of integer Required

Response

data object
data.list_id integer
data.attached integer
data.skipped integer
Ids that did not resolve to a contact on your team.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/lists/:list/contacts \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contact_ids":[42,43]}'

Request body

{
    "contact_ids": [
        42,
        43
    ]
}

Response 200

{
    "data": {
        "list_id": 1,
        "attached": 1,
        "skipped": 1
    }
}
DELETE /lists/{list}/contacts/{contact}

Requires scope contacts:write

Detaches the membership only. The contact itself is untouched.

Path parameters

list integer Required
List id.
contact integer Required
Contact id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.list_id integer
data.contact_id integer
data.detached boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/lists/:list/contacts/:contact \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "list_id": 7,
        "contact_id": 42,
        "detached": true
    }
}
GET /contact-fields

Requires scope contacts:read

Your team's custom contact fields: the schema the app edits under Settings → Contact Fields. Values live in each contact's `metadata` under the field's `key`; segment rules name the field `custom.<key>`, templates personalise with `{{key}}`.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.name string
data.key string
The `metadata` key values are stored under. Fixed once created.
data.type string
text number date boolean
data.position integer
data.metadata_key string
Same as `key`.
data.merge_tag string
data.segment_field string
The field name in a segment rule condition.
data.created_at string or null
data.updated_at string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/contact-fields \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 12,
            "name": "Plan tier",
            "key": "plan_tier",
            "type": "text",
            "position": 1,
            "metadata_key": "plan_tier",
            "merge_tag": "{{plan_tier}}",
            "segment_field": "custom.plan_tier",
            "created_at": "2026-08-01T09:15:00+00:00",
            "updated_at": "2026-08-01T09:15:00+00:00"
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /contact-fields

Requires scope contacts:write

The key is derived from the name unless you give one. Keys of built-in fields (such as `email`, `first_name`, `company`) are reserved, a key can exist once per team, and a team can define up to 30 fields. Name, key or type problems are a 422 naming the field.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
type string
How values are compared in segment rules: text, number, date (YYYY-MM-DD) or boolean.
text number date boolean
key string
Optional; derived from the name when left out ("Plan tier" becomes `plan_tier`). Use it to match the metadata keys you already send.

Response

data object
data.id integer
data.name string
data.key string
The `metadata` key values are stored under. Fixed once created.
data.type string
text number date boolean
data.position integer
data.metadata_key string
Same as `key`.
data.merge_tag string
data.segment_field string
The field name in a segment rule condition.
data.created_at string or null
data.updated_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/contact-fields \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Plan tier","type":"text","key":"plan_tier"}'

Request body

{
    "name": "Plan tier",
    "type": "text",
    "key": "plan_tier"
}

Response 201

{
    "data": {
        "id": 12,
        "name": "Plan tier",
        "key": "plan_tier",
        "type": "text",
        "position": 1,
        "metadata_key": "plan_tier",
        "merge_tag": "{{plan_tier}}",
        "segment_field": "custom.plan_tier",
        "created_at": "2026-08-01T09:15:00+00:00",
        "updated_at": "2026-08-01T09:15:00+00:00"
    }
}
GET /contact-fields/{field}

Requires scope contacts:read

Path parameters

field integer Required
Contact field id.

Response

data object
data.id integer
data.name string
data.key string
The `metadata` key values are stored under. Fixed once created.
data.type string
text number date boolean
data.position integer
data.metadata_key string
Same as `key`.
data.merge_tag string
data.segment_field string
The field name in a segment rule condition.
data.created_at string or null
data.updated_at string or null

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/contact-fields/:field \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 12,
        "name": "Plan tier",
        "key": "plan_tier",
        "type": "text",
        "position": 1,
        "metadata_key": "plan_tier",
        "merge_tag": "{{plan_tier}}",
        "segment_field": "custom.plan_tier",
        "created_at": "2026-08-01T09:15:00+00:00",
        "updated_at": "2026-08-01T09:15:00+00:00"
    }
}
PATCH /contact-fields/{field}

Requires scope contacts:write

Only the name can change. The key is what stored values and saved templates refer to, and the type is what saved segment rules were checked against, so sending a different `key` or `type` is a 422.

Path parameters

field integer Required
Contact field id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
key string
Accepted only when it is the field's current key (so the field as returned can be sent back); a different key is a 422. Keys are fixed once created.
type string
Accepted only when it is the field's current type; a different type is a 422. Types are fixed once created.

Response

data object
data.id integer
data.name string
data.key string
The `metadata` key values are stored under. Fixed once created.
data.type string
text number date boolean
data.position integer
data.metadata_key string
Same as `key`.
data.merge_tag string
data.segment_field string
The field name in a segment rule condition.
data.created_at string or null
data.updated_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/contact-fields/:field \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Plan","key":"plan_tier","type":"text"}'

Request body

{
    "name": "Plan",
    "key": "plan_tier",
    "type": "text"
}

Response 200

{
    "data": {
        "id": 12,
        "name": "Plan tier",
        "key": "plan_tier",
        "type": "text",
        "position": 1,
        "metadata_key": "plan_tier",
        "merge_tag": "{{plan_tier}}",
        "segment_field": "custom.plan_tier",
        "created_at": "2026-08-01T09:15:00+00:00",
        "updated_at": "2026-08-01T09:15:00+00:00"
    }
}
DELETE /contact-fields/{field}

Requires scope contacts:write

Removes the definition only: values already stored on contacts stay in their metadata, and creating a field with the same key again makes them usable again. A segment rule on the field stops being valid until it is.

Path parameters

field integer Required
Contact field id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.deleted boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/contact-fields/:field \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "deleted": true
    }
}
GET /tags

Requires scope contacts:read

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.name string
data.slug string
data.color string
data.contacts_count integer
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/tags \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 3,
            "name": "VIP",
            "slug": "vip",
            "color": "#6366F1",
            "contacts_count": 214
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /tags

Requires scope contacts:write

Without a `color` the tag gets `#6366F1`.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
color string or null
A hex colour, `#rrggbb`. Omitted or `null`, the tag gets `#6366F1`. Anything else is refused with 422.

Response

data object
data.id integer
data.name string
data.slug string
data.color string
data.contacts_count integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/tags \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"VIP","color":"#10B981"}'

Request body

{
    "name": "VIP",
    "color": "#10B981"
}

Response 201

{
    "data": {
        "id": 3,
        "name": "VIP",
        "slug": "vip",
        "color": "#6366F1",
        "contacts_count": 214
    }
}
GET /tags/{tag}

Requires scope contacts:read

Path parameters

tag integer Required
Tag id.

Response

data object
data.id integer
data.name string
data.slug string
data.color string
data.contacts_count integer

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/tags/:tag \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 3,
        "name": "VIP",
        "slug": "vip",
        "color": "#6366F1",
        "contacts_count": 214
    }
}
PATCH /tags/{tag}

Requires scope contacts:write

Path parameters

tag integer Required
Tag id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
color string or null
A hex colour, `#rrggbb`. Omitted or `null`, the tag gets `#6366F1`. Anything else is refused with 422.

Response

data object
data.id integer
data.name string
data.slug string
data.color string
data.contacts_count integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/tags/:tag \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"VIP","color":"#10B981"}'

Request body

{
    "name": "VIP",
    "color": "#10B981"
}

Response 200

{
    "data": {
        "id": 3,
        "name": "VIP",
        "slug": "vip",
        "color": "#6366F1",
        "contacts_count": 214
    }
}
DELETE /tags/{tag}

Requires scope contacts:write

Path parameters

tag integer Required
Tag id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.deleted boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/tags/:tag \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "deleted": true
    }
}
GET /segments

Requires scope contacts:read

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.name string
data.definition object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/segments \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 5,
            "name": "Engaged in Copenhagen",
            "definition": {
                "tag_ids": [
                    3
                ],
                "date_from": "2026-01-01",
                "date_to": null,
                "search": null,
                "company": null,
                "location": "Copenhagen",
                "engagement": {
                    "type": "opened",
                    "days": 90
                },
                "rules": {
                    "version": 1,
                    "match": "all",
                    "timezone": "Europe/Copenhagen",
                    "groups": [
                        {
                            "match": "all",
                            "conditions": [
                                {
                                    "field": "custom.plan",
                                    "operator": "is",
                                    "value": "trial"
                                },
                                {
                                    "field": "custom.signup_date",
                                    "operator": "in_last_days",
                                    "value": 14
                                }
                            ]
                        },
                        {
                            "match": "any",
                            "conditions": [
                                {
                                    "field": "country",
                                    "operator": "is",
                                    "value": "Denmark"
                                },
                                {
                                    "field": "custom.seats",
                                    "operator": "gte",
                                    "value": 10
                                }
                            ]
                        }
                    ],
                    "exclude": {
                        "segment_ids": [
                            5
                        ],
                        "tag_ids": [
                            7
                        ]
                    }
                }
            }
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /segments

Requires scope contacts:write

A definition key the API does not know is refused with 422 naming the key, rather than ignored, and so is a top-level field other than `name` and `definition` (for example `rules` sent beside `definition` instead of inside it).

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
definition object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.
definition.tag_ids array of integer
Contacts carrying any of these tags.
definition.date_from string or null
Subscribed on or after this date.
definition.date_to string or null
Subscribed on or before this date.
definition.search string or null
Matches email, first name, or last name.
definition.company string or null
Matches the contact metadata `company` field.
definition.location string or null
Matches metadata city, country, or location.
definition.engagement object or null
Restrict to contacts by email engagement over a trailing window. Machine opens (Apple MPP and bot prefetches) are excluded. Note that only the SendGrid integration flags them, so on other providers positive open conditions may still be over-inclusive.
definition.rules object or null
Conditions on contact fields, grouped, plus exclusions. ANDed with the other definition keys. Built-in fields are `email`, `first_name`, `last_name`, `company`, `city`, `country`, `location`, `date_added`, `tags` and `engagement`; a custom contact field is `custom.<key>`, typed by its definition (see `GET /segments/fields`). Text comparisons ignore case and surrounding spaces. `is_not`, `not_contains` and `neq` also match contacts with no value. A value that does not fit the field's type (text in a number field, a date not written YYYY-MM-DD) is never matched by a comparison. An excluded segment is resolved as it is defined when the audience is resolved, and a segment that others exclude cannot be deleted.

Response

data object
data.id integer
data.name string
data.definition object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/segments \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Engaged in Copenhagen","definition":{"tag_ids":[3],"date_from":"2026-01-01","date_to":null,"search":null,"company":null,"location":"Copenhagen","engagement":{"type":"opened","days":90},"rules":{"version":1,"match":"all","timezone":"Europe/Copenhagen","groups":[{"match":"all","conditions":[{"field":"custom.plan","operator":"is","value":"trial"},{"field":"custom.signup_date","operator":"in_last_days","value":14}]},{"match":"any","conditions":[{"field":"country","operator":"is","value":"Denmark"},{"field":"custom.seats","operator":"gte","value":10}]}],"exclude":{"segment_ids":[5],"tag_ids":[7]}}}}'

Request body

{
    "name": "Engaged in Copenhagen",
    "definition": {
        "tag_ids": [
            3
        ],
        "date_from": "2026-01-01",
        "date_to": null,
        "search": null,
        "company": null,
        "location": "Copenhagen",
        "engagement": {
            "type": "opened",
            "days": 90
        },
        "rules": {
            "version": 1,
            "match": "all",
            "timezone": "Europe/Copenhagen",
            "groups": [
                {
                    "match": "all",
                    "conditions": [
                        {
                            "field": "custom.plan",
                            "operator": "is",
                            "value": "trial"
                        },
                        {
                            "field": "custom.signup_date",
                            "operator": "in_last_days",
                            "value": 14
                        }
                    ]
                },
                {
                    "match": "any",
                    "conditions": [
                        {
                            "field": "country",
                            "operator": "is",
                            "value": "Denmark"
                        },
                        {
                            "field": "custom.seats",
                            "operator": "gte",
                            "value": 10
                        }
                    ]
                }
            ],
            "exclude": {
                "segment_ids": [
                    5
                ],
                "tag_ids": [
                    7
                ]
            }
        }
    }
}

Response 201

{
    "data": {
        "id": 5,
        "name": "Engaged in Copenhagen",
        "definition": {
            "tag_ids": [
                3
            ],
            "date_from": "2026-01-01",
            "date_to": null,
            "search": null,
            "company": null,
            "location": "Copenhagen",
            "engagement": {
                "type": "opened",
                "days": 90
            },
            "rules": {
                "version": 1,
                "match": "all",
                "timezone": "Europe/Copenhagen",
                "groups": [
                    {
                        "match": "all",
                        "conditions": [
                            {
                                "field": "custom.plan",
                                "operator": "is",
                                "value": "trial"
                            },
                            {
                                "field": "custom.signup_date",
                                "operator": "in_last_days",
                                "value": 14
                            }
                        ]
                    },
                    {
                        "match": "any",
                        "conditions": [
                            {
                                "field": "country",
                                "operator": "is",
                                "value": "Denmark"
                            },
                            {
                                "field": "custom.seats",
                                "operator": "gte",
                                "value": 10
                            }
                        ]
                    }
                ],
                "exclude": {
                    "segment_ids": [
                        5
                    ],
                    "tag_ids": [
                        7
                    ]
                }
            }
        }
    }
}
GET /segments/fields

Requires scope contacts:read

The fields a rule-tree condition can use: the built-in fields plus your team's custom contact fields, each with its type and the operators that type accepts. Define a custom field with `POST /contact-fields` before a rule uses it. Tag ids in a tags condition or an exclusion must be your team's; another id is a 422 naming it.

Response

data array of object
data.field string
data.label string
data.type string
text number date boolean tags engagement
data.custom boolean
data.operators array of string

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/segments/fields \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "field": "custom.plan",
            "label": "Plan",
            "type": "text",
            "custom": true,
            "operators": [
                "is",
                "is_not",
                "contains",
                "not_contains",
                "is_empty",
                "is_not_empty"
            ]
        }
    ]
}
POST /segments/preview

Requires scope contacts:read

Read-only. Returns the resolved contact count plus a 10-record sample, so a definition can be iterated on before it is committed. The filters go inside `definition`: a request without it, or with any other top-level field (such as `rules` on its own), is a 422 rather than a preview of every contact. `{"definition": {}}` previews every contact on purpose.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

definition object Required
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.
definition.tag_ids array of integer
Contacts carrying any of these tags.
definition.date_from string or null
Subscribed on or after this date.
definition.date_to string or null
Subscribed on or before this date.
definition.search string or null
Matches email, first name, or last name.
definition.company string or null
Matches the contact metadata `company` field.
definition.location string or null
Matches metadata city, country, or location.
definition.engagement object or null
Restrict to contacts by email engagement over a trailing window. Machine opens (Apple MPP and bot prefetches) are excluded. Note that only the SendGrid integration flags them, so on other providers positive open conditions may still be over-inclusive.
definition.rules object or null
Conditions on contact fields, grouped, plus exclusions. ANDed with the other definition keys. Built-in fields are `email`, `first_name`, `last_name`, `company`, `city`, `country`, `location`, `date_added`, `tags` and `engagement`; a custom contact field is `custom.<key>`, typed by its definition (see `GET /segments/fields`). Text comparisons ignore case and surrounding spaces. `is_not`, `not_contains` and `neq` also match contacts with no value. A value that does not fit the field's type (text in a number field, a date not written YYYY-MM-DD) is never matched by a comparison. An excluded segment is resolved as it is defined when the audience is resolved, and a segment that others exclude cannot be deleted.

Response

data object
data.count integer
Active contacts the definition resolves to.
data.filters object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.
data.sample array of object

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/segments/preview \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"definition":{"tag_ids":[3],"date_from":"2026-01-01","date_to":null,"search":null,"company":null,"location":"Copenhagen","engagement":{"type":"opened","days":90},"rules":{"version":1,"match":"all","timezone":"Europe/Copenhagen","groups":[{"match":"all","conditions":[{"field":"custom.plan","operator":"is","value":"trial"},{"field":"custom.signup_date","operator":"in_last_days","value":14}]},{"match":"any","conditions":[{"field":"country","operator":"is","value":"Denmark"},{"field":"custom.seats","operator":"gte","value":10}]}],"exclude":{"segment_ids":[5],"tag_ids":[7]}}}}'

Request body

{
    "definition": {
        "tag_ids": [
            3
        ],
        "date_from": "2026-01-01",
        "date_to": null,
        "search": null,
        "company": null,
        "location": "Copenhagen",
        "engagement": {
            "type": "opened",
            "days": 90
        },
        "rules": {
            "version": 1,
            "match": "all",
            "timezone": "Europe/Copenhagen",
            "groups": [
                {
                    "match": "all",
                    "conditions": [
                        {
                            "field": "custom.plan",
                            "operator": "is",
                            "value": "trial"
                        },
                        {
                            "field": "custom.signup_date",
                            "operator": "in_last_days",
                            "value": 14
                        }
                    ]
                },
                {
                    "match": "any",
                    "conditions": [
                        {
                            "field": "country",
                            "operator": "is",
                            "value": "Denmark"
                        },
                        {
                            "field": "custom.seats",
                            "operator": "gte",
                            "value": 10
                        }
                    ]
                }
            ],
            "exclude": {
                "segment_ids": [
                    5
                ],
                "tag_ids": [
                    7
                ]
            }
        }
    }
}

Response 200

{
    "data": {
        "count": 312,
        "filters": {
            "tag_ids": [
                3
            ],
            "date_from": "2026-01-01",
            "date_to": null,
            "search": null,
            "company": null,
            "location": "Copenhagen",
            "engagement": {
                "type": "opened",
                "days": 90
            },
            "rules": {
                "version": 1,
                "match": "all",
                "timezone": "Europe/Copenhagen",
                "groups": [
                    {
                        "match": "all",
                        "conditions": [
                            {
                                "field": "custom.plan",
                                "operator": "is",
                                "value": "trial"
                            },
                            {
                                "field": "custom.signup_date",
                                "operator": "in_last_days",
                                "value": 14
                            }
                        ]
                    },
                    {
                        "match": "any",
                        "conditions": [
                            {
                                "field": "country",
                                "operator": "is",
                                "value": "Denmark"
                            },
                            {
                                "field": "custom.seats",
                                "operator": "gte",
                                "value": 10
                            }
                        ]
                    }
                ],
                "exclude": {
                    "segment_ids": [
                        5
                    ],
                    "tag_ids": [
                        7
                    ]
                }
            }
        },
        "sample": [
            {
                "id": 42,
                "email": "jane@example.com",
                "first_name": "Jane",
                "last_name": "Okonkwo",
                "status": "active",
                "metadata": {
                    "company": "Acme",
                    "city": "Copenhagen"
                },
                "subscribed_at": "2026-08-01T09:15:00+00:00",
                "unsubscribed_at": null,
                "confirmed_at": null,
                "consent_source": "signup_form",
                "consent_attested_at": "2026-08-01T09:15:00+00:00",
                "soft_bounce_count": 0,
                "created_at": "2026-08-01T09:15:00+00:00",
                "updated_at": "2026-08-09T14:02:00+00:00"
            }
        ]
    }
}
GET /segments/{segment}

Requires scope contacts:read

Path parameters

segment integer Required
Segment id.

Response

data object
data.id integer
data.name string
data.definition object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/segments/:segment \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 5,
        "name": "Engaged in Copenhagen",
        "definition": {
            "tag_ids": [
                3
            ],
            "date_from": "2026-01-01",
            "date_to": null,
            "search": null,
            "company": null,
            "location": "Copenhagen",
            "engagement": {
                "type": "opened",
                "days": 90
            },
            "rules": {
                "version": 1,
                "match": "all",
                "timezone": "Europe/Copenhagen",
                "groups": [
                    {
                        "match": "all",
                        "conditions": [
                            {
                                "field": "custom.plan",
                                "operator": "is",
                                "value": "trial"
                            },
                            {
                                "field": "custom.signup_date",
                                "operator": "in_last_days",
                                "value": 14
                            }
                        ]
                    },
                    {
                        "match": "any",
                        "conditions": [
                            {
                                "field": "country",
                                "operator": "is",
                                "value": "Denmark"
                            },
                            {
                                "field": "custom.seats",
                                "operator": "gte",
                                "value": 10
                            }
                        ]
                    }
                ],
                "exclude": {
                    "segment_ids": [
                        5
                    ],
                    "tag_ids": [
                        7
                    ]
                }
            }
        }
    }
}
PATCH /segments/{segment}

Requires scope contacts:write

Takes `name` and `definition`; any other top-level field is a 422 naming it.

Path parameters

segment integer Required
Segment id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
definition object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.
definition.tag_ids array of integer
Contacts carrying any of these tags.
definition.date_from string or null
Subscribed on or after this date.
definition.date_to string or null
Subscribed on or before this date.
definition.search string or null
Matches email, first name, or last name.
definition.company string or null
Matches the contact metadata `company` field.
definition.location string or null
Matches metadata city, country, or location.
definition.engagement object or null
Restrict to contacts by email engagement over a trailing window. Machine opens (Apple MPP and bot prefetches) are excluded. Note that only the SendGrid integration flags them, so on other providers positive open conditions may still be over-inclusive.
definition.rules object or null
Conditions on contact fields, grouped, plus exclusions. ANDed with the other definition keys. Built-in fields are `email`, `first_name`, `last_name`, `company`, `city`, `country`, `location`, `date_added`, `tags` and `engagement`; a custom contact field is `custom.<key>`, typed by its definition (see `GET /segments/fields`). Text comparisons ignore case and surrounding spaces. `is_not`, `not_contains` and `neq` also match contacts with no value. A value that does not fit the field's type (text in a number field, a date not written YYYY-MM-DD) is never matched by a comparison. An excluded segment is resolved as it is defined when the audience is resolved, and a segment that others exclude cannot be deleted.

Response

data object
data.id integer
data.name string
data.definition object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/segments/:segment \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Engaged in Copenhagen","definition":{"tag_ids":[3],"date_from":"2026-01-01","date_to":null,"search":null,"company":null,"location":"Copenhagen","engagement":{"type":"opened","days":90},"rules":{"version":1,"match":"all","timezone":"Europe/Copenhagen","groups":[{"match":"all","conditions":[{"field":"custom.plan","operator":"is","value":"trial"},{"field":"custom.signup_date","operator":"in_last_days","value":14}]},{"match":"any","conditions":[{"field":"country","operator":"is","value":"Denmark"},{"field":"custom.seats","operator":"gte","value":10}]}],"exclude":{"segment_ids":[5],"tag_ids":[7]}}}}'

Request body

{
    "name": "Engaged in Copenhagen",
    "definition": {
        "tag_ids": [
            3
        ],
        "date_from": "2026-01-01",
        "date_to": null,
        "search": null,
        "company": null,
        "location": "Copenhagen",
        "engagement": {
            "type": "opened",
            "days": 90
        },
        "rules": {
            "version": 1,
            "match": "all",
            "timezone": "Europe/Copenhagen",
            "groups": [
                {
                    "match": "all",
                    "conditions": [
                        {
                            "field": "custom.plan",
                            "operator": "is",
                            "value": "trial"
                        },
                        {
                            "field": "custom.signup_date",
                            "operator": "in_last_days",
                            "value": 14
                        }
                    ]
                },
                {
                    "match": "any",
                    "conditions": [
                        {
                            "field": "country",
                            "operator": "is",
                            "value": "Denmark"
                        },
                        {
                            "field": "custom.seats",
                            "operator": "gte",
                            "value": 10
                        }
                    ]
                }
            ],
            "exclude": {
                "segment_ids": [
                    5
                ],
                "tag_ids": [
                    7
                ]
            }
        }
    }
}

Response 200

{
    "data": {
        "id": 5,
        "name": "Engaged in Copenhagen",
        "definition": {
            "tag_ids": [
                3
            ],
            "date_from": "2026-01-01",
            "date_to": null,
            "search": null,
            "company": null,
            "location": "Copenhagen",
            "engagement": {
                "type": "opened",
                "days": 90
            },
            "rules": {
                "version": 1,
                "match": "all",
                "timezone": "Europe/Copenhagen",
                "groups": [
                    {
                        "match": "all",
                        "conditions": [
                            {
                                "field": "custom.plan",
                                "operator": "is",
                                "value": "trial"
                            },
                            {
                                "field": "custom.signup_date",
                                "operator": "in_last_days",
                                "value": 14
                            }
                        ]
                    },
                    {
                        "match": "any",
                        "conditions": [
                            {
                                "field": "country",
                                "operator": "is",
                                "value": "Denmark"
                            },
                            {
                                "field": "custom.seats",
                                "operator": "gte",
                                "value": 10
                            }
                        ]
                    }
                ],
                "exclude": {
                    "segment_ids": [
                        5
                    ],
                    "tag_ids": [
                        7
                    ]
                }
            }
        }
    }
}
DELETE /segments/{segment}

Requires scope contacts:write

Path parameters

segment integer Required
Segment id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.deleted boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/segments/:segment \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "deleted": true
    }
}
POST /segments/{segment}/preview

Requires scope contacts:read

Read-only: resolved count plus a sample.

Path parameters

segment integer Required
Segment id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.count integer
Active contacts the definition resolves to.
data.filters object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.
data.sample array of object

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/segments/:segment/preview \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "count": 312,
        "filters": {
            "tag_ids": [
                3
            ],
            "date_from": "2026-01-01",
            "date_to": null,
            "search": null,
            "company": null,
            "location": "Copenhagen",
            "engagement": {
                "type": "opened",
                "days": 90
            },
            "rules": {
                "version": 1,
                "match": "all",
                "timezone": "Europe/Copenhagen",
                "groups": [
                    {
                        "match": "all",
                        "conditions": [
                            {
                                "field": "custom.plan",
                                "operator": "is",
                                "value": "trial"
                            },
                            {
                                "field": "custom.signup_date",
                                "operator": "in_last_days",
                                "value": 14
                            }
                        ]
                    },
                    {
                        "match": "any",
                        "conditions": [
                            {
                                "field": "country",
                                "operator": "is",
                                "value": "Denmark"
                            },
                            {
                                "field": "custom.seats",
                                "operator": "gte",
                                "value": 10
                            }
                        ]
                    }
                ],
                "exclude": {
                    "segment_ids": [
                        5
                    ],
                    "tag_ids": [
                        7
                    ]
                }
            }
        },
        "sample": [
            {
                "id": 42,
                "email": "jane@example.com",
                "first_name": "Jane",
                "last_name": "Okonkwo",
                "status": "active",
                "metadata": {
                    "company": "Acme",
                    "city": "Copenhagen"
                },
                "subscribed_at": "2026-08-01T09:15:00+00:00",
                "unsubscribed_at": null,
                "confirmed_at": null,
                "consent_source": "signup_form",
                "consent_attested_at": "2026-08-01T09:15:00+00:00",
                "soft_bounce_count": 0,
                "created_at": "2026-08-01T09:15:00+00:00",
                "updated_at": "2026-08-09T14:02:00+00:00"
            }
        ]
    }
}

Campaigns

Campaign authoring and sending

GET /campaigns

Requires scope campaigns:read

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.
status string
Filter by campaign status.

Response

data array of object
data.id integer
data.name string
data.subject string or null
data.preheader string or null
data.from_name string or null
data.from_email string or null
data.reply_to string or null
data.status string
draft scheduled screening held queuing sending paused sent partial cancelled failed
data.audience object
data.template_id integer or null
data.ab_test object
`winner_metric` is `opens` or `clicks`, the same values the create and update endpoints accept. `type` is `subject`, `content`, `both` or `send_time`; `send_time_mode` (`winner` or `report`), `timezone` and `remainder_send_at` are only set for a send-time test.
data.total_recipients integer
data.sent_count integer
data.failed_count integer
data.failure_reason string or null
data.scheduled_at string or null
data.sent_at string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/campaigns \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 118,
            "name": "August product update",
            "subject": "What's new this month",
            "preheader": "Three things we shipped",
            "from_name": "Jane at Acme",
            "from_email": "hello@acme.com",
            "reply_to": "support@acme.com",
            "status": "sent",
            "audience": {
                "source": "list",
                "contact_list_id": 1,
                "filters": null
            },
            "template_id": 12,
            "ab_test": {
                "enabled": false,
                "percentage": 20,
                "winner_metric": "opens",
                "delay_minutes": 240,
                "winner_variant_id": null,
                "type": "subject",
                "send_time_mode": null,
                "timezone": null,
                "remainder_send_at": null
            },
            "total_recipients": 12480,
            "sent_count": 12463,
            "failed_count": 17,
            "failure_reason": null,
            "scheduled_at": null,
            "sent_at": "2026-08-09T10:00:00+00:00"
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /campaigns

Requires scope campaigns:write

Created as a draft; only `name` is required. A draft without a subject is stored with an empty one, and sending is refused until it has one. Set the body separately via the content endpoint.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
subject string or null
Optional on a draft. Omitted or `null`, it is stored as an empty subject, and a send is refused until one is set.
preheader string or null
from_name string or null
from_email string
Sent as-is from a fully verified sending domain. On tweak.email without one, the message goes out from your team address on the shared sender domain with this address as Reply-To. Third-party providers require a verified domain.
reply_to string
audience_source string
list bigquery
contact_list_id integer or null
segment_id integer or null
Copies the segment's filter definition onto the campaign. Takes precedence over `audience_filters`.
audience_filters object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.
audience_filters.tag_ids array of integer
Contacts carrying any of these tags.
audience_filters.date_from string or null
Subscribed on or after this date.
audience_filters.date_to string or null
Subscribed on or before this date.
audience_filters.search string or null
Matches email, first name, or last name.
audience_filters.company string or null
Matches the contact metadata `company` field.
audience_filters.location string or null
Matches metadata city, country, or location.
audience_filters.engagement object or null
Restrict to contacts by email engagement over a trailing window. Machine opens (Apple MPP and bot prefetches) are excluded. Note that only the SendGrid integration flags them, so on other providers positive open conditions may still be over-inclusive.
audience_filters.rules object or null
Conditions on contact fields, grouped, plus exclusions. ANDed with the other definition keys. Built-in fields are `email`, `first_name`, `last_name`, `company`, `city`, `country`, `location`, `date_added`, `tags` and `engagement`; a custom contact field is `custom.<key>`, typed by its definition (see `GET /segments/fields`). Text comparisons ignore case and surrounding spaces. `is_not`, `not_contains` and `neq` also match contacts with no value. A value that does not fit the field's type (text in a number field, a date not written YYYY-MM-DD) is never matched by a comparison. An excluded segment is resolved as it is defined when the audience is resolved, and a segment that others exclude cannot be deleted.
template_id integer or null
Seeds the body from this template when the campaign has none yet.
ab_test_enabled boolean
ab_test_percentage integer
ab_winner_metric string
`opens` or `clicks`. The singular forms are accepted too; responses always use the plural.
opens clicks open click
ab_test_delay_minutes integer

Response

data object
data.id integer
data.name string
data.subject string or null
data.preheader string or null
data.from_name string or null
data.from_email string or null
data.reply_to string or null
data.status string
draft scheduled screening held queuing sending paused sent partial cancelled failed
data.audience object
data.template_id integer or null
data.ab_test object
`winner_metric` is `opens` or `clicks`, the same values the create and update endpoints accept. `type` is `subject`, `content`, `both` or `send_time`; `send_time_mode` (`winner` or `report`), `timezone` and `remainder_send_at` are only set for a send-time test.
data.total_recipients integer
data.sent_count integer
data.failed_count integer
data.failure_reason string or null
data.scheduled_at string or null
data.sent_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/campaigns \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"August product update","subject":"What's new this month","preheader":"Three things we shipped","from_name":"Jane at Acme","from_email":"hello@acme.com","reply_to":"support@acme.com","audience_source":"list","contact_list_id":7,"segment_id":5}'

Request body

{
    "name": "August product update",
    "subject": "What's new this month",
    "preheader": "Three things we shipped",
    "from_name": "Jane at Acme",
    "from_email": "hello@acme.com",
    "reply_to": "support@acme.com",
    "audience_source": "list",
    "contact_list_id": 7,
    "segment_id": 5
}

Response 201

{
    "data": {
        "id": 118,
        "name": "August product update",
        "subject": "What's new this month",
        "preheader": "Three things we shipped",
        "from_name": "Jane at Acme",
        "from_email": "hello@acme.com",
        "reply_to": "support@acme.com",
        "status": "sent",
        "audience": {
            "source": "list",
            "contact_list_id": 1,
            "filters": null
        },
        "template_id": 12,
        "ab_test": {
            "enabled": false,
            "percentage": 20,
            "winner_metric": "opens",
            "delay_minutes": 240,
            "winner_variant_id": null,
            "type": "subject",
            "send_time_mode": null,
            "timezone": null,
            "remainder_send_at": null
        },
        "total_recipients": 12480,
        "sent_count": 12463,
        "failed_count": 17,
        "failure_reason": null,
        "scheduled_at": null,
        "sent_at": "2026-08-09T10:00:00+00:00"
    }
}
GET /campaigns/{campaign}

Requires scope campaigns:read

Path parameters

campaign integer Required
Campaign id.

Response

data object
data.id integer
data.name string
data.subject string or null
data.preheader string or null
data.from_name string or null
data.from_email string or null
data.reply_to string or null
data.status string
draft scheduled screening held queuing sending paused sent partial cancelled failed
data.audience object
data.template_id integer or null
data.ab_test object
`winner_metric` is `opens` or `clicks`, the same values the create and update endpoints accept. `type` is `subject`, `content`, `both` or `send_time`; `send_time_mode` (`winner` or `report`), `timezone` and `remainder_send_at` are only set for a send-time test.
data.total_recipients integer
data.sent_count integer
data.failed_count integer
data.failure_reason string or null
data.scheduled_at string or null
data.sent_at string or null

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/campaigns/:campaign \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 118,
        "name": "August product update",
        "subject": "What's new this month",
        "preheader": "Three things we shipped",
        "from_name": "Jane at Acme",
        "from_email": "hello@acme.com",
        "reply_to": "support@acme.com",
        "status": "sent",
        "audience": {
            "source": "list",
            "contact_list_id": 1,
            "filters": null
        },
        "template_id": 12,
        "ab_test": {
            "enabled": false,
            "percentage": 20,
            "winner_metric": "opens",
            "delay_minutes": 240,
            "winner_variant_id": null,
            "type": "subject",
            "send_time_mode": null,
            "timezone": null,
            "remainder_send_at": null
        },
        "total_recipients": 12480,
        "sent_count": 12463,
        "failed_count": 17,
        "failure_reason": null,
        "scheduled_at": null,
        "sent_at": "2026-08-09T10:00:00+00:00"
    }
}
PATCH /campaigns/{campaign}

Requires scope campaigns:write

Refused with 422 once the campaign is screening, sending, or sent.

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
subject string or null
Optional on a draft. Omitted or `null`, it is stored as an empty subject, and a send is refused until one is set.
preheader string or null
from_name string or null
from_email string
Sent as-is from a fully verified sending domain. On tweak.email without one, the message goes out from your team address on the shared sender domain with this address as Reply-To. Third-party providers require a verified domain.
reply_to string
audience_source string
list bigquery
contact_list_id integer or null
segment_id integer or null
Copies the segment's filter definition onto the campaign. Takes precedence over `audience_filters`.
audience_filters object
Every key is optional and the keys combine with AND; an empty definition matches every active contact. A key not listed here is refused with 422 naming it, so a misspelt rule cannot silently widen the audience. Conditions on custom fields, AND / OR groups and exclusions go in `rules`.
audience_filters.tag_ids array of integer
Contacts carrying any of these tags.
audience_filters.date_from string or null
Subscribed on or after this date.
audience_filters.date_to string or null
Subscribed on or before this date.
audience_filters.search string or null
Matches email, first name, or last name.
audience_filters.company string or null
Matches the contact metadata `company` field.
audience_filters.location string or null
Matches metadata city, country, or location.
audience_filters.engagement object or null
Restrict to contacts by email engagement over a trailing window. Machine opens (Apple MPP and bot prefetches) are excluded. Note that only the SendGrid integration flags them, so on other providers positive open conditions may still be over-inclusive.
audience_filters.rules object or null
Conditions on contact fields, grouped, plus exclusions. ANDed with the other definition keys. Built-in fields are `email`, `first_name`, `last_name`, `company`, `city`, `country`, `location`, `date_added`, `tags` and `engagement`; a custom contact field is `custom.<key>`, typed by its definition (see `GET /segments/fields`). Text comparisons ignore case and surrounding spaces. `is_not`, `not_contains` and `neq` also match contacts with no value. A value that does not fit the field's type (text in a number field, a date not written YYYY-MM-DD) is never matched by a comparison. An excluded segment is resolved as it is defined when the audience is resolved, and a segment that others exclude cannot be deleted.
template_id integer or null
Seeds the body from this template when the campaign has none yet.
ab_test_enabled boolean
ab_test_percentage integer
ab_winner_metric string
`opens` or `clicks`. The singular forms are accepted too; responses always use the plural.
opens clicks open click
ab_test_delay_minutes integer

Response

data object
data.id integer
data.name string
data.subject string or null
data.preheader string or null
data.from_name string or null
data.from_email string or null
data.reply_to string or null
data.status string
draft scheduled screening held queuing sending paused sent partial cancelled failed
data.audience object
data.template_id integer or null
data.ab_test object
`winner_metric` is `opens` or `clicks`, the same values the create and update endpoints accept. `type` is `subject`, `content`, `both` or `send_time`; `send_time_mode` (`winner` or `report`), `timezone` and `remainder_send_at` are only set for a send-time test.
data.total_recipients integer
data.sent_count integer
data.failed_count integer
data.failure_reason string or null
data.scheduled_at string or null
data.sent_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/campaigns/:campaign \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"August product update","subject":"What's new this month","preheader":"Three things we shipped","from_name":"Jane at Acme","from_email":"hello@acme.com","reply_to":"support@acme.com","audience_source":"list","contact_list_id":7,"segment_id":5}'

Request body

{
    "name": "August product update",
    "subject": "What's new this month",
    "preheader": "Three things we shipped",
    "from_name": "Jane at Acme",
    "from_email": "hello@acme.com",
    "reply_to": "support@acme.com",
    "audience_source": "list",
    "contact_list_id": 7,
    "segment_id": 5
}

Response 200

{
    "data": {
        "id": 118,
        "name": "August product update",
        "subject": "What's new this month",
        "preheader": "Three things we shipped",
        "from_name": "Jane at Acme",
        "from_email": "hello@acme.com",
        "reply_to": "support@acme.com",
        "status": "sent",
        "audience": {
            "source": "list",
            "contact_list_id": 1,
            "filters": null
        },
        "template_id": 12,
        "ab_test": {
            "enabled": false,
            "percentage": 20,
            "winner_metric": "opens",
            "delay_minutes": 240,
            "winner_variant_id": null,
            "type": "subject",
            "send_time_mode": null,
            "timezone": null,
            "remainder_send_at": null
        },
        "total_recipients": 12480,
        "sent_count": 12463,
        "failed_count": 17,
        "failure_reason": null,
        "scheduled_at": null,
        "sent_at": "2026-08-09T10:00:00+00:00"
    }
}
DELETE /campaigns/{campaign}

Requires scope campaigns:write

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.deleted boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/campaigns/:campaign \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "deleted": true
    }
}
PUT /campaigns/{campaign}/content

Requires scope campaigns:write

Supplying `template_id` copies that template's body in, so a later edit to the template cannot change a campaign somebody already reviewed.

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

html_content string or null
plain_content string or null
Derived from the HTML at send time when omitted.
blocks_json array or null
The visual editor's block document, if you build content with it.
template_id integer or null
Copies this template's body in.

Response

data object
data.id integer
data.name string
data.subject string or null
data.preheader string or null
data.from_name string or null
data.from_email string or null
data.reply_to string or null
data.status string
draft scheduled screening held queuing sending paused sent partial cancelled failed
data.audience object
data.template_id integer or null
data.ab_test object
`winner_metric` is `opens` or `clicks`, the same values the create and update endpoints accept. `type` is `subject`, `content`, `both` or `send_time`; `send_time_mode` (`winner` or `report`), `timezone` and `remainder_send_at` are only set for a send-time test.
data.total_recipients integer
data.sent_count integer
data.failed_count integer
data.failure_reason string or null
data.scheduled_at string or null
data.sent_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PUT https://tweak.email/api/v1/campaigns/:campaign/content \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html_content":"<p>Hi {{first_name|there}}, here is what we shipped this month.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>","plain_content":null,"blocks_json":null,"template_id":null}'

Request body

{
    "html_content": "<p>Hi {{first_name|there}}, here is what we shipped this month.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
    "plain_content": null,
    "blocks_json": null,
    "template_id": null
}

Response 200

{
    "data": {
        "id": 118,
        "name": "August product update",
        "subject": "What's new this month",
        "preheader": "Three things we shipped",
        "from_name": "Jane at Acme",
        "from_email": "hello@acme.com",
        "reply_to": "support@acme.com",
        "status": "sent",
        "audience": {
            "source": "list",
            "contact_list_id": 1,
            "filters": null
        },
        "template_id": 12,
        "ab_test": {
            "enabled": false,
            "percentage": 20,
            "winner_metric": "opens",
            "delay_minutes": 240,
            "winner_variant_id": null,
            "type": "subject",
            "send_time_mode": null,
            "timezone": null,
            "remainder_send_at": null
        },
        "total_recipients": 12480,
        "sent_count": 12463,
        "failed_count": 17,
        "failure_reason": null,
        "scheduled_at": null,
        "sent_at": "2026-08-09T10:00:00+00:00"
    }
}
POST /campaigns/{campaign}/variants

Requires scope campaigns:write

Variants are replaced wholesale, and A/B testing is switched on. Without `type` this sets up a subject-line test, as it always has. `type: content` or `both` gives each variant its own `html_content` (a variant without one sends the campaign's content); `type: send_time` gives each of two or three groups a `send_at`. A send-time test is started with the send endpoint, which schedules it for its first group's time; the schedule endpoint refuses it.

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

type string
What the variants differ in. Defaults to `subject`, which needs a `subject` on every variant.
subject content both send_time
send_time_mode string
Send-time tests only. `winner` (default): the groups are a sample, and the rest of the audience gets the winning time on the next sending day. `report`: the whole audience is split across the groups, and nothing else is sent.
winner report
timezone string
Send-time tests only. The timezone the rest of the audience's send time is kept in (the winning group's local time). Defaults to UTC.
variants array of object Required
Two to four variants; a send-time test takes two or three groups.
variants.label string Required
variants.subject string
Required for `subject` and `both` tests. Ignored for a send-time test, which sends the campaign's subject.
variants.from_name string
variants.preheader string or null
Content and `both` tests: this variant's preview text.
variants.html_content string or null
Content and `both` tests: the HTML this variant sends. Without it the variant sends the campaign's content. It is held to the same send checks and screening as the campaign's.
variants.plain_content string or null
Derived from this variant's HTML at send time when omitted.
variants.blocks_json array or null
The visual editor's block document for this variant, stored with `html_content`.
variants.send_at string
Send-time tests: when this group goes out. Must be in the future, at least 15 minutes from the other groups, and within 7 days of the first; otherwise the request is a 422 and nothing is saved.

Response

data array of object
data.id integer
data.label string
data.subject string
data.from_name string or null
data.preheader string or null
data.has_own_content boolean
True when the variant sends a design of its own (content and `both` tests).
data.send_at string or null
A send-time group's time.
data.is_winner boolean
data.sent integer
data.opened integer
data.clicked integer
data.open_rate number
data.click_rate number
data.campaign_id integer
Not on `/report/variants`, which is per campaign already.
data.sent_count integer
Deprecated: use `sent`. The count stored when the winner was picked, 0 before. Not on `/report/variants`.
data.open_count integer
Deprecated: use `opened`. Stored when the winner was picked, 0 before. Not on `/report/variants`.
data.click_count integer
Deprecated: use `clicked`. Stored when the winner was picked, 0 before. Not on `/report/variants`.
summary object or null
Report endpoint only. `verdict` is `clear`, `too_close`, `too_small` (a compared variant has fewer than 100 recipients) or `no_data`; `note` says the same in a sentence; `decision` is what was recorded when the winner was picked.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/campaigns/:campaign/variants \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"subject","send_time_mode":"winner","timezone":"Europe/Copenhagen","variants":[{"label":"A","subject":"Three things we shipped in August","from_name":"Jane at Acme"},{"label":"B","subject":"Your August update from Acme","from_name":"Acme"}]}'

Request body

{
    "type": "subject",
    "send_time_mode": "winner",
    "timezone": "Europe/Copenhagen",
    "variants": [
        {
            "label": "A",
            "subject": "Three things we shipped in August",
            "from_name": "Jane at Acme"
        },
        {
            "label": "B",
            "subject": "Your August update from Acme",
            "from_name": "Acme"
        }
    ]
}

Response 200

{
    "data": [
        {
            "id": 31,
            "label": "A",
            "subject": "Three things we shipped in August",
            "from_name": "Jane at Acme",
            "preheader": null,
            "has_own_content": false,
            "send_at": null,
            "is_winner": true,
            "sent": 1248,
            "opened": 512,
            "clicked": 97,
            "open_rate": 41,
            "click_rate": 7.8,
            "campaign_id": 118,
            "sent_count": 1248,
            "open_count": 512,
            "click_count": 97
        }
    ],
    "summary": {
        "type": "subject",
        "metric": "open",
        "verdict": "too_close",
        "significant": false,
        "z": 1.12,
        "leader": "B",
        "note": "Too close to call: Variant B is ahead on open rate, but the difference from Variant A could be chance.",
        "decision": null
    }
}
POST /campaigns/{campaign}/preflight

Requires scope campaigns:read

Read-only. Returns every reason a send would currently be refused, plus the estimated recipient count.

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.campaign_id integer
data.status string
data.launchable boolean
data.blockers array of string
data.estimated_recipients integer or null
Null for a BigQuery audience, which is resolved at send time.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/campaigns/:campaign/preflight \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "campaign_id": 118,
        "status": "draft",
        "launchable": false,
        "blockers": [
            "The subject line is empty."
        ],
        "estimated_recipients": 12480
    }
}
POST /campaigns/{campaign}/send

Requires scope campaigns:send

Hands the campaign to abuse screening, which releases it to the send pipeline. Returns 422 with a `blockers` array if any send gate fails.

Send an `Idempotency-Key` header: a retried send is the one mistake in this API that cannot be undone.

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.name string
data.subject string or null
data.preheader string or null
data.from_name string or null
data.from_email string or null
data.reply_to string or null
data.status string
draft scheduled screening held queuing sending paused sent partial cancelled failed
data.audience object
data.template_id integer or null
data.ab_test object
`winner_metric` is `opens` or `clicks`, the same values the create and update endpoints accept. `type` is `subject`, `content`, `both` or `send_time`; `send_time_mode` (`winner` or `report`), `timezone` and `remainder_send_at` are only set for a send-time test.
data.total_recipients integer
data.sent_count integer
data.failed_count integer
data.failure_reason string or null
data.scheduled_at string or null
data.sent_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/campaigns/:campaign/send \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 118,
        "name": "August product update",
        "subject": "What's new this month",
        "preheader": "Three things we shipped",
        "from_name": "Jane at Acme",
        "from_email": "hello@acme.com",
        "reply_to": "support@acme.com",
        "status": "sent",
        "audience": {
            "source": "list",
            "contact_list_id": 1,
            "filters": null
        },
        "template_id": 12,
        "ab_test": {
            "enabled": false,
            "percentage": 20,
            "winner_metric": "opens",
            "delay_minutes": 240,
            "winner_variant_id": null,
            "type": "subject",
            "send_time_mode": null,
            "timezone": null,
            "remainder_send_at": null
        },
        "total_recipients": 12480,
        "sent_count": 12463,
        "failed_count": 17,
        "failure_reason": null,
        "scheduled_at": null,
        "sent_at": "2026-08-09T10:00:00+00:00"
    }
}
POST /campaigns/{campaign}/schedule

Requires scope campaigns:send

Runs the same gates as an immediate send. A send-time A/B test is refused here (`send_time_test`): its groups go out at their own times, so start it with the send endpoint.

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

send_at string Required
Must be in the future. Interpreted as UTC unless an offset is given.

Response

data object
data.id integer
data.name string
data.subject string or null
data.preheader string or null
data.from_name string or null
data.from_email string or null
data.reply_to string or null
data.status string
draft scheduled screening held queuing sending paused sent partial cancelled failed
data.audience object
data.template_id integer or null
data.ab_test object
`winner_metric` is `opens` or `clicks`, the same values the create and update endpoints accept. `type` is `subject`, `content`, `both` or `send_time`; `send_time_mode` (`winner` or `report`), `timezone` and `remainder_send_at` are only set for a send-time test.
data.total_recipients integer
data.sent_count integer
data.failed_count integer
data.failure_reason string or null
data.scheduled_at string or null
data.sent_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/campaigns/:campaign/schedule \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"send_at":"2027-03-02T09:00:00+01:00"}'

Request body

{
    "send_at": "2027-03-02T09:00:00+01:00"
}

Response 200

{
    "data": {
        "id": 118,
        "name": "August product update",
        "subject": "What's new this month",
        "preheader": "Three things we shipped",
        "from_name": "Jane at Acme",
        "from_email": "hello@acme.com",
        "reply_to": "support@acme.com",
        "status": "sent",
        "audience": {
            "source": "list",
            "contact_list_id": 1,
            "filters": null
        },
        "template_id": 12,
        "ab_test": {
            "enabled": false,
            "percentage": 20,
            "winner_metric": "opens",
            "delay_minutes": 240,
            "winner_variant_id": null,
            "type": "subject",
            "send_time_mode": null,
            "timezone": null,
            "remainder_send_at": null
        },
        "total_recipients": 12480,
        "sent_count": 12463,
        "failed_count": 17,
        "failure_reason": null,
        "scheduled_at": null,
        "sent_at": "2026-08-09T10:00:00+00:00"
    }
}
POST /campaigns/{campaign}/cancel

Requires scope campaigns:send

Only a draft, scheduled, or paused campaign can be cancelled: once chunks are dispatched the messages are already gone.

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.name string
data.subject string or null
data.preheader string or null
data.from_name string or null
data.from_email string or null
data.reply_to string or null
data.status string
draft scheduled screening held queuing sending paused sent partial cancelled failed
data.audience object
data.template_id integer or null
data.ab_test object
`winner_metric` is `opens` or `clicks`, the same values the create and update endpoints accept. `type` is `subject`, `content`, `both` or `send_time`; `send_time_mode` (`winner` or `report`), `timezone` and `remainder_send_at` are only set for a send-time test.
data.total_recipients integer
data.sent_count integer
data.failed_count integer
data.failure_reason string or null
data.scheduled_at string or null
data.sent_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/campaigns/:campaign/cancel \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 118,
        "name": "August product update",
        "subject": "What's new this month",
        "preheader": "Three things we shipped",
        "from_name": "Jane at Acme",
        "from_email": "hello@acme.com",
        "reply_to": "support@acme.com",
        "status": "sent",
        "audience": {
            "source": "list",
            "contact_list_id": 1,
            "filters": null
        },
        "template_id": 12,
        "ab_test": {
            "enabled": false,
            "percentage": 20,
            "winner_metric": "opens",
            "delay_minutes": 240,
            "winner_variant_id": null,
            "type": "subject",
            "send_time_mode": null,
            "timezone": null,
            "remainder_send_at": null
        },
        "total_recipients": 12480,
        "sent_count": 12463,
        "failed_count": 17,
        "failure_reason": null,
        "scheduled_at": null,
        "sent_at": "2026-08-09T10:00:00+00:00"
    }
}
POST /campaigns/{campaign}/test

Requires scope campaigns:send

Up to 5 addresses. Counts against the plan's email allowance, because these are real sends. An address that could not be sent to is listed under `failed`.

Path parameters

campaign integer Required
Campaign id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

emails array of string Required

Response

data object
data.sent array of string
data.failed array of object

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.
503
A service this endpoint depends on is temporarily unavailable, for example while sending is paused. Nothing was done; retry later.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/campaigns/:campaign/test \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"emails":["jane@acme.com"]}'

Request body

{
    "emails": [
        "jane@acme.com"
    ]
}

Response 200

{
    "data": {
        "sent": [
            "jane@acme.com"
        ],
        "failed": []
    }
}

Reporting

Delivery events and campaign performance

GET /campaigns/{campaign}/report

Requires scope events:read

Opens exclude machine/bot opens (Apple MPP), so the rates reflect human engagement.

Path parameters

campaign integer Required
Campaign id.

Response

data object
data.campaign_id integer
data.name string
data.subject string or null
data.status string
data.sent_at string or null
data.metrics object

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/campaigns/:campaign/report \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "campaign_id": 118,
        "name": "August product update",
        "subject": "What's new this month",
        "status": "sent",
        "sent_at": "2026-08-09T10:00:00+00:00",
        "metrics": {
            "recipients": 12480,
            "sent": 12463,
            "delivered": 12301,
            "opened": 5238,
            "clicked": 1104,
            "bounced": 162,
            "unsubscribed": 38,
            "complained": 3,
            "delivery_rate": 98.7,
            "open_rate": 42.6,
            "click_rate": 9,
            "ctor": 21.1,
            "bounce_rate": 1.3,
            "unsubscribe_rate": 0.3,
            "complaint_rate": 0.02
        }
    }
}
GET /campaigns/{campaign}/report/variants

Requires scope events:read

Unique opens and clicks per variant (or send-time group), with a `summary` that names the leading variant and says whether its lead is clear: both compared variants sent to at least 100 recipients and a two-proportion z-test at 95 % confidence. Otherwise the verdict is `too_close` or `too_small`.

Path parameters

campaign integer Required
Campaign id.

Response

data array of object
data.id integer
data.label string
data.subject string
data.from_name string or null
data.preheader string or null
data.has_own_content boolean
True when the variant sends a design of its own (content and `both` tests).
data.send_at string or null
A send-time group's time.
data.is_winner boolean
data.sent integer
data.opened integer
data.clicked integer
data.open_rate number
data.click_rate number
data.campaign_id integer
Not on `/report/variants`, which is per campaign already.
data.sent_count integer
Deprecated: use `sent`. The count stored when the winner was picked, 0 before. Not on `/report/variants`.
data.open_count integer
Deprecated: use `opened`. Stored when the winner was picked, 0 before. Not on `/report/variants`.
data.click_count integer
Deprecated: use `clicked`. Stored when the winner was picked, 0 before. Not on `/report/variants`.
summary object or null
Report endpoint only. `verdict` is `clear`, `too_close`, `too_small` (a compared variant has fewer than 100 recipients) or `no_data`; `note` says the same in a sentence; `decision` is what was recorded when the winner was picked.

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/campaigns/:campaign/report/variants \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 31,
            "label": "A",
            "subject": "Three things we shipped in August",
            "from_name": "Jane at Acme",
            "preheader": null,
            "has_own_content": false,
            "send_at": null,
            "is_winner": true,
            "sent": 1248,
            "opened": 512,
            "clicked": 97,
            "open_rate": 41,
            "click_rate": 7.8,
            "campaign_id": 118,
            "sent_count": 1248,
            "open_count": 512,
            "click_count": 97
        }
    ],
    "summary": {
        "type": "subject",
        "metric": "open",
        "verdict": "too_close",
        "significant": false,
        "z": 1.12,
        "leader": "B",
        "note": "Too close to call: Variant B is ahead on open rate, but the difference from Variant A could be chance.",
        "decision": null
    }
}
GET /campaigns/{campaign}/recipients

Requires scope events:read

Who received the campaign and whether they opened or clicked.

Path parameters

campaign integer Required
Campaign id.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.
filter string
Narrow to a delivery outcome.
all opened clicked bounced pending sent

Response

data array of object
data.contact_id integer or null
data.email string or null
data.status string
data.sent_at string or null
data.opened_at string or null
data.clicked_at string or null
data.error_message string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/campaigns/:campaign/recipients \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "contact_id": 42,
            "email": "jane@example.com",
            "status": "sent",
            "sent_at": "2026-08-09 10:00:02",
            "opened_at": "2026-08-09 11:42:17",
            "clicked_at": null,
            "error_message": null
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
GET /events

Requires scope events:read

The read side of the event pipeline, bounded by a 180-day retention window. Machine opens are excluded unless explicitly requested.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.
event string
Filter by event type.
delivered bounced deferred dropped spam_report unsubscribed opened clicked queued sent
email string
Filter by recipient address.
campaign_id integer
Filter by campaign.
contact_id integer
Filter by contact.
since string
ISO 8601 lower bound.
until string
ISO 8601 upper bound.
include_machine_opens boolean
Include Apple MPP and bot prefetch opens.

Response

data array of object
data.id integer
data.email string
data.event string
data.campaign_id integer or null
data.contact_id integer or null
data.provider string or null
"tweak.email" for mail sent through the built-in sender, otherwise the provider you connected (for example "sendgrid").
data.source string or null
data.is_machine_open boolean
data.message_id string or null
The `message_id` /send returned, on the events of a transactional message; null otherwise.
data.metadata object
data.created_at string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/events \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 90211,
            "email": "jane@example.com",
            "event": "clicked",
            "campaign_id": 118,
            "contact_id": 42,
            "provider": "tweak.email",
            "source": "webhook",
            "is_machine_open": false,
            "message_id": null,
            "metadata": {
                "url": "https://acme.com/changelog"
            },
            "created_at": "2026-08-09T10:04:12+00:00"
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /events

Requires scope events:write

For mail you send outside tweak.email: report its delivery events (delivered, bounced, opened, clicked, unsubscribed and the other types listed) so they count in your reports and suppressions. Only these delivery event types are accepted; this is not a way to send custom product events. To start a sequence from your own backend, add a tag to the contact (`POST /contacts/{contact}/tags`) and use a sequence triggered by that tag.

Up to 1,000 per call. Events flow through the same pipeline as provider webhooks: campaign stats update, suppressions are created, contact statuses sync.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

events array of object Required
events.email string Required
events.event string Required
A delivery event type. Nothing else is accepted.
delivered bounced deferred dropped spam_report unsubscribed opened clicked queued sent
events.campaign_id integer or null
Ignored unless it is one of your campaigns.
events.contact_id integer or null
Ignored unless it is one of your contacts.
events.provider string
Your name for the system that sent the message.
events.source string
Defaults to `api`.
events.metadata object

Response

data object
data.processed integer
status string
Deprecated: read `data` instead. Kept for existing integrations.
processed integer
Deprecated: read `data.processed` instead.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/events \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"events":[{"email":"jane@example.com","event":"delivered","campaign_id":null,"contact_id":42,"provider":"own-smtp","source":"api","metadata":{"smtp_response":"250 2.0.0 OK"}}]}'

Request body

{
    "events": [
        {
            "email": "jane@example.com",
            "event": "delivered",
            "campaign_id": null,
            "contact_id": 42,
            "provider": "own-smtp",
            "source": "api",
            "metadata": {
                "smtp_response": "250 2.0.0 OK"
            }
        }
    ]
}

Response 200

{
    "data": {
        "processed": 2
    },
    "status": "ok",
    "processed": 2
}
POST /conversions

Requires scope events:write

A purchase, booking or sign-up an email led to. It is credited to `campaign_id` when that is one of your campaigns; otherwise to the campaign whose link the address clicked most recently within 7 days before `occurred_at`; otherwise to no campaign (`attribution: none`). Conversions appear in the campaign report in the app.

Send the same `order_id` again and nothing is counted twice: the first record is returned unchanged with a 200. A conversion without an `order_id` is recorded every time it is reported.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

email string Required
The address of the person who converted.
campaign_id integer or null
Credit this campaign. Ignored unless it is one of your campaigns; the last click then decides.
value number or null
What the conversion was worth, such as the order total.
currency string or null
Three-letter currency code of `value`. Revenue is reported per currency, never added across currencies.
order_id string or null
Your reference for the order. A conversion with the same `order_id` is recorded once.
occurred_at string or null
When it happened. Defaults to now; cannot be in the future.

Response

201
The conversion was recorded.
200
A conversion with this `order_id` was already on record; it is returned unchanged.
data object
data.id integer
data.email string
data.campaign_id integer or null
The campaign the conversion is credited to, or null.
data.contact_id integer or null
The contact with this address, when there is one.
data.value number or null
data.currency string or null
data.order_id string or null
data.source string
How the conversion was reported.
api pixel shopify
data.attribution string
`explicit`: you named the campaign. `last_click`: the campaign of the address's last click. `none`: no campaign.
explicit last_click none
data.occurred_at string or null
data.created_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/conversions \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"jane@example.com","campaign_id":12,"value":499,"currency":"DKK","order_id":"4417","occurred_at":"2026-08-09T10:04:12+00:00"}'

Request body

{
    "email": "jane@example.com",
    "campaign_id": 12,
    "value": 499,
    "currency": "DKK",
    "order_id": "4417",
    "occurred_at": "2026-08-09T10:04:12+00:00"
}

Response 201

{
    "data": {
        "id": 318,
        "email": "jane@example.com",
        "campaign_id": 12,
        "contact_id": 42,
        "value": 499,
        "currency": "DKK",
        "order_id": "4417",
        "source": "api",
        "attribution": "last_click",
        "occurred_at": "2026-08-09T10:04:12+00:00",
        "created_at": "2026-08-09T10:04:15+00:00"
    }
}

Templates

Reusable email templates

GET /templates

Requires scope campaigns:read

Includes the platform's system starter templates alongside your own.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.
scope string
Which templates to return.
all system team
category string
Filter by category.

Response

data array of object
data.id integer
data.name string
data.category string or null
data.style string or null
data.description string or null
data.is_system boolean
data.html_content string or null
Only returned when fetching a single template.
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/templates \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 12,
            "name": "Monthly newsletter",
            "category": "newsletter",
            "style": "clean",
            "description": "One column, a hero image and three stories",
            "is_system": false,
            "html_content": "<p>Hello {{first_name|there}}</p>"
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /templates

Requires scope campaigns:write

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
category string
promo newsletter welcome launch event transactional general seasonal
style string
clean modern editorial bold commerce personal dark seasonal custom
description string
html_content string
blocks_json array or null
The visual editor's block document, if you build content with it.

Response

data object
data.id integer
data.name string
data.category string or null
data.style string or null
data.description string or null
data.is_system boolean
data.html_content string or null
Only returned when fetching a single template.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/templates \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Monthly newsletter","category":"newsletter","style":"clean","description":"One column, a hero image and three stories","html_content":"<p>Hello {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>","blocks_json":null}'

Request body

{
    "name": "Monthly newsletter",
    "category": "newsletter",
    "style": "clean",
    "description": "One column, a hero image and three stories",
    "html_content": "<p>Hello {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
    "blocks_json": null
}

Response 201

{
    "data": {
        "id": 12,
        "name": "Monthly newsletter",
        "category": "newsletter",
        "style": "clean",
        "description": "One column, a hero image and three stories",
        "is_system": false,
        "html_content": "<p>Hello {{first_name|there}}</p>"
    }
}
GET /templates/{template}

Requires scope campaigns:read

Unlike the listing, this includes the full body.

Path parameters

template integer Required
Template id.

Response

data object
data.id integer
data.name string
data.category string or null
data.style string or null
data.description string or null
data.is_system boolean
data.html_content string or null
Only returned when fetching a single template.

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/templates/:template \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 12,
        "name": "Monthly newsletter",
        "category": "newsletter",
        "style": "clean",
        "description": "One column, a hero image and three stories",
        "is_system": false,
        "html_content": "<p>Hello {{first_name|there}}</p>"
    }
}
PATCH /templates/{template}

Requires scope campaigns:write

System templates cannot be modified.

Path parameters

template integer Required
Template id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
category string
promo newsletter welcome launch event transactional general seasonal
style string
clean modern editorial bold commerce personal dark seasonal custom
description string
html_content string
blocks_json array or null
The visual editor's block document, if you build content with it.

Response

data object
data.id integer
data.name string
data.category string or null
data.style string or null
data.description string or null
data.is_system boolean
data.html_content string or null
Only returned when fetching a single template.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/templates/:template \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Monthly newsletter","category":"newsletter","style":"clean","description":"One column, a hero image and three stories","html_content":"<p>Hello {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>","blocks_json":null}'

Request body

{
    "name": "Monthly newsletter",
    "category": "newsletter",
    "style": "clean",
    "description": "One column, a hero image and three stories",
    "html_content": "<p>Hello {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
    "blocks_json": null
}

Response 200

{
    "data": {
        "id": 12,
        "name": "Monthly newsletter",
        "category": "newsletter",
        "style": "clean",
        "description": "One column, a hero image and three stories",
        "is_system": false,
        "html_content": "<p>Hello {{first_name|there}}</p>"
    }
}
DELETE /templates/{template}

Requires scope campaigns:write

Path parameters

template integer Required
Template id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.deleted boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/templates/:template \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "deleted": true
    }
}

Sequences

Automated sequences and enrolment

GET /sequences

Requires scope campaigns:read

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.name string
data.description string or null
data.status string
data.trigger_type string or null
`tag_added` sequences start when the trigger tag is added to a contact, including through `POST /contacts/{contact}/tags`.
data.trigger_tag_id integer or null
data.trigger_list_ids array of integer
For the signup trigger: the lists it is limited to; empty means any list.
data.exit_conditions array of object
data.emails array of object
On a single sequence: the e-mail steps in order (id, position, subject, delay_days, delay_hours).
data.steps array of object
On a single sequence: the main path of the step tree. E-mail bodies are not included.
data.step_problems array of string
On a single sequence: what has to be fixed before it can be activated. Empty when the steps are ready.
data.subscribers_count integer
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/sequences \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 3,
            "name": "Onboarding",
            "description": "Five emails over the first two weeks",
            "status": "active",
            "trigger_type": "tag_added",
            "trigger_tag_id": 7,
            "trigger_list_ids": [],
            "exit_conditions": [
                {
                    "kind": "tag",
                    "tag_id": 9
                }
            ],
            "emails": [
                {
                    "id": 11,
                    "position": 0,
                    "subject": "Welcome aboard",
                    "delay_days": 0,
                    "delay_hours": 0
                }
            ],
            "steps": [
                {
                    "id": 11,
                    "ref": "welcome",
                    "type": "email",
                    "subject": "Welcome aboard",
                    "html_content": "<p>Hi {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
                    "plain_content": null,
                    "delay_days": 0,
                    "delay_hours": 0,
                    "wait": {
                        "mode": "until",
                        "days": 2,
                        "hours": 0,
                        "weekdays": [
                            1,
                            3
                        ],
                        "time": "09:00",
                        "timezone": "Europe/Copenhagen"
                    },
                    "condition": {
                        "kind": "tag",
                        "tag_id": 9,
                        "list_id": 4,
                        "segment_id": 5,
                        "rule": {
                            "field": "custom.orders_count",
                            "type": "number",
                            "operator": "gte",
                            "value": 1
                        },
                        "timezone": "Europe/Copenhagen",
                        "step_id": 11,
                        "step_ref": "welcome",
                        "within_hours": 72
                    },
                    "yes": [
                        {
                            "type": "exit"
                        }
                    ],
                    "no": [
                        {
                            "type": "email",
                            "subject": "In case you missed it",
                            "html_content": "<p>A quick reminder.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"
                        }
                    ]
                }
            ],
            "step_problems": [
                "Step 3: the \"no\" path is empty. Add a step to it, or an exit step to end the sequence there."
            ],
            "subscribers_count": 380
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /sequences

Requires scope campaigns:write

Creates a draft that sends nothing; it is activated in the app, after the same checks as a campaign launch. Give the steps either as `emails` (a plain list of e-mails, each with its delay since the previous step) or as `steps`, the tree: `email`, `wait`, `condition` (with a `yes` and a `no` path) and `exit` steps. A condition or exit is the last step of its path, and conditions nest at most 3 deep. A condition about an earlier e-mail names it by `step_id`, or by `step_ref`: the `ref` you gave that e-mail earlier in the same request.

`exit_conditions` take a contact out of the sequence as soon as one is true (a tag, a list, a saved segment, a contact-field rule, or a click in any of its e-mails); unsubscribing always does. The response lists in `step_problems` what still has to be fixed before the sequence can be activated.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
description string or null
trigger_type string
manual signup tag_added
trigger_tag_id integer or null
For `tag_added`: the tag that enrols; null for any tag.
trigger_list_ids array or null
For `signup`: limit it to signups to these lists.
exit_conditions array or null
Up to 10. Kinds: `tag`, `list`, `segment`, `field`, `clicked` (any e-mail of the sequence).
emails array of object
The linear shape: e-mails in order, each with `subject`, `html_content` (with an unsubscribe link), and optionally `plain_content`, `delay_days`, `delay_hours` and, on update, `id`.
steps array of object
The tree shape: the main path, with each condition's `yes` and `no` paths inside it. At most 60 steps in all.
steps.id integer
On update: the existing step this node keeps.
steps.ref string
Your own name for the step within this request, for a later condition's `step_ref`.
steps.type string
email wait condition exit
steps.subject string
E-mail: the subject line.
steps.html_content string
E-mail: the body, with an `{{unsubscribe_url}}` link. Not included in responses.
steps.plain_content string or null
E-mail: the text part; generated from the HTML when left out.
steps.delay_days integer
E-mail: days to wait after the contact reaches this step.
steps.delay_hours integer
E-mail: additional hours, 0 to 23.
steps.wait object
`duration`: `days` and `hours` (at least one hour in all). `until`: the next chosen weekday (`weekdays`, ISO 1 = Monday to 7 = Sunday; none means any day) at `time` (HH:MM) on the clock of `timezone`, across daylight-saving changes.
steps.condition object
What a condition step or an exit condition checks. `tag`: has `tag_id`. `list`: is subscribed to `list_id`. `segment`: matches the saved segment `segment_id`. `field`: matches `rule`, one condition in the segment rule format (see `GET /segments/fields`), custom fields included. Condition steps only: `opened` or `clicked` the e-mail `step_id` (or `step_ref`) within `within_hours` of it being sent (0: by the time the contact reaches the condition); contacts wait at the condition until they engage or the time is up. Exit conditions only: `clicked`, a click in any e-mail of the sequence.
steps.yes array of object
Condition: the steps for contacts it is true for, in this same shape.
steps.no array of object
Condition: the steps for everyone else, in this same shape.

Response

data object
data.id integer
data.name string
data.description string or null
data.status string
data.trigger_type string or null
`tag_added` sequences start when the trigger tag is added to a contact, including through `POST /contacts/{contact}/tags`.
data.trigger_tag_id integer or null
data.trigger_list_ids array of integer
For the signup trigger: the lists it is limited to; empty means any list.
data.exit_conditions array of object
data.emails array of object
On a single sequence: the e-mail steps in order (id, position, subject, delay_days, delay_hours).
data.steps array of object
On a single sequence: the main path of the step tree. E-mail bodies are not included.
data.step_problems array of string
On a single sequence: what has to be fixed before it can be activated. Empty when the steps are ready.
data.subscribers_count integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/sequences \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Welcome series","trigger_type":"signup","exit_conditions":[{"kind":"tag","tag_id":9}],"steps":[{"ref":"welcome","type":"email","subject":"Welcome aboard","html_content":"<p>Hi {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>","delay_days":0},{"type":"condition","condition":{"kind":"clicked","step_ref":"welcome","within_hours":72},"yes":[{"type":"email","subject":"Glad you had a look","html_content":"<p>Here is what to try next.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"}],"no":[{"type":"wait","wait":{"mode":"until","weekdays":[2],"time":"09:00","timezone":"Europe/Copenhagen"}},{"type":"email","subject":"In case you missed it","html_content":"<p>A quick reminder.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"}]}]}'

Request body

{
    "name": "Welcome series",
    "trigger_type": "signup",
    "exit_conditions": [
        {
            "kind": "tag",
            "tag_id": 9
        }
    ],
    "steps": [
        {
            "ref": "welcome",
            "type": "email",
            "subject": "Welcome aboard",
            "html_content": "<p>Hi {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
            "delay_days": 0
        },
        {
            "type": "condition",
            "condition": {
                "kind": "clicked",
                "step_ref": "welcome",
                "within_hours": 72
            },
            "yes": [
                {
                    "type": "email",
                    "subject": "Glad you had a look",
                    "html_content": "<p>Here is what to try next.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"
                }
            ],
            "no": [
                {
                    "type": "wait",
                    "wait": {
                        "mode": "until",
                        "weekdays": [
                            2
                        ],
                        "time": "09:00",
                        "timezone": "Europe/Copenhagen"
                    }
                },
                {
                    "type": "email",
                    "subject": "In case you missed it",
                    "html_content": "<p>A quick reminder.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"
                }
            ]
        }
    ]
}

Response 201

{
    "data": {
        "id": 3,
        "name": "Onboarding",
        "description": "Five emails over the first two weeks",
        "status": "active",
        "trigger_type": "tag_added",
        "trigger_tag_id": 7,
        "trigger_list_ids": [],
        "exit_conditions": [
            {
                "kind": "tag",
                "tag_id": 9
            }
        ],
        "emails": [
            {
                "id": 11,
                "position": 0,
                "subject": "Welcome aboard",
                "delay_days": 0,
                "delay_hours": 0
            }
        ],
        "steps": [
            {
                "id": 11,
                "ref": "welcome",
                "type": "email",
                "subject": "Welcome aboard",
                "html_content": "<p>Hi {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
                "plain_content": null,
                "delay_days": 0,
                "delay_hours": 0,
                "wait": {
                    "mode": "until",
                    "days": 2,
                    "hours": 0,
                    "weekdays": [
                        1,
                        3
                    ],
                    "time": "09:00",
                    "timezone": "Europe/Copenhagen"
                },
                "condition": {
                    "kind": "tag",
                    "tag_id": 9,
                    "list_id": 4,
                    "segment_id": 5,
                    "rule": {
                        "field": "custom.orders_count",
                        "type": "number",
                        "operator": "gte",
                        "value": 1
                    },
                    "timezone": "Europe/Copenhagen",
                    "step_id": 11,
                    "step_ref": "welcome",
                    "within_hours": 72
                },
                "yes": [
                    {
                        "type": "exit"
                    }
                ],
                "no": [
                    {
                        "type": "email",
                        "subject": "In case you missed it",
                        "html_content": "<p>A quick reminder.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"
                    }
                ]
            }
        ],
        "step_problems": [
            "Step 3: the \"no\" path is empty. Add a step to it, or an exit step to end the sequence there."
        ],
        "subscribers_count": 380
    }
}
GET /sequences/{sequence}

Requires scope campaigns:read

`emails` lists the e-mail steps in order, as before conditions existed; `steps` is the whole tree. `step_problems` lists what still has to be fixed before the sequence can be activated.

Path parameters

sequence integer Required
Sequence id.

Response

data object
data.id integer
data.name string
data.description string or null
data.status string
data.trigger_type string or null
`tag_added` sequences start when the trigger tag is added to a contact, including through `POST /contacts/{contact}/tags`.
data.trigger_tag_id integer or null
data.trigger_list_ids array of integer
For the signup trigger: the lists it is limited to; empty means any list.
data.exit_conditions array of object
data.emails array of object
On a single sequence: the e-mail steps in order (id, position, subject, delay_days, delay_hours).
data.steps array of object
On a single sequence: the main path of the step tree. E-mail bodies are not included.
data.step_problems array of string
On a single sequence: what has to be fixed before it can be activated. Empty when the steps are ready.
data.subscribers_count integer

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/sequences/:sequence \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 3,
        "name": "Onboarding",
        "description": "Five emails over the first two weeks",
        "status": "active",
        "trigger_type": "tag_added",
        "trigger_tag_id": 7,
        "trigger_list_ids": [],
        "exit_conditions": [
            {
                "kind": "tag",
                "tag_id": 9
            }
        ],
        "emails": [
            {
                "id": 11,
                "position": 0,
                "subject": "Welcome aboard",
                "delay_days": 0,
                "delay_hours": 0
            }
        ],
        "steps": [
            {
                "id": 11,
                "ref": "welcome",
                "type": "email",
                "subject": "Welcome aboard",
                "html_content": "<p>Hi {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
                "plain_content": null,
                "delay_days": 0,
                "delay_hours": 0,
                "wait": {
                    "mode": "until",
                    "days": 2,
                    "hours": 0,
                    "weekdays": [
                        1,
                        3
                    ],
                    "time": "09:00",
                    "timezone": "Europe/Copenhagen"
                },
                "condition": {
                    "kind": "tag",
                    "tag_id": 9,
                    "list_id": 4,
                    "segment_id": 5,
                    "rule": {
                        "field": "custom.orders_count",
                        "type": "number",
                        "operator": "gte",
                        "value": 1
                    },
                    "timezone": "Europe/Copenhagen",
                    "step_id": 11,
                    "step_ref": "welcome",
                    "within_hours": 72
                },
                "yes": [
                    {
                        "type": "exit"
                    }
                ],
                "no": [
                    {
                        "type": "email",
                        "subject": "In case you missed it",
                        "html_content": "<p>A quick reminder.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"
                    }
                ]
            }
        ],
        "step_problems": [
            "Step 3: the \"no\" path is empty. Add a step to it, or an exit step to end the sequence there."
        ],
        "subscribers_count": 380
    }
}
PATCH /sequences/{sequence}

Requires scope campaigns:write

Fields you leave out keep their value. Sending `steps` (or `emails`) replaces the whole step tree: a node with the `id` of one of the sequence's steps, of the same type, updates that step and keeps the contacts on it; an e-mail node with an `id` may leave out its content to keep it. Steps you leave out are removed, and contacts waiting on one move to the next kept step on the same path, or finish the sequence when there is none. A contact never receives the same e-mail twice.

An active sequence keeps sending while it changes, so its paths must stay complete: otherwise the request is refused with 422 `sequence_incomplete` and a `problems` list.

Path parameters

sequence integer Required
Sequence id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
description string or null
trigger_type string
manual signup tag_added
trigger_tag_id integer or null
For `tag_added`: the tag that enrols; null for any tag.
trigger_list_ids array or null
For `signup`: limit it to signups to these lists.
exit_conditions array or null
Up to 10. Kinds: `tag`, `list`, `segment`, `field`, `clicked` (any e-mail of the sequence).
emails array of object
The linear shape: e-mails in order, each with `subject`, `html_content` (with an unsubscribe link), and optionally `plain_content`, `delay_days`, `delay_hours` and, on update, `id`.
steps array of object
The tree shape: the main path, with each condition's `yes` and `no` paths inside it. At most 60 steps in all.
steps.id integer
On update: the existing step this node keeps.
steps.ref string
Your own name for the step within this request, for a later condition's `step_ref`.
steps.type string
email wait condition exit
steps.subject string
E-mail: the subject line.
steps.html_content string
E-mail: the body, with an `{{unsubscribe_url}}` link. Not included in responses.
steps.plain_content string or null
E-mail: the text part; generated from the HTML when left out.
steps.delay_days integer
E-mail: days to wait after the contact reaches this step.
steps.delay_hours integer
E-mail: additional hours, 0 to 23.
steps.wait object
`duration`: `days` and `hours` (at least one hour in all). `until`: the next chosen weekday (`weekdays`, ISO 1 = Monday to 7 = Sunday; none means any day) at `time` (HH:MM) on the clock of `timezone`, across daylight-saving changes.
steps.condition object
What a condition step or an exit condition checks. `tag`: has `tag_id`. `list`: is subscribed to `list_id`. `segment`: matches the saved segment `segment_id`. `field`: matches `rule`, one condition in the segment rule format (see `GET /segments/fields`), custom fields included. Condition steps only: `opened` or `clicked` the e-mail `step_id` (or `step_ref`) within `within_hours` of it being sent (0: by the time the contact reaches the condition); contacts wait at the condition until they engage or the time is up. Exit conditions only: `clicked`, a click in any e-mail of the sequence.
steps.yes array of object
Condition: the steps for contacts it is true for, in this same shape.
steps.no array of object
Condition: the steps for everyone else, in this same shape.

Response

data object
data.id integer
data.name string
data.description string or null
data.status string
data.trigger_type string or null
`tag_added` sequences start when the trigger tag is added to a contact, including through `POST /contacts/{contact}/tags`.
data.trigger_tag_id integer or null
data.trigger_list_ids array of integer
For the signup trigger: the lists it is limited to; empty means any list.
data.exit_conditions array of object
data.emails array of object
On a single sequence: the e-mail steps in order (id, position, subject, delay_days, delay_hours).
data.steps array of object
On a single sequence: the main path of the step tree. E-mail bodies are not included.
data.step_problems array of string
On a single sequence: what has to be fixed before it can be activated. Empty when the steps are ready.
data.subscribers_count integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/sequences/:sequence \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Welcome series","trigger_type":"signup","exit_conditions":[{"kind":"tag","tag_id":9}],"steps":[{"ref":"welcome","type":"email","subject":"Welcome aboard","html_content":"<p>Hi {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>","delay_days":0},{"type":"condition","condition":{"kind":"clicked","step_ref":"welcome","within_hours":72},"yes":[{"type":"email","subject":"Glad you had a look","html_content":"<p>Here is what to try next.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"}],"no":[{"type":"wait","wait":{"mode":"until","weekdays":[2],"time":"09:00","timezone":"Europe/Copenhagen"}},{"type":"email","subject":"In case you missed it","html_content":"<p>A quick reminder.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"}]}]}'

Request body

{
    "name": "Welcome series",
    "trigger_type": "signup",
    "exit_conditions": [
        {
            "kind": "tag",
            "tag_id": 9
        }
    ],
    "steps": [
        {
            "ref": "welcome",
            "type": "email",
            "subject": "Welcome aboard",
            "html_content": "<p>Hi {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
            "delay_days": 0
        },
        {
            "type": "condition",
            "condition": {
                "kind": "clicked",
                "step_ref": "welcome",
                "within_hours": 72
            },
            "yes": [
                {
                    "type": "email",
                    "subject": "Glad you had a look",
                    "html_content": "<p>Here is what to try next.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"
                }
            ],
            "no": [
                {
                    "type": "wait",
                    "wait": {
                        "mode": "until",
                        "weekdays": [
                            2
                        ],
                        "time": "09:00",
                        "timezone": "Europe/Copenhagen"
                    }
                },
                {
                    "type": "email",
                    "subject": "In case you missed it",
                    "html_content": "<p>A quick reminder.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"
                }
            ]
        }
    ]
}

Response 200

{
    "data": {
        "id": 3,
        "name": "Onboarding",
        "description": "Five emails over the first two weeks",
        "status": "active",
        "trigger_type": "tag_added",
        "trigger_tag_id": 7,
        "trigger_list_ids": [],
        "exit_conditions": [
            {
                "kind": "tag",
                "tag_id": 9
            }
        ],
        "emails": [
            {
                "id": 11,
                "position": 0,
                "subject": "Welcome aboard",
                "delay_days": 0,
                "delay_hours": 0
            }
        ],
        "steps": [
            {
                "id": 11,
                "ref": "welcome",
                "type": "email",
                "subject": "Welcome aboard",
                "html_content": "<p>Hi {{first_name|there}}</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
                "plain_content": null,
                "delay_days": 0,
                "delay_hours": 0,
                "wait": {
                    "mode": "until",
                    "days": 2,
                    "hours": 0,
                    "weekdays": [
                        1,
                        3
                    ],
                    "time": "09:00",
                    "timezone": "Europe/Copenhagen"
                },
                "condition": {
                    "kind": "tag",
                    "tag_id": 9,
                    "list_id": 4,
                    "segment_id": 5,
                    "rule": {
                        "field": "custom.orders_count",
                        "type": "number",
                        "operator": "gte",
                        "value": 1
                    },
                    "timezone": "Europe/Copenhagen",
                    "step_id": 11,
                    "step_ref": "welcome",
                    "within_hours": 72
                },
                "yes": [
                    {
                        "type": "exit"
                    }
                ],
                "no": [
                    {
                        "type": "email",
                        "subject": "In case you missed it",
                        "html_content": "<p>A quick reminder.</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>"
                    }
                ]
            }
        ],
        "step_problems": [
            "Step 3: the \"no\" path is empty. Add a step to it, or an exit step to end the sequence there."
        ],
        "subscribers_count": 380
    }
}
GET /sequences/{sequence}/subscribers

Requires scope campaigns:read

Path parameters

sequence integer Required
Sequence id.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/sequences/:sequence/subscribers \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {}
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /sequences/{sequence}/subscribers

Requires scope contacts:write

Accepts contact ids or email addresses. This is how you trigger onboarding from your own signup flow.

Path parameters

sequence integer Required
Sequence id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

contact_ids array of integer
emails array of string

Response

data object
data.sequence_id integer
data.matched integer
data.enrolled integer
data.skipped integer
Matched but not eligible: already enrolled, unsubscribed, or bounced.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/sequences/:sequence/subscribers \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"emails":["jane@example.com"]}'

Request body

{
    "emails": [
        "jane@example.com"
    ]
}

Response 200

{
    "data": {
        "sequence_id": 3,
        "matched": 2,
        "enrolled": 1,
        "skipped": 1
    }
}
DELETE /sequences/{sequence}/subscribers/{contact}

Requires scope contacts:write

Stops any pending steps. `removed` is false when the contact was not enrolled.

Path parameters

sequence integer Required
Sequence id.
contact integer Required
Contact id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.sequence_id integer
data.contact_id integer
data.removed boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/sequences/:sequence/subscribers/:contact \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "sequence_id": 3,
        "contact_id": 42,
        "removed": true
    }
}

Waitlists

Waitlists and signups

GET /waitlists

Requires scope contacts:read

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.name string
data.slug string
data.status string
active paused closed
data.public_url string
data.signups_count integer
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/waitlists \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 2,
            "name": "Beta access",
            "slug": "beta-access",
            "status": "active",
            "public_url": "https://tweak.email/w/beta-access",
            "signups_count": 1840
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
GET /waitlists/{waitlist}

Requires scope contacts:read

Path parameters

waitlist integer Required
Waitlist id.

Response

data object
data.id integer
data.name string
data.slug string
data.status string
active paused closed
data.public_url string
data.signups_count integer

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/waitlists/:waitlist \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 2,
        "name": "Beta access",
        "slug": "beta-access",
        "status": "active",
        "public_url": "https://tweak.email/w/beta-access",
        "signups_count": 1840
    }
}
GET /waitlists/{waitlist}/signups

Requires scope contacts:read

Path parameters

waitlist integer Required
Waitlist id.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.email string
data.name string or null
data.position integer or null
data.status string
waiting invited converted
data.referral_code string
data.referrals_count integer
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/waitlists/:waitlist/signups \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 501,
            "email": "jane@example.com",
            "name": "Jane Okonkwo",
            "position": 17,
            "status": "waiting",
            "referral_code": "K7P2QX",
            "referrals_count": 2
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /waitlists/{waitlist}/signups

Requires scope contacts:write

Queue position is assigned server-side. A signup is added to the waitlist's linked contact list only with `marketing_consent`.

Path parameters

waitlist integer Required
Waitlist id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

email string Required
name string
referral_code string
The referring signup's code, if this signup came through a referral.
metadata object
marketing_consent boolean
True only when the person ticked a box asking for your news and offers by email as well as joining the waitlist. When the waitlist is linked to a contact list, only these signups are added to it, and they are sent a confirmation email first. Left out or false, the person is on the waitlist only and is sent nothing.
marketing_consent_text string
The exact wording of the box the person ticked. Stored with its hash as their consent record.

Response

201
Signed up.
200
The address was already on the waitlist; its existing signup is returned.
data object
data.id integer
data.email string
data.name string or null
data.position integer or null
data.status string
waiting invited converted
data.referral_code string
data.referrals_count integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/waitlists/:waitlist/signups \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"jane@example.com","name":"Jane Okonkwo","referral_code":"K7P2QX","metadata":{"source":"launch-page"},"marketing_consent":true,"marketing_consent_text":"Also send me news and offers from Acme by email. I can unsubscribe at any time."}'

Request body

{
    "email": "jane@example.com",
    "name": "Jane Okonkwo",
    "referral_code": "K7P2QX",
    "metadata": {
        "source": "launch-page"
    },
    "marketing_consent": true,
    "marketing_consent_text": "Also send me news and offers from Acme by email. I can unsubscribe at any time."
}

Response 201

{
    "data": {
        "id": 501,
        "email": "jane@example.com",
        "name": "Jane Okonkwo",
        "position": 17,
        "status": "waiting",
        "referral_code": "K7P2QX",
        "referrals_count": 2
    }
}
POST /waitlists/{waitlist}/invite

Requires scope contacts:write

Either specific ids, or `count` to take the next N from the front of the queue.

Path parameters

waitlist integer Required
Waitlist id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

signup_ids array of integer
count integer
Invite the next N by queue position. Use instead of `signup_ids`.

Response

data object
data.waitlist_id integer
data.invited integer
data.signup_ids array of integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/waitlists/:waitlist/invite \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"signup_ids":[501,502]}'

Request body

{
    "signup_ids": [
        501,
        502
    ]
}

Response 200

{
    "data": {
        "waitlist_id": 2,
        "invited": 2,
        "signup_ids": [
            501,
            502
        ]
    }
}

Suppressions

The do-not-mail list

GET /suppressions

Requires scope suppressions:read

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.
reason string
Filter by reason.
hard_bounce soft_bounce spam_report unsubscribe manual
email string
Exact address match.

Response

data array of object
data.id integer
data.email string
data.reason string
hard_bounce soft_bounce spam_report unsubscribe manual
data.source string or null
Where the suppression came from, for example `api` for one added through the API.
data.campaign_id integer or null
data.metadata object or null
data.created_at string or null
data.updated_at string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/suppressions \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 77,
            "email": "former-customer@example.com",
            "reason": "manual",
            "source": "api",
            "campaign_id": null,
            "metadata": {
                "note": "Asked by phone not to be emailed"
            },
            "created_at": "2026-08-09T10:04:12+00:00",
            "updated_at": "2026-08-09T10:04:12+00:00"
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /suppressions

Requires scope suppressions:write

Upserts on address.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

email string Required
reason string Required
hard_bounce spam_report unsubscribe manual
metadata object

Response

201
The address was added.
200
The address was already suppressed; its reason and metadata were updated.
data object
data.id integer
data.email string
data.reason string
hard_bounce soft_bounce spam_report unsubscribe manual
data.source string or null
Where the suppression came from, for example `api` for one added through the API.
data.campaign_id integer or null
data.metadata object or null
data.created_at string or null
data.updated_at string or null

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/suppressions \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"former-customer@example.com","reason":"manual","metadata":{"note":"Asked by phone not to be emailed"}}'

Request body

{
    "email": "former-customer@example.com",
    "reason": "manual",
    "metadata": {
        "note": "Asked by phone not to be emailed"
    }
}

Response 201

{
    "data": {
        "id": 77,
        "email": "former-customer@example.com",
        "reason": "manual",
        "source": "api",
        "campaign_id": null,
        "metadata": {
            "note": "Asked by phone not to be emailed"
        },
        "created_at": "2026-08-09T10:04:12+00:00",
        "updated_at": "2026-08-09T10:04:12+00:00"
    }
}
DELETE /suppressions

Requires scope suppressions:write

The address becomes eligible for future sends.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

email string Required

Response

data object
data.email string
data.status string
removed not_found
status string
Deprecated: read `data.status` instead.
removed not_found

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/suppressions \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"former-customer@example.com"}'

Request body

{
    "email": "former-customer@example.com"
}

Response 200

{
    "data": {
        "email": "former-customer@example.com",
        "status": "removed"
    },
    "status": "removed"
}

Transactional

One-off transactional sending

POST /send

Requires scope transactional:send

Honours suppressions, sender-domain verification, and the plan's email allowance. Platform-wide suppressions (confirmed hard bounces and complaints) cannot be bypassed. Until a team owner or admin has accepted the Data Processing Agreement in the app, only the team's own members can be e-mailed; other recipients get a 403 with `dpa_required: true`.

A 200 means the message was accepted for delivery (`status: queued`), not that it reached the inbox. It returns a `message_id`; the message's `email.delivered`, `email.bounced` and `email.complained` webhooks and its events in `GET /events` carry the same `message_id` and your `metadata`. An open may be reported without them. A field the endpoint does not support (such as `tags`, `headers` or `cc`) is a 422 naming it, never silently dropped.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

to string Required
to_name string or null
from_email string Required
Sent as-is from a fully verified sending domain. On tweak.email without one, the message goes out from your team address on the shared sender domain with this address as Reply-To. Third-party providers require a verified domain.
from_name string or null
reply_to string or null
subject string Required
Merge tags are substituted here too.
html string
Required unless template_id is given.
text string or null
Derived from the HTML when omitted.
template_id integer
One of your templates, or a system template. Required unless html is given.
variables object
Values for {{merge_tags}} in the subject and body.
ignore_suppression boolean
Waives your own suppression list for a genuinely operational message, such as a security alert. Never waives platform-wide suppressions. Leave it out for anything else.
metadata object or null
Your own reference data for the message, such as an order number: up to 20 string values, keys of up to 40 letters, digits, `_`, `-` or `.`. Returned with the message's delivery webhooks and events; never put in the email.

Response

data object
data.status string
`queued`: accepted for delivery. Delivery itself is reported by the `email.delivered` or `email.bounced` webhook. `sandboxed`: checked but not sent.
queued sandboxed
data.message_id string or null
Our id for this message, carried by its delivery webhooks and events. Null in sandbox mode.
data.to string
data.subject string
With merge tags substituted.
data.metadata object
The metadata stored with the message.
data.accepted boolean
True when the message was accepted for delivery; false in sandbox mode.
data.delivered boolean
Deprecated: the same as `accepted`. It never meant the message reached the inbox. It will be removed in a later version.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.
502
The message could not be handed over for delivery. Nothing was sent; retry shortly.
503
A service this endpoint depends on is temporarily unavailable, for example while sending is paused. Nothing was done; retry later.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/send \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"jane@example.com","to_name":"Jane Okonkwo","from_email":"receipts@acme.com","from_name":"Acme","reply_to":"support@acme.com","subject":"Your receipt for order {{order_id}}","html":"<p>Hi {{first_name}}, thanks for order {{order_id}}. Your total was {{total}}.</p>","variables":{"first_name":"Jane","order_id":"4417","total":"€49.00"},"metadata":{"order_id":"4417"}}'

Request body

{
    "to": "jane@example.com",
    "to_name": "Jane Okonkwo",
    "from_email": "receipts@acme.com",
    "from_name": "Acme",
    "reply_to": "support@acme.com",
    "subject": "Your receipt for order {{order_id}}",
    "html": "<p>Hi {{first_name}}, thanks for order {{order_id}}. Your total was {{total}}.</p>",
    "variables": {
        "first_name": "Jane",
        "order_id": "4417",
        "total": "€49.00"
    },
    "metadata": {
        "order_id": "4417"
    }
}

Response 200

{
    "data": {
        "status": "queued",
        "message_id": "msg_01jd4x7v3k9q2m8r5t6w0y1z2a",
        "to": "jane@example.com",
        "subject": "Your receipt for order 4417",
        "metadata": {
            "order_id": "4417"
        },
        "accepted": true,
        "delivered": true
    }
}

AI

Copy polish, subject lines, and deliverability scoring

POST /ai/polish

Requires scope ai:write

Rewrites for a requested tone and goal, and returns concrete suggestions plus a quality score. Counts against the plan's monthly AI allowance.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

content string Required
tone string
professional casual friendly formal persuasive
goal string
clarity engagement conversion brevity warmth

Response

data object
data.id integer
data.tweaked_content string
data.ai_suggestions array of string
data.quality_score number
data.model_used string or null
data.tokens_used integer

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.
503
A service this endpoint depends on is temporarily unavailable, for example while sending is paused. Nothing was done; retry later.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/ai/polish \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content":"Hey, we have got a new feature you might like. Check it out when you get a chance.","tone":"friendly","goal":"engagement"}'

Request body

{
    "content": "Hey, we have got a new feature you might like. Check it out when you get a chance.",
    "tone": "friendly",
    "goal": "engagement"
}

Response 200

{
    "data": {
        "id": 9001,
        "tweaked_content": "Good news: the feature you asked for is here. Take a look, it takes two minutes to set up.",
        "ai_suggestions": [
            "Lead with the benefit, not the announcement."
        ],
        "quality_score": 82,
        "model_used": null,
        "tokens_used": 412
    }
}
POST /ai/subject-lines

Requires scope ai:write

Set `use_history` to ground the scoring in this team's own historical open rates rather than generic heuristics.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

subject string Required
use_history boolean
Ground scoring in this team's real historical open rates.

Response

data object
data.id integer
data.variations array of object
data.winning_subject string
data.original_score number
data.best_score number

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.
503
A service this endpoint depends on is temporarily unavailable, for example while sending is paused. Nothing was done; retry later.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/ai/subject-lines \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject":"Our August update","use_history":true}'

Request body

{
    "subject": "Our August update",
    "use_history": true
}

Response 200

{
    "data": {
        "id": 9002,
        "variations": [
            {
                "subject": "Three things we shipped in August",
                "score": 71
            }
        ],
        "winning_subject": "Three things we shipped in August",
        "original_score": 54,
        "best_score": 71
    }
}
POST /ai/deliverability

Requires scope ai:write

Returns a spam score, specific issues, and a pass/warn/fail verdict. Useful as a pre-send check in CI.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

content string Required
subject string
use_account_signals boolean
Weight the assessment by your account's real bounce, complaint, and domain-auth signals. Defaults to true.

Response

data object
data.id integer
data.spam_score number
0–100; lower is better.
data.issues array of object
data.checks_passed array of object
data.verdict string
pass warn fail

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.
503
A service this endpoint depends on is temporarily unavailable, for example while sending is paused. Nothing was done; retry later.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/ai/deliverability \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content":"<p>Hi {{first_name|there}}, your invoice for August is ready.</p>","subject":"Your invoice is ready","use_account_signals":true}'

Request body

{
    "content": "<p>Hi {{first_name|there}}, your invoice for August is ready.</p>",
    "subject": "Your invoice is ready",
    "use_account_signals": true
}

Response 200

{
    "data": {
        "id": 9003,
        "spam_score": 12,
        "issues": [],
        "checks_passed": [
            {
                "check": "unsubscribe_link"
            }
        ],
        "verdict": "pass"
    }
}
GET /ai/usage

Response

data object
data.period_start string
data.period_end string
data.ai_tweaks object
data.subject_tests object
data.emails object

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/ai/usage \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "period_start": "2026-08-09T10:00:00+00:00",
        "period_end": "2026-08-09T10:00:00+00:00",
        "ai_tweaks": {},
        "subject_tests": {},
        "emails": {}
    }
}

Webhooks

Outbound event subscriptions

GET /webhooks

Requires scope webhooks:read

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.url string
data.description string or null
data.events array of string
data.is_active boolean
data.last_delivered_at string or null
data.consecutive_failures integer
data.secret string
Returned only on creation and rotation.
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/webhooks \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 4,
            "url": "https://example.com/hooks/tweak",
            "description": "CRM sync",
            "events": [
                "contact.unsubscribed",
                "email.bounced"
            ],
            "is_active": true,
            "last_delivered_at": null,
            "consecutive_failures": 0,
            "secret": "whsec_3Fq9sLk2mVn8XyZa1bC4dE5fG6hJ7kL8"
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /webhooks

Requires scope webhooks:write

The response is the only time the signing secret is returned. Payloads are signed as `Tweak-Signature: t={timestamp},v1={hmac}` where the HMAC is SHA-256 over `{timestamp}.{raw body}`. A URL on localhost, a private, loopback, link-local, multicast or reserved address, an IP address written in a non-standard form (`2130706433`, `0x7f000001`, `127.1`), or a URL with a user name or password in it is a 422 with `code: unsafe_webhook_url`. Deliveries pause while the team's plan does not include the API.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

url string Required
Must be publicly routable: localhost, private, loopback, link-local, multicast and reserved addresses, IP addresses in a non-standard numeric form, and URLs carrying a user name or password are refused with 422 (`code: unsafe_webhook_url`). The host is checked again, after DNS, on every delivery, and the delivery connects to the address that was checked.
description string
events array of string Required
Event types, or ["*"] for all.

Response

data object
data.id integer
data.url string
data.description string or null
data.events array of string
data.is_active boolean
data.last_delivered_at string or null
data.consecutive_failures integer
data.secret string
Returned only on creation and rotation.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/webhooks \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hooks/tweak","description":"CRM sync","events":["contact.unsubscribed","email.bounced"]}'

Request body

{
    "url": "https://example.com/hooks/tweak",
    "description": "CRM sync",
    "events": [
        "contact.unsubscribed",
        "email.bounced"
    ]
}

Response 201

{
    "data": {
        "id": 4,
        "url": "https://example.com/hooks/tweak",
        "description": "CRM sync",
        "events": [
            "contact.unsubscribed",
            "email.bounced"
        ],
        "is_active": true,
        "last_delivered_at": null,
        "consecutive_failures": 0,
        "secret": "whsec_3Fq9sLk2mVn8XyZa1bC4dE5fG6hJ7kL8"
    }
}
GET /webhooks/event-types

Requires scope webhooks:read

Response

data array of object
data.type string
data.description string

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/webhooks/event-types \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "type": "contact.unsubscribed",
            "description": "A contact unsubscribed"
        }
    ]
}
GET /webhooks/{endpoint}

Requires scope webhooks:read

Path parameters

endpoint integer Required
Webhook endpoint id.

Response

data object
data.id integer
data.url string
data.description string or null
data.events array of string
data.is_active boolean
data.last_delivered_at string or null
data.consecutive_failures integer
data.secret string
Returned only on creation and rotation.

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/webhooks/:endpoint \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 4,
        "url": "https://example.com/hooks/tweak",
        "description": "CRM sync",
        "events": [
            "contact.unsubscribed",
            "email.bounced"
        ],
        "is_active": true,
        "last_delivered_at": null,
        "consecutive_failures": 0,
        "secret": "whsec_3Fq9sLk2mVn8XyZa1bC4dE5fG6hJ7kL8"
    }
}
PATCH /webhooks/{endpoint}

Requires scope webhooks:write

Path parameters

endpoint integer Required
Webhook endpoint id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

url string
description string or null
events array of string
is_active boolean
Re-enabling an endpoint also resets its failure count.

Response

data object
data.id integer
data.url string
data.description string or null
data.events array of string
data.is_active boolean
data.last_delivered_at string or null
data.consecutive_failures integer
data.secret string
Returned only on creation and rotation.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X PATCH https://tweak.email/api/v1/webhooks/:endpoint \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hooks/tweak","description":"CRM sync","events":["*"],"is_active":true}'

Request body

{
    "url": "https://example.com/hooks/tweak",
    "description": "CRM sync",
    "events": [
        "*"
    ],
    "is_active": true
}

Response 200

{
    "data": {
        "id": 4,
        "url": "https://example.com/hooks/tweak",
        "description": "CRM sync",
        "events": [
            "contact.unsubscribed",
            "email.bounced"
        ],
        "is_active": true,
        "last_delivered_at": null,
        "consecutive_failures": 0,
        "secret": "whsec_3Fq9sLk2mVn8XyZa1bC4dE5fG6hJ7kL8"
    }
}
DELETE /webhooks/{endpoint}

Requires scope webhooks:write

Path parameters

endpoint integer Required
Webhook endpoint id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.deleted boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/webhooks/:endpoint \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 42,
        "deleted": true
    }
}
GET /webhooks/{endpoint}/deliveries

Requires scope webhooks:read

What was sent and what your endpoint answered, for debugging.

Path parameters

endpoint integer Required
Webhook endpoint id.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.event_type string
data.event_id string
data.payload object
The body that was sent, as in `WebhookEvent`.
data.response_status integer or null
data.response_body string or null
The start of what the endpoint answered: up to 500 characters of a 2xx answer, up to 200 of any other; null when it sent none.
data.attempt integer
data.succeeded boolean
data.error string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/webhooks/:endpoint/deliveries \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 8812,
            "event_type": "email.bounced",
            "event_id": "evt_3Fq9sLk2mVn8XyZa1bC4dE5f",
            "payload": {},
            "response_status": 200,
            "response_body": "ok",
            "attempt": 1,
            "succeeded": true,
            "error": null
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /webhooks/{endpoint}/test

Requires scope webhooks:write

Lets you verify signature checking without provoking a real bounce.

Path parameters

endpoint integer Required
Webhook endpoint id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.queued boolean
data.event_id string

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/webhooks/:endpoint/test \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "queued": true,
        "event_id": "evt_test_9xQ2mLk4Rt7VbN1c"
    }
}
POST /webhooks/{endpoint}/rotate-secret

Requires scope webhooks:write

Returns the new secret once.

Path parameters

endpoint integer Required
Webhook endpoint id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.url string
data.description string or null
data.events array of string
data.is_active boolean
data.last_delivered_at string or null
data.consecutive_failures integer
data.secret string
Returned only on creation and rotation.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/webhooks/:endpoint/rotate-secret \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 4,
        "url": "https://example.com/hooks/tweak",
        "description": "CRM sync",
        "events": [
            "contact.unsubscribed",
            "email.bounced"
        ],
        "is_active": true,
        "last_delivered_at": null,
        "consecutive_failures": 0,
        "secret": "whsec_3Fq9sLk2mVn8XyZa1bC4dE5fG6hJ7kL8"
    }
}

API keys

Credential management

GET /api-keys

Requires scope keys:manage

Secrets are never returned; only a masked prefix.

Query parameters

per_page integer default 25
Records per page (1–100, default 25).
cursor string
The `next_cursor` (or `prev_cursor`) value from a previous response of the same listing, unchanged. Any other value is refused with 422 rather than silently restarting at the first page.

Response

data array of object
data.id integer
data.name string
data.masked_key string
data.scopes array of string
data.last_used_at string or null
data.expires_at string or null
data.revoked_at string or null
per_page integer
next_cursor string or null
Pass as `?cursor=` for the next page. Null on the last page.
prev_cursor string or null
next_page_url string or null
prev_page_url string or null
has_more boolean

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/api-keys \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "id": 4,
            "name": "CRM sync",
            "masked_key": "lt_a1B2c3D...9xYz",
            "scopes": [
                "contacts:read",
                "contacts:write"
            ],
            "last_used_at": "2026-08-09T10:04:12+00:00",
            "expires_at": null,
            "revoked_at": null
        }
    ],
    "per_page": 25,
    "next_cursor": "eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_cursor": null,
    "next_page_url": "https://tweak.email/api/v1/contacts?cursor=eyJjb250YWN0cy5pZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
    "prev_page_url": null,
    "has_more": true
}
POST /api-keys

Requires scope keys:manage

The secret is returned exactly once. A key cannot grant scopes it does not itself hold, and cannot create a key that outlives it: when the minting key expires, the new key expires no later (it gets the same expiry when you give none, and a later `expires_at` is a 422). An empty `scopes` list is a 422. Sent with an `Idempotency-Key`, a retry returns the same key rather than minting a second one.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Body

name string Required
scopes array of string
Omitted, the new key gets every scope, which only a key holding every scope may grant. Name the scopes the integration needs; an empty list is a 422.
expires_at string or null
Must be in the future, and no later than the expiry of the key making the request. Omitted, the new key gets that key's expiry, or none when it has none.

Response

data object
data.id integer
data.name string
data.masked_key string
data.scopes array of string
data.last_used_at string or null
data.expires_at string or null
data.revoked_at string or null
data.key string
The secret. Returned exactly once.

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X POST https://tweak.email/api/v1/api-keys \
  -H "Authorization: Bearer $TWEAK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"CRM sync","scopes":["contacts:read","contacts:write"],"expires_at":"2027-01-01T00:00:00+00:00"}'

Request body

{
    "name": "CRM sync",
    "scopes": [
        "contacts:read",
        "contacts:write"
    ],
    "expires_at": "2027-01-01T00:00:00+00:00"
}

Response 201

{
    "data": {
        "id": 4,
        "name": "CRM sync",
        "masked_key": "lt_a1B2c3D...9xYz",
        "scopes": [
            "contacts:read",
            "contacts:write"
        ],
        "last_used_at": "2026-08-09T10:04:12+00:00",
        "expires_at": null,
        "revoked_at": null,
        "key": "lt_a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6q7R8s9T0u1V2w9xYz"
    }
}
GET /api-keys/scopes

Response

data array of object
data.scope string
data.description string

Errors

403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl https://tweak.email/api/v1/api-keys/scopes \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": [
        {
            "scope": "contacts:read",
            "description": "Read contacts, lists, tags, segments, and contact fields"
        }
    ]
}
DELETE /api-keys/{key}

Requires scope keys:manage

Revoked rather than deleted, so the audit record survives. A key may revoke itself, or a key whose scopes it holds all of; revoking a broader key is a 403.

Path parameters

key integer Required
API key id.

Headers

Idempotency-Key string
A value you choose (up to 255 characters) and keep the same across retries of one operation. For 24 hours, a retry with the same key and body replays the first successful response, marked `Idempotency-Replayed: true`, instead of executing again. The same key with a different body is a 422 (`idempotency_key_reused`). Keys are shared by the whole team and bound to the API key that first used them: another API key of the team presenting the same Idempotency-Key also gets that 422, even with the same body, so give each integration its own keys. A retry while the first request is still running is a 409. Failed requests are not kept, so they can be retried with the same key.

Response

data object
data.id integer
data.revoked boolean

Errors

400
The body was sent as JSON (`Content-Type: application/json`) but is not valid JSON, or not a JSON object (`code: invalid_json`). Nothing was done.
403
The key lacks a required scope (`code: missing_scope`), or the team's plan does not include API access (`code: plan_required`, with `required_plan` and, after a free trial, `trial_ended_at`).
404
No such record for this team.
422
The request was understood but could not be applied.

Every endpoint can also return 401 (bad credential) and 429 (rate limited, see Retry-After). A write sent with an Idempotency-Key can also return 409 while the first request with that key is still running.

Request

curl -X DELETE https://tweak.email/api/v1/api-keys/:key \
  -H "Authorization: Bearer $TWEAK_API_KEY"

Response 200

{
    "data": {
        "id": 4,
        "revoked": true
    }
}