EmailOctopus v2 API (2.0.0)

Download OpenAPI specification:Download

Introduction

The EmailOctopus API allows you to manage resources and perform actions within the platform programmatically. You'll need to create an account before using the API, if you don't already have one.

The API is designed around REST principles. It has a predictable URL structure based on resources, accepts JSON-encoded request bodies, returns JSON-encoded responses and uses standard HTTP response codes, authentication and verbs.

The base URL for the API is https://api.emailoctopus.com.

Authentication

To use the API, you'll need to generate an API key. You can do this in your account settings. If you have an API key created prior to the release of API v2 (labelled 'legacy') you'll need to generate a new API key. New API keys are compatible with all versions of the API.

The API uses bearer authentication to authenticate requests. Authenticate your request by including the following header:

Authorization: Bearer {token}

For example, using curl:

curl https://api.emailoctopus.com/lists/ -H "Authorization: Bearer {token}"

If you see a JSON-formatted response with your list details, that's great! That means you can connect to the API, and your authentication token works.

If you encounter a JSON error response, refer to the type field for a link to detailed documentation. For non-JSON errors, the request likely didn't reach the server. In that case, double-check the URL and verify that your request is correctly formatted.

Rate limiting

Requests to the API are subject to a rate limit, which is implemented using the token bucket algorithm. Each request consumes one token and your bucket holds up to 100 tokens. Tokens are replenished at a rate of 10 per second. To check your remaining tokens, refer to the X-RateLimiting-Remaining header in the response.

This system enables a steady request rate of up to 10 per second or a burst of up to 100 requests in a single instance if needed.

If your account exceeds the rate limit, the request will return a 429 HTTP status code.

Pagination

When you request a collection of entities, such as contacts belonging to a list, the data will be paginated rather than returned all at once. Each response will contain a maximum of 100 results in the data attribute.

Pagination information is included in the response paging attribute. This data will contain next attributes, with a URL and a starting_after cursor. The cursor serves as a link to the next page. You can use the cursor as a starting_after query string parameter to navigate to the next page or follow the provided URL in the JSON structure.

Here's an example of what the paging attribute looks like:

"paging": {
    "next": {
        "url": "https://api.emailoctopus.com/lists/{list_id}/contacts?starting_after=WyIyMDI0LTEyLTA3VDE1OjAzOjAxKzAwOjAwIiwiNDYzN2RmYTAtYjZmMC0xMWVmLWFjZDYtZjU5YjA4MDFlMjBkIl0&limit=100",
        "starting_after": "WyIyMDI0LTEyLTA3VDE1OjAzOjAxKzAwOjAwIiwiNDYzN2RmYTAtYjZmMC0xMWVmLWFjZDYtZjU5YjA4MDFlMjBkIl0"
    }
 }

You can add the cursor to your request URL by including the starting_after query string parameter, like this:

https://api.emailoctopus.com/lists/{list_id}/contacts?starting_after=WyIyMDI0LTEyLTA3VDE1OjAzOjAxKzAwOjAwIiwiNDYzN2RmYTAtYjZmMC0xMWVmLWFjZDYtZjU5YjA4MDFlMjBkIl0

The cursor should always be provided exactly as it was returned in a previous request. Avoid deconstructing the cursor and relying on any data inside it, as the implementation of the cursor is subject to change.

Errors

Error are returned in a standardised format following RFC 7807. For example:

{
    "title": "An error occurred.",
    "detail": "Bad request.",
    "status": 400,
    "type": "https://emailoctopus.com/api-documentation/v2#bad-request"
}

You can use the type value to navigate to the documentation for more details about the specific error.

You may also encounter validation errors, which will return a 422 HTTP status code and a payload formatted according to RFC 9457.

{
    "title": "An error occurred.",
    "detail": "Unprocessable content.",
    "status": 422,
    "errors": [
         {
            "detail": "This value should not be blank.",
            "pointer": "/email_address"
         }
    ],
    "type": "https://emailoctopus.com/api-documentation/v2#unprocessable-content"
}

In the following sections, you can find more information about each type of error.

access-denied

You do not have permission to access the requested entity, such as trying to get the contacts in a list belonging to another account.

