Mailrelay API Documentation
Introduction
Our API allows you to access several features of our application. It can be used to develop an integration, extend one of our features or obtain your account data.
Since it's a REST API, HTTP methods and status codes are important. Make sure that you always check the returned HTTP code in order to check if your request worked.
Getting started
Create an API key
- In your Mailrelay account, go to Settings → API keys.
- Click Add. Every API action done with the key will be attributed to its user.
- Choose when the key expires and, optionally, the IP addresses or CIDR ranges it can be used from.
- Choose its permissions: Full access, or Restricted to the areas you pick (Contacts, Email campaigns, SMS...) with a level for each one: read, write, send or delete. A key can never do more than its user's role allows.
- Copy the key and store it in a safe place. It is shown only once, so you won't be able to retrieve it later.
First request
Use GET /ping to verify that your API key is valid. A successful request returns HTTP 204.
curl -X GET --header 'X-AUTH-TOKEN: [YOUR-API-KEY]' 'https://[YOUR-ACCOUNT]/api/v1/ping'
Replace [YOUR-API-KEY] with the key you created and [YOUR-ACCOUNT] with your account domain (for example example.ipzmarketing.com).
GET /ping, GET /stats and GET /package work whatever the key's permissions. In API batches, each operation is checked against them.
Rate limiting
Limits apply per account:
| Endpoint | Limit |
|---|---|
POST /send_emails, POST /sms/send, POST /whatsapp/send |
1000 requests per minute |
/subscribers endpoints |
300 requests per minute |
| All other endpoints | 250 requests every 5 minutes |
Every response includes the state of your current window:
| Header | Description |
|---|---|
X-RateLimit-Limit |
Maximum number of requests allowed in the current window. |
X-RateLimit-Remaining |
Number of requests left in the current window. |
X-RateLimit-Reset |
Unix timestamp in seconds at which the current window ends. |
Once the limit is exceeded, requests return HTTP 429 until the window ends, together with a Retry-After header holding the number of seconds to wait. Use X-RateLimit-Remaining to slow down before that happens.
Search and filtering
List endpoints accept a q query parameter to filter and, optionally, sort the results. Each filterable field is exposed as one or more q[field_predicate] parameters:
| Predicate | Matches |
|---|---|
eq |
Equals |
cont |
Contains |
gteq |
Greater than or equal to |
lteq |
Less than or equal to |
true |
Is true |
not_true |
Is false |
Which predicates apply to a field depends on its type: text fields support eq and cont, numeric and date/time fields support eq, gteq and lteq, and boolean fields support true and not_true.
The fields you can filter by, and the predicates available for each, are listed among the parameters of every list endpoint.
Example: GET /subscribers?q[created_at_gteq]=2026-01-01T00:00:00Z&q[email_cont]=example.com returns subscribers created on or after that date whose email contains example.com. When more than one filter is given, all of them must match.
Use q[s] to order the results by a specific field. You may optionally append asc or desc to define the direction, for example q[s]=created_at desc.
- Send emails
-
A/B tests
- GET /ab_tests — Lists A/B tests
- POST /ab_tests — Add a new A/B test
- GET /ab_tests/{id} — Get an A/B test by id
- DELETE /ab_tests/{id} — Remove an A/B test
- PATCH /ab_tests/{id}/cancel — Cancel A/B test
- POST /ab_tests/{id}/choose_winning_combination — Choose which A/B test combination should be sent to the remaining subscribers
- PATCH /ab_tests/{id}/set_as_manual — Set A/B test as manual
-
Automations
- GET /automations — Lists automations
- POST /automations — Add a new automation
- GET /automations/{id} — Get an automation with its triggers and blocks
- DELETE /automations/{id} — Remove an automation
- PATCH /automations/{id} — Update an automation
- PATCH /automations/{id}/enable — Enable an automation
- PATCH /automations/{id}/disable — Disable an automation
- GET /automations/{automation_id}/blocks/{id} — Get a trigger or block of an automation
- DELETE /automations/{automation_id}/blocks/{id} — Remove a trigger or block of an automation
- PATCH /automations/{automation_id}/blocks/{id} — Update a trigger or block of an automation
- POST /automations/{automation_id}/blocks — Add triggers and blocks to an automation
-
Automation reports
- GET /automations/{id}/stats — Get the statistics of an automation
- GET /automations/{id}/report — Get the report of an automation by day or month
- GET /automations/{id}/sent_emails — Get the emails sent by an automation
- GET /automations/{id}/impressions — Get the impressions of an automation
- GET /automations/{id}/clicks — Get the clicks of an automation
- GET /automations/{id}/unsubscribe_events — Get the unsubscribe events of an automation
- GET /automations/{id}/sms_sent_messages — Get the SMS sent by an automation
- Automation activities
- Automation folders
-
Campaigns
- GET /campaigns — Lists campaigns
- POST /campaigns — Add a new campaign
- GET /campaigns/{id} — Get a campaign by id
- DELETE /campaigns/{id} — Remove a campaign
- PATCH /campaigns/{id} — Update a campaign
- POST /campaigns/{id}/send_all — Send a campaign
- POST /campaigns/{id}/send_test — Send a campaign to test emails
- Campaign folders
- Custom fields
- Imports
- Groups
-
Segments
- GET /segments — Lists segments
- POST /segments — Add a new segment
- GET /segments/{id} — Get a segment by id
- DELETE /segments/{id} — Remove a segment
- PATCH /segments/{id} — Update a segment
- GET /segments/{id}/subscribers — Lists the subscribers matching a segment
- POST /segments/{id}/create_group — Create a group from a segment
-
Media files
- GET /media_files — Lists media files
- POST /media_files — Add a new media file
- GET /media_files/trashed — List media files in trash
- GET /media_files/{id} — Get a single media file
- DELETE /media_files/{id} — Hard delete a media file
- PATCH /media_files/{id}/move_to_trash — Move media file to trash
- PATCH /media_files/{id}/restore — Restore a file that is in trash
- Media folders
-
RSS Campaigns
- GET /rss_campaigns — Lists RSS campaigns
- POST /rss_campaigns — Add a new RSS campaign
- GET /rss_campaigns/{id} — Get a RSS campaign by id
- DELETE /rss_campaigns/{id} — Remove a RSS campaign
- PATCH /rss_campaigns/{id} — Update a RSS campaign
- GET /rss_campaigns/{id}/processed_entries — Get RSS campaign's processed entries
- Senders
-
Sent campaigns
- GET /sent_campaigns — Lists sent campaigns
- GET /sent_campaigns/{id} — Get a single sent campaign
- GET /sent_campaigns/{id}/clicks — Get sent campaign's clicks
- GET /sent_campaigns/{id}/impressions — Get sent campaign's impressions
- GET /sent_campaigns/{id}/sent_emails — Get sent campaign's sent emails
- GET /sent_campaigns/{id}/unsubscribe_events — Get sent campaign's unsubscribe events
- PATCH /sent_campaigns/{id}/pause — Pause a campaign that is being sent
- PATCH /sent_campaigns/{id}/resume — Resume a campaign that is paused
- PATCH /sent_campaigns/{id}/cancel — Cancel a campaign
- SignupForms
- SMTP emails
- SMTP tags
-
Subscribers
- GET /subscribers — Get subscribers
- POST /subscribers — Add a new subscriber
- GET /subscribers/{id} — Get a subscriber by id
- DELETE /subscribers/{id} — Remove a subscriber
- PATCH /subscribers/{id} — Update a subscriber
- POST /subscribers/{id}/resend_confirmation_email — Resend confirmation email to an inactive subscriber
- PATCH /subscribers/{id}/ban — Ban a subscriber
- PATCH /subscribers/{id}/unban — Unban a subscriber
- GET /subscribers/deleted — Get deleted subscribers
- PATCH /subscribers/{id}/restore — Restore a deleted subscriber
- POST /subscribers/sync — Create or update a subscriber
- PATCH /subscribers/bulk_update — Bulk update subscribers
- GET /subscribers/{subscriber_id}/tags — Lists a subscriber's tags
- PUT /subscribers/{subscriber_id}/tags — Replace a subscriber's tags
- POST /subscribers/{subscriber_id}/tags — Add tags to a subscriber
- DELETE /subscribers/{subscriber_id}/tags — Remove tags from a subscriber
- Tags
- Unsubscribe events
- Bounces
- General
- API batches
-
Event Subscriptions
- GET /event_subscriptions — Lists event subscriptions
- POST /event_subscriptions — Add a new event subscription
- GET /event_subscriptions/{id} — Get an event subscription by id
- DELETE /event_subscriptions/{id} — Remove an event subscription
- PATCH /event_subscriptions/{id} — Update an event subscription
- Send transactional SMS
- SMS campaigns
-
SMS sent campaigns
- GET /sms/sent_campaigns — Lists SMS sent campaigns
- GET /sms/sent_campaigns/{id} — Get a single SMS sent campaign
- GET /sms/sent_campaigns/{id}/sent_messages — Get SMS sent campaign's sent messages
- GET /sms/sent_campaigns/{id}/unsubscribe_events — Get SMS sent campaign's unsubscribe events
- PATCH /sms/sent_campaigns/{id}/pause — Pause a SMS campaign that is being processed
- PATCH /sms/sent_campaigns/{id}/resume — Resume a SMS campaign that is paused
- PATCH /sms/sent_campaigns/{id}/cancel — Cancel a SMS campaign
- SMS sent messages
- Ecommerce Stores
-
Ecommerce Product Categories
- GET /ecommerce/stores/{store_id}/product_categories — Lists product categories
- POST /ecommerce/stores/{store_id}/product_categories — Add a new product category
- GET /ecommerce/stores/{store_id}/product_categories/{id} — Get a product category by id
- DELETE /ecommerce/stores/{store_id}/product_categories/{id} — Remove a product category from a store
- PATCH /ecommerce/stores/{store_id}/product_categories/{id} — Update a product category
- POST /ecommerce/stores/{store_id}/product_categories/sync — Create or update a product category
-
Ecommerce Products
- GET /ecommerce/stores/{store_id}/products — Lists products
- POST /ecommerce/stores/{store_id}/products — Add a new product
- GET /ecommerce/stores/{store_id}/products/{id} — Get a product by id
- DELETE /ecommerce/stores/{store_id}/products/{id} — Remove a product
- PATCH /ecommerce/stores/{store_id}/products/{id} — Update a product
- POST /ecommerce/stores/{store_id}/products/sync — Create or update a product
-
Ecommerce Carts
- GET /ecommerce/stores/{store_id}/carts — Lists carts
- POST /ecommerce/stores/{store_id}/carts — Add a new cart
- GET /ecommerce/stores/{store_id}/carts/{id} — Get a cart by id
- DELETE /ecommerce/stores/{store_id}/carts/{id} — Remove a cart
- PATCH /ecommerce/stores/{store_id}/carts/{id} — Update a cart
- POST /ecommerce/stores/{store_id}/carts/sync — Create or update a cart
- Send transactional WhatsApp messages
- WhatsApp Phone Numbers
-
WhatsApp Templates
- GET /whatsapp/templates — Lists WhatsApp templates
- POST /whatsapp/templates — Create a new WhatsApp template
- GET /whatsapp/templates/{id} — Get a WhatsApp template by id
- DELETE /whatsapp/templates/{id} — Delete a WhatsApp template
- PATCH /whatsapp/templates/{id} — Update a WhatsApp template
- POST /whatsapp/templates/{id}/submit_for_approval — Submit template for approval
-
WhatsApp campaigns
- GET /whatsapp/campaigns — Lists WhatsApp campaigns
- POST /whatsapp/campaigns — Add a new WhatsApp campaign
- GET /whatsapp/campaigns/{id} — Get WhatsApp campaign by id
- DELETE /whatsapp/campaigns/{id} — Remove WhatsApp campaign
- PATCH /whatsapp/campaigns/{id} — Update WhatsApp campaign
- POST /whatsapp/campaigns/{id}/send_all — Send WhatsApp campaign
-
WhatsApp sent campaigns
- GET /whatsapp/sent_campaigns — Lists WhatsApp sent campaigns
- GET /whatsapp/sent_campaigns/{id} — Get a single WhatsApp sent campaign
- GET /whatsapp/sent_campaigns/{id}/sent_messages — Get WhatsApp sent campaign's sent messages
- PATCH /whatsapp/sent_campaigns/{id}/pause — Pause a WhatsApp campaign that is being sent
- PATCH /whatsapp/sent_campaigns/{id}/resume — Resume a WhatsApp campaign that is paused
- PATCH /whatsapp/sent_campaigns/{id}/cancel — Cancel a WhatsApp campaign
- WhatsApp sent messages
- Connect an assistant
- Permissions & tools
- What you can ask
- Troubleshooting & FAQ