Check that the API key you're using belongs to the account you're trying to access data in. You can verify this by navigating to the account's API keys and checking there's a key ending in the same four characters.

already-exists

You are attempting to create an entity that already exists, such as creating a tag on a list that already contains that tag, or adding a contact to a list that already includes that contact.

You can fix this by checking if the entity already exists before you attempt to create it. Or you may wish to handle the error gracefully in your code and update the existing resource when a duplicate is spotted.

Some endpoints, such as the create or update contact endpoint, support an upsert operation. An upsert allows you to either update the entity if it exists or create a new one if it doesn't. Consider using this feature where applicable.

bad-request

The request body is not in the format expected. Check that the request body is valid JSON.

conflict

This request conflicts with the system state. Get in touch if you require further assistance.

internal-error

This error is returned when the API encounters an unexpected condition or an internal issue on the server. If you receive this error, it is probably not an issue with your request.

In some cases, retrying the request after some time may resolve the issue. We'll always be notified of the error via our internal tracking tools, but if the problem persists, get in touch with details about the error and we'll investigate.

not-found

The resource you're trying to access or modify could not be found. This error is typically caused by using an invalid or incorrect identifier, such as a list ID or contact ID that doesn't exist in your account.

Double-check the resource identifiers you're using in your request, and ensure they match the actual resources in your EmailOctopus account.

out-of-limits

Executing this operation would cause you to exceed your plan limits. See our pricing comparison for further details on these limits.

unauthorized

The API key provided in the request is either invalid or missing. Ensure that you're using the correct API key and that it is included in the request header as shown in the authentication section.

unprocessable-content

The JSON payload in your request body doesn't meet the required criteria. Check the errors attribute for details on the specific issues. It will include a pointer to the problematic attribute and an error description.

unsupported-media-type

When making requests that require a JSON payload in the body, you must specify a Content-Type of application/json.

too-many-requests

Your account has exceeded the rate limit. You can use the X-RateLimit-Retry-After header to determine when to make another request. See the rate limiting section section for further details.

method-not-allowed

The HTTP method used in your request is not supported for the endpoint you are trying to access. For example, attempting to use a POST method on an endpoint that only supports GET.

Check the API documentation for the correct methods allowed for each endpoint. Ensure your request uses one of the supported methods (e.g., GET, POST, PUT, DELETE) for the specific operation you want to perform.

Automation

An automation is a sequence of automated steps triggered by an event, such as when a contact subscribes to a list or is tagged. Automations allow you to automatically send emails, update fields, apply tags and more.

Start an automation for a contact

Start an automation for a specific contact. The automation must have the Started via API trigger type. A contact can only trigger an automation once, unless you've enabled Allow contacts to repeat in the automation's settings.

path Parameters
automation_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the automation.

Request Body schema: application/json
optional
contact_id
string

The ID of the contact.

Responses

Request samples

Content type
application/json
{
  • "contact_id": "00000000-0000-0000-0000-000000000000"
}

Response samples

Content type
application/json
{}

Campaign

A campaign is generally used to send a one-off, timely email to some or all of your subscribers. For example you may use a campaign to send the latest edition of your weekly newsletter, or to announce a new feature in your product.

Get all campaigns

query Parameters
limit
integer
Default: "100"
Example: limit=100

Max number of results per page.

starting_after
string
Example: starting_after=WyIyMDI0LTEyLTA3VDE1OjAzOjAxKzAwOjAwIiwiNDYzN2RmYTAtYjZmMC0xMWVmLWFjZDYtZjU5YjA4MDFlMjBkIl0

Cursor that points to the end of the page.

Responses

Request samples

curl --request GET \
  --url https://api.emailoctopus.com/campaigns \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "paging": {}
}

Get campaign

path Parameters
campaign_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the campaign.

Responses

Request samples

curl --request GET \
  --url https://api.emailoctopus.com/campaigns/00000000-0000-0000-0000-000000000000 \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "status": "draft",
  • "name": "New clients campaign",
  • "subject": "Hello",
  • "to": [
    ],
  • "from": {
    },
  • "content": {
    },
  • "created_at": "2015-12-01T12:59:37+00:00",
  • "sent_at": "2015-12-01T12:59:37+00:00"
}

Campaign contact reports

path Parameters
campaign_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the campaign.

query Parameters
limit
integer
Default: "100"
Example: limit=100

Max number of results per page.

starting_after
string
Example: starting_after=WyIyMDI0LTEyLTA3VDE1OjAzOjAxKzAwOjAwIiwiNDYzN2RmYTAtYjZmMC0xMWVmLWFjZDYtZjU5YjA4MDFlMjBkIl0

Cursor that points to the end of the page.

status
required
string
Enum: "bounced" "clicked" "complained" "opened" "sent" "unsubscribed" "not-opened" "not-clicked"
Example: status=bounced

The status of the report.

Responses

Request samples

curl --request GET \
  --url 'https://api.emailoctopus.com/campaigns/00000000-0000-0000-0000-000000000000/reports?status=bounced' \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{}

Campaign summary report

path Parameters
campaign_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the campaign.

Responses

Request samples

curl --request GET \
  --url https://api.emailoctopus.com/campaigns/00000000-0000-0000-0000-000000000000/reports/summary \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "sent": 200,
  • "bounced": {
    },
  • "opened": {
    },
  • "clicked": {
    },
  • "complained": 50,
  • "unsubscribed": 25
}

Contact

A contact represents an individual person within a list. For instance someone who has subscribed to your weekly newsletter. Contacts contain essential information such as their email address, name and any additional data you have collected. Contacts can also have tags, participate in automations and receive campaigns.

Get contacts

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

query Parameters
limit
integer
Default: "100"
Example: limit=100

Max number of results per page.

starting_after
string
Example: starting_after=WyIyMDI0LTEyLTA3VDE1OjAzOjAxKzAwOjAwIiwiNDYzN2RmYTAtYjZmMC0xMWVmLWFjZDYtZjU5YjA4MDFlMjBkIl0

Cursor that points to the end of the page.

tag
string
Example: tag=vip

The tag associated with the contact.

status
string
Default: "subscribed"
Enum: "subscribed" "unsubscribed" "pending"
Example: status=subscribed

The status of the contact.

created_at.lte
string
Example: created_at.lte=2024-01-19T12:14:28Z

Filter by creation date - less than or equal to. ISO 8601 date format.

created_at.gte
string
Example: created_at.gte=2024-01-19T12:14:28Z

Filter by creation date - greater than or equal to. ISO 8601 date format.

last_updated_at.lte
string
Example: last_updated_at.lte=2024-01-19T12:14:28Z

Filter by update date - less than or equal to. ISO 8601 date format.

last_updated_at.gte
string
Example: last_updated_at.gte=2024-01-19T12:14:28Z

Filter by update date - greater than or equal to. ISO 8601 date format.

Responses

Request samples

curl --request GET \
  --url https://api.emailoctopus.com/lists/00000000-0000-0000-0000-000000000000/contacts \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{}

Create or update contact

This is an upsert endpoint. If the contact does not exist, it will be created. If the contact already exists, it will be updated.

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

Request Body schema: application/json
optional
email_address
required
string

The email address of the contact.

object

An object containing key/value pairs of field values, using the field's tag as the key.

object

An object containing key/value pairs, where the key is the tag name and the value is true to add the tag or false to remove it. Tags that are not referenced in the object will not be updated.

status
string
Enum: "pending" "subscribed" "unsubscribed"

The status of the contact.

Responses

Request samples

Content type
application/json
{
  • "email_address": "otto@example.com",
  • "fields": {
    },
  • "tags": {
    },
  • "status": "subscribed"
}

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "email_address": "otto@example.com",
  • "fields": {
    },
  • "tags": [
    ],
  • "status": "subscribed",
  • "created_at": "2015-12-01T12:59:37+00:00",
  • "last_updated_at": "2015-12-01T12:59:37+00:00"
}

Create contact

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

Request Body schema: application/json
optional
email_address
required
string

The email address of the contact.

object

An object containing key/value pairs of field values, using the field's tag as the key.

tags
Array of strings

An array of tags associated with the contact.

status
string
Enum: "pending" "subscribed" "unsubscribed"

The status of the contact.

Responses

Request samples

Content type
application/json
{
  • "email_address": "otto@example.com",
  • "fields": {
    },
  • "tags": [
    ],
  • "status": "subscribed"
}

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "email_address": "otto@example.com",
  • "fields": {
    },
  • "tags": [
    ],
  • "status": "subscribed",
  • "created_at": "2015-12-01T12:59:37+00:00",
  • "last_updated_at": "2015-12-01T12:59:37+00:00"
}

Update multiple list contacts

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

Request Body schema: application/json
optional
Array of objects (ListContactBatchItemResource-put) [ 1 .. 100 ] items

Responses

Request samples

Content type
application/json
{
  • "contacts": [
    ]
}

Response samples

Content type
application/json
{
  • "success": [
    ],
  • "errors": [
    ]
}

Get contact

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

contact_id
required
string
Example: 631251b876fece73bc9dd647fe596d5f

The ID of the contact, or an MD5 hash of the lowercase version of the contact's email address.

Responses

Request samples

curl --request GET \
  --url https://api.emailoctopus.com/lists/00000000-0000-0000-0000-000000000000/contacts/631251b876fece73bc9dd647fe596d5f \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "email_address": "otto@example.com",
  • "fields": {
    },
  • "tags": [
    ],
  • "status": "subscribed",
  • "created_at": "2015-12-01T12:59:37+00:00",
  • "last_updated_at": "2015-12-01T12:59:37+00:00"
}

Update contact

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

contact_id
required
string
Example: 631251b876fece73bc9dd647fe596d5f

The ID of the contact, or an MD5 hash of the lowercase version of the contact's email address.

Request Body schema: application/json
optional
email_address
string

The email address of the contact.

object

An object containing key/value pairs of field values, using the field's tag as the key.

object

An object containing key/value pairs, where the key is the tag name and the value is true to add the tag or false to remove it. Tags that are not referenced in the object will not be updated.

status
string
Enum: "pending" "subscribed" "unsubscribed"

The status of the contact.

Responses

Request samples

Content type
application/json
{
  • "email_address": "otto@example.com",
  • "fields": {
    },
  • "tags": {
    },
  • "status": "subscribed"
}

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "email_address": "otto@example.com",
  • "fields": {
    },
  • "tags": [
    ],
  • "status": "subscribed",
  • "created_at": "2015-12-01T12:59:37+00:00",
  • "last_updated_at": "2015-12-01T12:59:37+00:00"
}

Delete contact

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

contact_id
required
string
Example: 631251b876fece73bc9dd647fe596d5f

The ID of the contact, or an MD5 hash of the lowercase version of the contact's email address.

Responses

Request samples

curl --request DELETE \
  --url https://api.emailoctopus.com/lists/00000000-0000-0000-0000-000000000000/contacts/631251b876fece73bc9dd647fe596d5f \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{}

Field

Fields are custom data points associated with contacts within a specific list. You can create additional fields to capture specific information about your contacts, such as birthday, location, age or dietary preferences. These fields can be useful for sending more personalised and targeted emails.

Create field

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

Request Body schema: application/json
optional
label
required
string

A human readable label for the field.

tag
required
string

The ID used to reference the field in your emails.

type
required
string
Enum: "text" "number" "date"

The type of the field.

fallback
string

A default value for the field, used when there is no other value available.

Responses

Request samples

Content type
application/json
{
  • "label": "What is your hometown?",
  • "tag": "Hometown",
  • "type": "text",
  • "fallback": "Unknown"
}

Response samples

Content type
application/json
{
  • "label": "What is your hometown?",
  • "tag": "Hometown",
  • "type": "text",
  • "fallback": "Unknown"
}

Update field

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

tag
required
string
Example: customer

A unique name for the tag.

Request Body schema: application/json
optional
label
required
string

A human readable label for the field.

tag
required
string

The ID used to reference the field in your emails.

fallback
string

A default value for the field, used when there is no other value available.

Responses

Request samples

Content type
application/json
{
  • "label": "What is your hometown?",
  • "tag": "Hometown",
  • "fallback": "Unknown"
}

Response samples

Content type
application/json
{
  • "label": "What is your hometown?",
  • "tag": "Hometown",
  • "type": "text",
  • "fallback": "Unknown"
}

Delete field

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

tag
required
string
Example: customer

A unique name for the tag.

Responses

Request samples

curl --request DELETE \
  --url https://api.emailoctopus.com/lists/00000000-0000-0000-0000-000000000000/fields/customer \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{}

List

A list is a collection of contacts. Every one of your contacts will exist inside a list. The majority of our users only require one list, but multiple lists can be created and configured with different fields and tags in order to organise distinct groups of contacts.

Get all lists

query Parameters
limit
integer
Default: "100"
Example: limit=100

Max number of results per page.

starting_after
string
Example: starting_after=WyIyMDI0LTEyLTA3VDE1OjAzOjAxKzAwOjAwIiwiNDYzN2RmYTAtYjZmMC0xMWVmLWFjZDYtZjU5YjA4MDFlMjBkIl0

Cursor that points to the end of the page.

Responses

Request samples

curl --request GET \
  --url https://api.emailoctopus.com/lists \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "paging": {}
}

Create list

Request Body schema: application/json
optional
name
required
string <= 255 characters

The name of the list.

Responses

Request samples

Content type
application/json
{
  • "name": "New clients list"
}

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "name": "New clients list",
  • "double_opt_in": false,
  • "fields": [
    ],
  • "tags": [
    ],
  • "counts": [
    ],
  • "created_at": "2015-12-01T12:59:37+00:00",
  • "last_updated_at": "2015-12-01T12:59:37+00:00"
}

Get list

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

Responses

Request samples

curl --request GET \
  --url https://api.emailoctopus.com/lists/00000000-0000-0000-0000-000000000000 \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "name": "New clients list",
  • "double_opt_in": false,
  • "fields": [
    ],
  • "tags": [
    ],
  • "counts": [
    ],
  • "created_at": "2015-12-01T12:59:37+00:00",
  • "last_updated_at": "2015-12-01T12:59:37+00:00"
}

Update list

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

Request Body schema: application/json
optional
name
required
string <= 255 characters

The name of the list.

Responses

Request samples

Content type
application/json
{
  • "name": "New clients list"
}

Response samples

Content type
application/json
{
  • "id": "00000000-0000-0000-0000-000000000000",
  • "name": "New clients list",
  • "double_opt_in": false,
  • "fields": [
    ],
  • "tags": [
    ],
  • "counts": [
    ],
  • "created_at": "2015-12-01T12:59:37+00:00",
  • "last_updated_at": "2015-12-01T12:59:37+00:00"
}

Delete a list

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

Responses

Request samples

curl --request DELETE \
  --url https://api.emailoctopus.com/lists/00000000-0000-0000-0000-000000000000 \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{}

Tag

Tags are list-specific labels that you can assign to contacts to categorise or segment them. Tags allow you to create personalised campaigns or trigger automations based on specific attributes or behaviours.

Get all tags

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

query Parameters
limit
integer
Default: "100"
Example: limit=100

Max number of results per page.

starting_after
string
Example: starting_after=WyIyMDI0LTEyLTEwVDEzOjIxOjQ2KzAwOjAwIiwxXQ

Cursor that points to the end of the page.

Responses

Request samples

curl --request GET \
  --url https://api.emailoctopus.com/lists/00000000-0000-0000-0000-000000000000/tags \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{}

Create tag

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

Request Body schema: application/json
optional
tag
string

The name of the tag.

Responses

Request samples

Content type
application/json
{
  • "tag": "my tag"
}

Response samples

Content type
application/json
{
  • "tag": "my tag"
}

Update tag

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

tag
required
string
Example: customer

A unique name for the tag.

Request Body schema: application/json
optional
tag
string

The name of the tag.

Responses

Request samples

Content type
application/json
{
  • "tag": "my tag"
}

Response samples

Content type
application/json
{
  • "tag": "my tag"
}

Delete tag

path Parameters
list_id
required
string
Example: 00000000-0000-0000-0000-000000000000

The ID of the list.

tag
required
string
Example: customer

A unique name for the tag.

Responses

Request samples

curl --request DELETE \
  --url https://api.emailoctopus.com/lists/00000000-0000-0000-0000-000000000000/tags/customer \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Response samples

Content type
application/json
{}