Mailshake MCP
MCP server URL
https://api.mailshake.com/mcp
Claude Code: connect with OAuth sign-in
claude mcp add --transport http mailshake https://api.mailshake.com/mcp
Or connect with your API key
claude mcp add --transport http mailshake https://api.mailshake.com/mcp \
--header "Authorization: Bearer $MAILSHAKE_API_KEY"
// Any MCP client that speaks Streamable HTTP can connect.
// Point it at the URL and sign in when it asks:
// https://api.mailshake.com/mcp
// Clients that take a header can send your API key instead:
// Authorization: Bearer <your API key>
The Mailshake MCP server lets AI assistants such as Claude and Grok, and the agents you build, work in your Mailshake account. Ask your assistant in plain words to list your campaigns, add recipients, check stats, work your leads or draft replies, and it calls Mailshake for you.
Connect your assistant
The server speaks the Model Context Protocol over Streamable HTTP at https://api.mailshake.com/mcp.
- OAuth sign-in (recommended for chat apps). Add the URL as a connector. Your assistant opens a Mailshake page where you sign in and choose what it may do. You never paste an API key into a chat.
- API key (scripts, CLIs and agent builds). Send
Authorization: Bearer <your API key>with each request. An API key carries every scope, so give it only to an agent you would let do everything the key can.
In Claude.ai and Claude Desktop, open Customize → Connectors, choose Add custom connector, enter the URL and approve the sign-in. On Team and Enterprise plans an Owner adds the connector once under Organization settings → Connectors, and each member then connects their own Mailshake account. Disconnect at any time from your assistant’s connector settings; that revokes the connection.
What the assistant can do
Almost every API operation documented below is an MCP tool, named after the operation (campaigns_list, recipients_add, leads_close and so on) with exactly the same fields. The exceptions are me and push/rotate-secret, so a signing secret never passes through an assistant.
Read tools only read. Every tool respects the scopes you granted and your rate limits, and only ever sees your own team.
Changes need your confirmation
Every tool that changes something works in two steps:
- The assistant calls it and gets a preview of exactly what would happen. Nothing changes yet.
- Only after you agree does it call again with
confirm: trueand the preview’s confirmation token. The token is valid for 10 minutes, and only for those exact arguments, your team and your connection.
Large changes (more than 100 recipients or 25 leads) are called out in the preview. A confirmed change that is retried is not done twice. The server refuses unconfirmed changes, even from assistants that don’t pause for approval on their own.
Changes that email people need you
Sending a reply, starting a campaign, editing a running campaign’s emails, and adding, removing, pausing, resuming, unsubscribing or resubscribing prospects can email people or change who receives mail. For these, the assistant’s confirmation is never enough. The assistant gives you a link; open it while signed in to Mailshake, review the change and approve it. The link works once, for 10 minutes, and only for that exact change.
Safety
- Emails and replies can contain text meant to steer an AI (“ignore your instructions and…”). The confirmation step means such text can never make a change on its own, and changes that email people always need your own approval.
- With OAuth sign-in, sending replies and spending Data Finder credits are never granted unless you tick them on the sign-in page.
Introduction
API Endpoint
https://api.mailshake.com/2017-04-01
// Install our node package
npm install mailshake-node --save
// See source here
https://github.com/mailshake/mailshake-node
The Mailshake API lets your software work with your Mailshake campaigns, recipients, leads, replies, activity, sending mailboxes and webhooks. It is the same API the Mailshake MCP tools use, so anything an assistant can do in Mailshake, your code can do too. If you notice a typo or have a suggestion for this documentation, contact us.
Every response is JSON. Reads are documented as GET and writes as POST, but every operation answers either method. Each team has its own hourly quota based on its Mailshake subscription; see limits.
A plain-text index of the API for AI tools is at llms.txt, and the full machine-readable description is at openapi.json (OpenAPI 3.1).
Getting your API key
To get your API key, go to the Extensions > API page in Mailshake and create your key. Keep it secret: it acts as your team’s admin. If your team needs higher limits, contact us to request an increase.
Making requests
Send your API key as a Bearer token. This is the recommended form:
Authorization: Bearer <your API key>
The older forms (HTTP Basic with the key as the username, or an apiKey parameter) still work but are deprecated. Apps that act for other Mailshake teams use OAuth 2 and send their access token in the same Authorization: Bearer header.
Parameters can go in the query string, a JSON body (Content-Type: application/json) or a form body (Content-Type: application/x-www-form-urlencoded). Writes accept an Idempotency-Key header so a retried request is not done twice.
See authentication for examples, errors for the error format and limits for your quota and the rate-limit headers.
Responses
Single-item responses will be in this format:
{
"object": "campaign",
"id": 1,
"title": "My campaign",
"created": "2017-08-19T02:31:22.218Z"
}
Most endpoints return a single model of data. Check out our models section for specific examples and be sure to check out the errors section section, too.
Pagination
Paginated data will look like this:
{
"nextToken": "...",
"results": [
{ ... },
{ ... }
]
}
Get the next page of data like so:
mailshake.campaigns.list()
.then(result => {
console.log(`Page 1: ${JSON.stringify(result.results, null, 2)}`);
// Just call `next` on the result to fetch the next page.
return result.next();
})
.then(result => {
console.log(`Page 2: ${JSON.stringify(result.results, null, 2)}`);
});
curl "https://api.mailshake.com/2017-04-01/campaigns/list" \
-u "my-api-key:" \
-d nextToken=...
Endpoints that return multiple results will include a nextToken parameter that you can pass into another request to fetch the next results. These endpoints will also accept a perPage parameter to control the size of the record sets.
If nextToken is null then you’re looking at the last page of data.
Versioning
As we develop future versions of our API that are not backwards-compatible, we will leave the old version running and create a new url for the latest version. We will retain support for obsolete versions for a generous period of time and will send email notifications of any changes.
Current version:https://api.mailshake.com/2017-04-01
Future version format:https://api.mailshake.com/XXXX-YY-ZZ
Authentication
Most of the apps authorized to use the Mailshake API can only access their own team’s data. For these apps, you can use our simple authentication. Any app can use our OAuth version 2 authentication.
Simple
var mailshake = require('mailshake-node')('my-api-key');
mailshake.me()
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl uses the -u flag to pass basic auth credentials
(adding a colon after your API key prevents cURL from asking for a password).
curl "https://api.mailshake.com/2017-04-01/me" \
-u "my-api-key:"
Simply include your API key as a querystring parameter (apiKey), part of your body json (apiKey), or via an http Authorization header that looks like:
Authorization: Basic [base-64 encoded version of your api key]
Make sure to replace
my-api-keywith your API key.
OAuth2
// mailshake-node has hooks to support most any OAuth library.
// You can either customize the request with `customizeRequest`
// or outright replace how the request is made with `overrideCreateRequest`
var mailshake = require('mailshake-node')({
customizeRequest(options) => {
// options.headers.authorization = [...oauth header...]
return options;
}),
// or
overrideCreateRequest(options, callbackFn) => {
// Create a standard node request via an OAuth tool
// Something that looks like this:
return https(options, callbackFn);
})
});
If your app has been approved as a 3rd-party app (one in which you can access other users’ data instead of limited of just your own team), you must use OAuth V2 to integrate with us. We’ll deliver your consumer key and secret to you manually. The other applicable OAuth settings are below:
Authorization
Authorization URL: https://app.mailshake.com/oauth/
Request Parameters
Include the following parameters as part of the query string of the authorization URL:
| Parameter | Description |
|---|---|
response_type=code |
Tells us that you are expecting to receive an authorization code |
client_id |
The client ID for your application |
redirect_uri |
The URI to send the user to after authorization is complete, must match a URI listed for your application |
scope |
One or more scope values (see below) indicating which parts of the user’s account you need access to |
state |
A random string generated by your application, which will be passed to the redirect_ui |
OAuth Scope
Specify the OAuth scope to tell customers what permissions you’re requesting. Specify the scopes in a comma-delimited string like so: campaign-read,campaign-write
| Scope | Description |
|---|---|
| campaign-read | Grants read access to all operations. |
| campaign-write | Grants write access to all operations. |
Response Parameters
Upon successful authorization, the user will be redirected to your redirect_uri with the following query string parameters:
| Parameter | Description |
|---|---|
code |
The authorization code |
state |
The same state value you passed to the authorization URL |
Getting an Access Token
Access token URL: https://api.mailshake.com/2017-04-01/token
Request Parameters
POST the following parameters to the access token URL:
| Parameter | Description |
|---|---|
grant_type=authorization_code |
Tells us that you are expecting to receive an authorization code |
client_id |
The client ID for your application |
client_secret |
The client secret for your application |
code |
The code you obtained from the authorization URL |
redirect_uri |
The same redirect URI passed to the authorization URL |
Response Properties
The response from the access token URL will be in JSON with the following properties:
| Property | Description |
|---|---|
access_token |
The token that can be used to be future requests |
refresh_token |
The token that can be used to obtain a new access token |
Refreshing an Access Token
Refresh token URL: https://api.mailshake.com/2017-04-01/token
Request Parameters
POST the following parameters to the refresh token URL:
| Parameter | Description |
|---|---|
grant_type=refresh_token |
Tells us that you are refreshing a token |
client_id |
The client ID for your application |
client_secret |
The client secret for your application |
refresh_token |
The refresh token you obtained from the access token URL |
redirect_uri |
The same redirect URI passed to the authorization URL |
Response Properties
The response from the access token URL will be in JSON with the following properties:
| Property | Description |
|---|---|
access_token |
The new token that can be used to be future requests |
Test connection
mailshake.me()
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/me" \
-u "my-api-key:"
This endpoint returns a simple object with a User model attached.
{
"user": "[User model]"
}
You can hit our /me endpoint to test that authentication is working. It will return information about the current user you are authenticating as.
Campaigns
List
mailshake.campaigns.list({
search: 'Venkman'
})
.then(result => {
result.results.forEach(campaign => {
console.log(JSON.stringify(campaign, null, 2));
});
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/campaigns/list" \
-u "my-api-key:" \
-d search=Venkman
List all of a team’s campaigns.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| search | No | Filters what campaigns are returned. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
Get
mailshake.campaigns.get({
campaignID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/campaigns/get" \
-u "my-api-key:" \
-d campaignID=1
This endpoint returns a Campaign model.
Retrieves a single campaign and its message sequence. A not_found error will be returned if the campaign could not be found.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The ID of the campaign. |
Create
mailshake.campaigns.create({
title: 'My campaign'
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/campaigns/create" \
-u "my-api-key:" \
-d title="My campaign"
This endpoint returns a Campaign model.
Creates a new campaign. This campaign cannot be sent until the user finishes the wizard in Mailshake’s user interface, but you can add recipients.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| title | [Month] [Day] Outreach |
No | A title to give to the campaign. |
| senderID | No | The id of the sender to use for this campaign. |
Pause
mailshake.campaigns.pause({
campaignID: 1
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/campaigns/pause" \
-u "my-api-key:" \
-d campaignID=1
This endpoint returns an empty response.
Immediately pauses all sending for a campaign. If a batch of emails for this campaign is currently being sent they will not be stopped.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to pause. |
Unpause
mailshake.campaigns.unpause({
campaignID: 1
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/campaigns/unpause" \
-u "my-api-key:" \
-d campaignID=1
This endpoint returns an empty response.
Resumes sending for a campaign. This team’s sending calendar will reschedule itself to account for this campaign’s pending emails. In rare cases it may take up to 5 minutes for the calendar to show scheduled times for this campaign.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to unpause. |
Export
mailshake.campaigns.export({
campaignIDs: [1, 2, 3],
exportType: 'simple',
timezone: 'America/Indianapolis'
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/campaigns/export" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-X POST -d '{"campaignIDs":[1, 2, 3], "exportType": "simple", "timezone": "America/Indianapolis"}'
This endpoint returns a CampaignExportRequest model.
Asynchronously starts an export of one or more campaigns to CSV format. All campaign data will be included in a single csv file you can download.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignIDs | Yes* | An array of campaign IDs to export. | |
| exportType | Yes | The type of export to perform (see below). | |
| timezone | UTC | No | The timezone that dates in the export should be based in. |
Export types
| Type | Description |
|---|---|
| simple | Recipient-based export, listing each recipient (per campaign) on a single row. |
show-each-message |
Export based on sent messages, listing every sent email and related stats on a single row. |
| unsubscribes | An export of all the unsubscribed email addresses for your team. |
ExportStatus
mailshake.campaigns.exportStatus({
statusID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/campaigns/export-status" \
-u "my-api-key:" \
-d statusID=1
This endpoint returns a CampaignExport model.
Exporting campaigns is an asynchronous process, so this endpoint lets you check on how things are going. If isFinished is true, then the export has completed. The csvDownloadUrl field provides the csv file you can download.
Update
curl "https://api.mailshake.com/2017-04-01/campaigns/update" \
-u "my-api-key:" \
-d campaignID=1 \
-d title="Venkman Outreach" \
-d trackLinks=false
This endpoint returns:
{
"campaignID": 1,
"title": "Venkman Outreach",
"trackOpens": true,
"trackLinks": false
}
Renames a campaign or turns open and link tracking on or off. Only the fields you send change; everything else about the campaign (assignee, mail accounts, from name, sequence) stays as it is. The response shows the campaign after the change. Timezone and the unsubscribe link can’t be changed here.
Send at least one of title, trackOpens or trackLinks; a call with none of them answers missing_parameter. A campaign of another team, or one that doesn’t exist, answers not_found (HTTP 404).
Requires the campaigns:write scope (the legacy campaign-write scope also grants it).
Costs 5 quota units.
Supports the Idempotency-Key header.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to change. | |
| title | unchanged | No | The new title, 1 to 255 characters after trimming spaces. A blank title answers invalid_argument. |
| trackOpens | unchanged | No | true or false (1/0 also work). Anything else answers invalid_argument. |
| trackLinks | unchanged | No | true or false (1/0 also work). Anything else answers invalid_argument. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing, or none of title, trackOpens, trackLinks was sent. |
| invalid_argument | 400 | campaignID isn’t a positive whole number, title is blank or over 255 characters, or a tracking value isn’t true/false. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have campaigns:write. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Archive
curl "https://api.mailshake.com/2017-04-01/campaigns/archive" \
-u "my-api-key:" \
-d campaignID=1
This endpoint returns:
{
"campaignID": 1,
"isArchived": true,
"isPaused": true
}
Archives a campaign and pauses it, the same as archiving it in the app. There is no delete operation; archive is the way to retire a campaign.
Archiving a campaign that is already archived answers invalid_state.
Requires the campaigns:write scope (the legacy campaign-write scope also grants it).
Costs 5 quota units.
Supports the Idempotency-Key header.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to archive. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing. |
| invalid_argument | 400 | campaignID isn’t a positive whole number. |
| invalid_state | 400 | The campaign is already archived. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have campaigns:write. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Unarchive
curl "https://api.mailshake.com/2017-04-01/campaigns/unarchive" \
-u "my-api-key:" \
-d campaignID=1
This endpoint returns:
{
"campaignID": 1,
"isArchived": false,
"isPaused": true
}
Brings an archived campaign back. Unlike unarchiving in the app, the campaign stays paused: nothing sends until you resume it with campaigns/unpause.
Unarchiving a campaign that isn’t archived changes nothing and is not an error; the response shows its current isPaused.
Requires the campaigns:write scope (the legacy campaign-write scope also grants it).
Costs 5 quota units.
Supports the Idempotency-Key header.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to unarchive. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing. |
| invalid_argument | 400 | campaignID isn’t a positive whole number. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have campaigns:write. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Duplicate
curl "https://api.mailshake.com/2017-04-01/campaigns/duplicate" \
-u "my-api-key:" \
-d campaignID=1 \
-d title="Venkman Outreach (December)"
This endpoint returns:
{
"campaignID": 2
}
Copies a campaign into a new one in the same team, the same way as duplicating it in the app. The copy gets the original’s sequence, mail accounts (including a rotation), from name, assignee, lead catcher settings and connected apps. Recipients are not copied. The response is the new campaign’s ID; use campaigns/get to read it.
Without title, the copy is named <original title> Copy, or <original title> Copy (2), (3) and so on when copies already exist.
The copy starts unpaused when the original has a mail account, as in the app; it has no recipients, so it sends nothing until you add some.
An archived campaign can’t be duplicated (unarchive it first), and neither can a campaign on an outdated system version; both answer invalid_state.
Requires the campaigns:write scope (the legacy campaign-write scope also grants it).
Costs 10 quota units.
Supports the Idempotency-Key header. Send one if you may retry, so a retry doesn’t make a second copy.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to copy. | |
| title | <original title> Copy |
No | The new campaign’s title, 1 to 255 characters after trimming spaces. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing. |
| invalid_argument | 400 | campaignID isn’t a positive whole number, or title is blank or over 255 characters. |
| invalid_state | 400 | The campaign is archived, or uses an outdated system version. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have campaigns:write. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Get sequence
curl "https://api.mailshake.com/2017-04-01/campaigns/get-sequence" \
-u "my-api-key:" \
-d campaignID=1
This endpoint returns:
{
"object": "sequence",
"campaignID": 1,
"segments": [
{
"segment": "A",
"steps": [
{
"stepID": "m:9001",
"kind": "message",
"type": "initial",
"subject": "Quick question, {{first}}",
"body": "<p>Hi {{first}},</p><p>Do you have ten minutes this week?</p>",
"isLocked": false,
"sentCount": 120
},
{
"stepID": "m:9002",
"kind": "message",
"type": "follow-up",
"subject": "Re: Quick question, {{first}}",
"body": "<p>Just bumping this up, {{first}}.</p>",
"delayDays": 3,
"cancelOn": "reply",
"isLocked": false,
"sentCount": 85
},
{
"stepID": "t:310",
"kind": "task",
"type": "task",
"delayDays": 2,
"taskType": "Phone Call",
"isLocked": false,
"sentCount": 12
}
]
}
]
}
Reads a campaign’s sequence: every segment (A/B test variant) and its steps in order. Email steps have a type of initial, follow-up, drip or click; tasks have kind and type task.
A wait between steps is not a step of its own: it is the delayDays field of the step that comes after it. A follow-up with no subject of its own goes out as a reply in the same thread, and its subject shows as Re: <initial subject>.
Step IDs are m:<id> for emails and t:<id> for tasks. Use the m:<id> values with Update sequence (below).
| Field | Description |
|---|---|
| stepID | m:<id> for an email, t:<id> for a task. |
| kind | message or task. |
| type | initial, follow-up, drip, click or task. |
| subject, body | The email’s subject and HTML body (emails only). |
| delayDays | Days to wait before this step. Left out when there is no wait. |
| cancelOn | Emails only, when set: the recipient action that stops this email (reply, open, reply-or-open or lead). |
| taskType | Tasks only: the kind of task, for example General or Phone Call. |
| isLocked | Whether the step is locked in the app. Locked steps can’t be changed by Update sequence. |
| sentCount | Emails: how many were sent. Tasks: how many recipients completed it. |
Requires the campaigns:read scope (the legacy campaign-read scope also grants it).
Costs 2 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign whose sequence to read. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing. |
| invalid_argument | 400 | campaignID isn’t a number. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have campaigns:read. |
Update sequence
curl "https://api.mailshake.com/2017-04-01/campaigns/update-sequence" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: seq-edit-2026-11-13-001" \
-d '{
"campaignID": 1,
"segment": "A",
"steps": [
{
"stepID": "m:9001",
"type": "initial",
"subject": "Quick question, {{first}}",
"body": "<p>Hi {{first}},</p><p>Do you have ten minutes next week?</p>"
},
{
"type": "follow-up",
"body": "<p>Following up on my note, {{first}}.</p>",
"delayDays": 4
}
],
"confirm": true
}'
This endpoint returns:
{
"object": "sequence",
"campaignID": 1,
"segments": [
{
"segment": "A",
"steps": [
{
"stepID": "m:9001",
"kind": "message",
"type": "initial",
"subject": "Quick question, {{first}}",
"body": "<p>Hi {{first}},</p><p>Do you have ten minutes next week?</p>",
"isLocked": false,
"sentCount": 120
},
{
"stepID": "m:9003",
"kind": "message",
"type": "follow-up",
"subject": "Re: Quick question, {{first}}",
"body": "<p>Following up on my note, {{first}}.</p>",
"delayDays": 4,
"isLocked": false,
"sentCount": 0
}
]
}
],
"regenerationQueued": true,
"applied": {
"campaignID": 1,
"segment": "A",
"create": [
{ "index": 1, "type": "follow-up" }
],
"update": ["m:9001"],
"delete": ["m:9002"]
}
}
On a running campaign without
"confirm": true, nothing changes and the answer (HTTP 400) is:
{
"code": "confirmation_required",
"error": "This campaign is running: repeat the call with \"confirm\": true to apply these changes",
"time": "2026-11-13T15:04:05.000Z",
"data": {
"preview": {
"campaignID": 1,
"segment": "A",
"create": [
{ "index": 1, "type": "follow-up" }
],
"update": ["m:9001"],
"delete": ["m:9002"]
}
},
"requestId": "6f1c2a9e-0b7d-4c1e-9a55-3d2f8e7b1c40"
}
Replaces the email steps of one segment: the initial email and its follow-ups. steps is the full list you want, in order:
- A step with a
stepIDupdates that email (subject, body and, for a follow-up,delayDays). - A step without a
stepIDis a new email, placed right after the step before it in your list. - An existing email you leave out of the list is deleted.
Tasks, drip steps and click steps are not touched and can’t be set here. When the changes are saved the campaign is regenerated once, so recipients’ queued emails follow the new sequence; the response is the sequence after the change (as in Get sequence) plus applied, the list of steps created, updated and deleted.
Rules (a break answers invalid_argument; when it is about one step, the message starts with steps[<n>]: and data.stepIndex is that step’s position):
- Exactly one
initialstep, and it comes first. If the segment already has an initial email, list it with itsstepID. - Every step needs a
body. The initial email needs asubject. A follow-up without asubjectgoes as a reply in the same thread. - Follow-ups need
delayDays, a whole number from 1 to 30. - At most 10 email steps.
- A step keeps its type: an existing initial can’t become a follow-up, or the other way round. Each
stepIDis listed once. - Existing steps stay in their current order. Reordering is not supported here.
- Merge fields such as
{{company}}must exist on the campaign’s recipients. A campaign with no recipients yet accepts any merge field. {{account}}is saved as{{company}}, the merge field that holds the recipient’saccountfrom Add recipients. A fallback stays:{{account:there}}becomes{{company:there}}. If your team has its own field namedaccount,{{account}}stays as written.segmentmust be one the campaign already has. A wrong segment never creates a new A/B variant.
A step that is locked in the app can’t be updated or deleted: the call answers invalid_state with the step in data.stepID, and nothing changes.
A campaign is running when it is neither paused nor archived. Editing a running campaign changes emails that are about to go out, so the call needs "confirm": true. Without it, nothing changes and the answer is confirmation_required with a preview of the changes in data.preview. Check the preview, then repeat the same call with "confirm": true. Paused and archived campaigns don’t need confirm.
Only one sequence change runs on a campaign at a time; a second one at the same moment answers invalid_state and can be retried shortly after.
Requires the campaigns:write scope (the legacy campaign-write scope also grants it).
Costs 10 quota units.
Supports the Idempotency-Key header. A retry with the same key and request returns the first answer instead of editing again.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to change. | |
| segment | A |
No | The segment (A/B variant) to change. |
| steps | Yes | The email steps, in order: a list of objects with stepID (to keep an existing email), type (initial or follow-up), subject, body and delayDays (follow-ups). In a form or query-string body, send the list as a JSON string. |
|
| personalizations | leave |
No | What happens to emails you customized for single recipients in the app when their step changes: leave keeps those customizations, overwrite drops them so those recipients get the new text. |
| confirm | false |
No | Must be true to change a running campaign. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID or steps is missing. |
| invalid_argument | 400 | A rule above is broken, steps isn’t a list (or valid JSON), segment is unknown, or personalizations isn’t leave or overwrite. |
| confirmation_required | 400 | The campaign is running and confirm isn’t true. data.preview lists the changes. |
| invalid_state | 400 | A step you would change or delete is locked (data.stepID), or another sequence change on this campaign is in progress. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have campaigns:write. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Create with sequence
curl "https://api.mailshake.com/2017-04-01/campaigns/create-with-sequence" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: create-venkman-2026-11-13" \
-d '{
"title": "Venkman Outreach",
"senders": [
{ "integrationID": 555 },
{ "integrationID": 556, "senderID": 78 }
],
"sequence": {
"initial": {
"subject": "Quick question, {{first}}",
"body": "<p>Hi {{first}},</p><p>Do you have ten minutes this week?</p>"
},
"followUps": [
{ "body": "<p>Just bumping this up, {{first}}.</p>", "delayDays": 3 },
{ "subject": "One last note", "body": "<p>Last note from me, {{first}}.</p>", "delayDays": 5 }
]
},
"settings": { "trackOpens": true, "trackLinks": false }
}'
This endpoint returns:
{
"campaignID": 3,
"sequence": {
"object": "sequence",
"campaignID": 3,
"segments": [
{
"segment": "A",
"steps": [
{
"stepID": "m:9101",
"kind": "message",
"type": "initial",
"subject": "Quick question, {{first}}",
"body": "<p>Hi {{first}},</p><p>Do you have ten minutes this week?</p>",
"isLocked": false,
"sentCount": 0
},
{
"stepID": "m:9102",
"kind": "message",
"type": "follow-up",
"subject": "Re: Quick question, {{first}}",
"body": "<p>Just bumping this up, {{first}}.</p>",
"delayDays": 3,
"isLocked": false,
"sentCount": 0
},
{
"stepID": "m:9103",
"kind": "message",
"type": "follow-up",
"subject": "One last note",
"body": "<p>Last note from me, {{first}}.</p>",
"delayDays": 5,
"isLocked": false,
"sentCount": 0
}
]
}
]
}
}
Creates a complete campaign in one call: its title, the mail accounts it sends from, and its email sequence (the initial email and up to 9 follow-ups). The campaign is always created paused, so nothing sends until you add recipients and resume it with campaigns/unpause. The response is the new campaign’s ID and its sequence, in the same shape as Get sequence.
This operation requires an Idempotency-Key header (1 to 64 printable characters); without one it answers missing_parameter. A retry with the same key and the same request returns the first answer (with the header Idempotent-Replayed: true) instead of creating a second campaign. Keys are kept for 24 hours.
With more than one entry in senders, the campaign rotates between those mail accounts. Without senders, it uses the team’s oldest mail account that can send (not disconnected or disabled); if the team has none, the campaign is created without a mail account and you can add one later with campaigns/set-senders.
The sequence follows the rules of Update sequence: follow-up delayDays from 1 to 30, at most 10 emails in all. A follow-up without a subject goes as a reply in the same thread. Merge fields aren’t checked, since the new campaign has no recipients yet. As in Update sequence, {{account}} is saved as {{company}}.
If any part fails (for example a mail account that can’t be used), the campaign created so far is removed, so a failed call leaves no campaign behind. A mail account of another team answers not_found.
Requires the campaigns:write scope (the legacy campaign-write scope also grants it).
Costs 20 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| title | <Month Day> Outreach |
No | The campaign’s title, for example November 13 Outreach. |
| senders | the team’s first mail account that can send | No | Up to 50 mail accounts: a list of objects with integrationID and, optionally, senderID (an alias on that mail account; defaults to the mail account’s first sender). Each mail account must be connected and enabled. |
| sequence | Yes | An object with initial (subject and body, both required) and optionally followUps, a list of up to 9 objects with body and delayDays (required) and subject (optional). |
|
| settings | No | An object with trackOpens and/or trackLinks (true or false). Left out, the campaign gets Mailshake’s defaults. |
|
| isAIGenerated | false |
No | Marks the campaign as written with AI. |
In a form or query-string body, send sequence, senders and settings as JSON strings.
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | The Idempotency-Key header is missing, or sequence, sequence.initial, its subject or body, a follow-up’s body, or a sender’s integrationID is missing. |
| invalid_argument | 400 | The Idempotency-Key isn’t 1 to 64 printable characters, a follow-up’s delayDays isn’t a whole number from 1 to 30, there are more than 10 emails, a JSON field can’t be parsed, or a mail account can’t be used (disconnected, disabled, a rotation stand-in, a senderID not on that mail account, or more than 50). |
| not_found | 404 | A mail account in senders doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have campaigns:write. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Campaign senders
A campaign sends from one mailbox (single mode) or rotates between 2 to 50 mailboxes (rotation mode). In rotation, each email goes out from the next healthy mailbox in turn; every mailbox gets an equal share (rotation is not weighted). You can change a campaign’s mailboxes while it is running: the change applies within minutes, as the campaign regenerates its schedule. A campaign must always keep at least one mailbox, so the API refuses to remove the last one. If a campaign’s last mailbox is deleted from the team, Mailshake pauses the campaign. Mailboxes are named by their integrationID (see Senders).
List senders
curl "https://api.mailshake.com/2017-04-01/campaigns/list-senders" \
-u "my-api-key:" \
-d campaignID=1
This endpoint returns:
{
"object": "campaign-senders",
"campaignID": 1,
"mode": "rotation",
"senders": [
{
"integrationID": 555,
"senderID": 77,
"emailAddress": "ash@example-domain.com",
"fromName": "Ash Example",
"type": "EmailProtocols",
"needsReauth": false,
"isDisabled": false,
"dailyCap": 100,
"sentToday": 42,
"status": "active"
},
{
"integrationID": 556,
"senderID": 78,
"emailAddress": "sky@example-domain.com",
"fromName": "Sky Example",
"type": "Google",
"needsReauth": false,
"isDisabled": false,
"dailyCap": 50,
"sentToday": 50,
"status": "auto-paused"
}
]
}
Lists the mailboxes that send a campaign. mode is single, rotation, or none (the campaign has no mailbox yet).
For each mailbox:
typeis the mailbox kind:Google,MicrosoftorEmailProtocols(SMTP/IMAP).needsReauthis true when the mailbox must be reconnected before it can send.dailyCapis the mailbox’s daily sending limit, ornullif it has no schedule.sentTodaycounts emails sent from the mailbox since midnight UTC, across all campaigns.statusisactive, orauto-pausedwhen an automatic action (see Automatic action rules) took the mailbox out of this campaign’s rotation.
Requires the campaigns:read scope (legacy: campaign-read).
Costs 2 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The ID of the campaign. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing. |
| invalid_argument | 400 | campaignID isn’t a positive whole number. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have campaigns:read. |
Set senders
curl "https://api.mailshake.com/2017-04-01/campaigns/set-senders" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"campaignID": 1,
"senders": [
{ "integrationID": 555 },
{ "integrationID": 556, "senderID": 78 }
]
}'
This endpoint returns:
{
"object": "campaign-senders",
"campaignID": 1,
"mode": "rotation",
"senders": [
{
"integrationID": 555,
"senderID": 77,
"emailAddress": "ash@example-domain.com",
"fromName": "Ash Example",
"type": "EmailProtocols",
"needsReauth": false,
"isDisabled": false,
"dailyCap": 100,
"sentToday": 42,
"status": "active"
},
{
"integrationID": 556,
"senderID": 78,
"emailAddress": "sky@example-domain.com",
"fromName": "Sky Example",
"type": "Google",
"needsReauth": false,
"isDisabled": false,
"dailyCap": 50,
"sentToday": 12,
"status": "active"
}
],
"regenerationQueued": true,
"threadsChangingSender": 3
}
Replaces all of a campaign’s mailboxes with the list you send. Two or more mailboxes make it a rotation; one makes it single. An empty list is refused. If the same integrationID appears twice, it is used once.
The answer is the new list of mailboxes (as in List senders), plus:
regenerationQueued: alwaystrue; the campaign regenerates its schedule to use the new mailboxes.threadsChangingSender: how many recipients last heard from a mailbox you removed and still have steps to send. Their follow-ups will come from another mailbox.
Mailboxes you add must be connected and enabled. A mailbox already on the campaign that needs reconnecting does not block the change. A mailbox that stays on the campaign keeps its auto-paused status, unless that would leave no mailbox able to send; then those pauses are lifted and the automatic actions are marked undone.
Requires the campaigns:write and senders:read scopes (legacy: both campaign-write and campaign-read).
Costs 5 quota units.
You can send an Idempotency-Key header so that a retried request is not applied twice.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The ID of the campaign. | |
| senders | Yes | A list of 1 to 50 mailboxes, each an object: integrationID (required) and senderID (optional: one of the mailbox’s addresses, such as an alias; by default the mailbox’s first address). A bare integrationID number is also accepted for an item. |
|
| fromName | unchanged | No | The campaign’s from name. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID, senders, or an integrationID in senders is missing. |
| invalid_argument | 400 | The list is empty or has more than 50 mailboxes; a mailbox you are adding needs reconnecting or is disabled; a senderID isn’t on its mailbox; a mailbox has no sender address; an ID isn’t a positive whole number. |
| not_found | 404 | The campaign, or a mailbox you sent, isn’t on your team. |
| invalid_state | 400 | The campaign is archived (unarchive it first) or is a template. |
| limit_reached | 429 | The campaign’s mailboxes were already changed 30 times this hour, or another change to them is still running. Retry later. |
| missing_scope | 401 | The token doesn’t have both campaigns:write and senders:read. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Add senders
curl "https://api.mailshake.com/2017-04-01/campaigns/add-senders" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"campaignID": 1,
"senders": [
{ "integrationID": 557 }
]
}'
This endpoint returns:
{
"object": "campaign-senders",
"campaignID": 1,
"mode": "rotation",
"senders": [
{
"integrationID": 555,
"senderID": 77,
"emailAddress": "ash@example-domain.com",
"fromName": "Ash Example",
"type": "EmailProtocols",
"needsReauth": false,
"isDisabled": false,
"dailyCap": 100,
"sentToday": 42,
"status": "active"
},
{
"integrationID": 557,
"senderID": 79,
"emailAddress": "river@example-domain.com",
"fromName": "River Example",
"type": "Microsoft",
"needsReauth": false,
"isDisabled": false,
"dailyCap": null,
"sentToday": 0,
"status": "active"
}
],
"regenerationQueued": true,
"threadsChangingSender": 0
}
Adds mailboxes to a campaign. Mailboxes already on the campaign are skipped. A single-mailbox campaign becomes a rotation and keeps its mailbox. The total can’t go above 50.
The answer is the same as for Set senders, and the same rules apply to the mailboxes you add.
Requires the campaigns:write and senders:read scopes (legacy: both campaign-write and campaign-read).
Costs 5 quota units.
You can send an Idempotency-Key header so that a retried request is not applied twice.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The ID of the campaign. | |
| senders | Yes | A list of mailboxes to add, each an object: integrationID (required) and senderID (optional, as in Set senders). |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing, senders is missing or empty, or an integrationID in senders is missing. |
| invalid_argument | 400 | The result would have more than 50 mailboxes; a mailbox you are adding needs reconnecting or is disabled; a senderID isn’t on its mailbox; a mailbox has no sender address; an ID isn’t a positive whole number. |
| not_found | 404 | The campaign, or a mailbox you sent, isn’t on your team. |
| invalid_state | 400 | The campaign is archived (unarchive it first) or is a template. |
| limit_reached | 429 | The campaign’s mailboxes were already changed 30 times this hour, or another change to them is still running. Retry later. |
| missing_scope | 401 | The token doesn’t have both campaigns:write and senders:read. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Remove senders
curl "https://api.mailshake.com/2017-04-01/campaigns/remove-senders" \
-u "my-api-key:" \
-d campaignID=1 \
-d integrationIDs=556,557
This endpoint returns:
{
"object": "campaign-senders",
"campaignID": 1,
"mode": "single",
"senders": [
{
"integrationID": 555,
"senderID": 77,
"emailAddress": "ash@example-domain.com",
"fromName": "Ash Example",
"type": "EmailProtocols",
"needsReauth": false,
"isDisabled": false,
"dailyCap": 100,
"sentToday": 42,
"status": "active"
}
],
"regenerationQueued": true,
"threadsChangingSender": 5
}
Removes mailboxes from a campaign. If one mailbox is left, the campaign becomes single. Removing every mailbox is refused with invalid_argument; use Swap sender to replace the last one.
threadsChangingSender counts the recipients whose follow-ups will now come from another mailbox.
Requires the campaigns:write and senders:read scopes (legacy: both campaign-write and campaign-read).
Costs 5 quota units.
You can send an Idempotency-Key header so that a retried request is not applied twice.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The ID of the campaign. | |
| integrationIDs | Yes | The mailboxes to remove: a JSON array, or a comma-separated list. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing, or integrationIDs is missing or empty. |
| invalid_argument | 400 | The change would leave no mailbox, or an ID isn’t a positive whole number. |
| not_found | 404 | The campaign isn’t on your team, or a mailbox you sent isn’t on the campaign. |
| invalid_state | 400 | The campaign is archived (unarchive it first) or is a template. |
| limit_reached | 429 | The campaign’s mailboxes were already changed 30 times this hour, or another change to them is still running. Retry later. |
| missing_scope | 401 | The token doesn’t have both campaigns:write and senders:read. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Swap sender
curl "https://api.mailshake.com/2017-04-01/campaigns/swap-sender" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"campaignID": 1,
"removeIntegrationID": 555,
"add": { "integrationID": 558 }
}'
This endpoint returns:
{
"object": "campaign-senders",
"campaignID": 1,
"mode": "single",
"senders": [
{
"integrationID": 558,
"senderID": 80,
"emailAddress": "lake@example-domain.com",
"fromName": "Lake Example",
"type": "EmailProtocols",
"needsReauth": false,
"isDisabled": false,
"dailyCap": 100,
"sentToday": 0,
"status": "active"
}
],
"regenerationQueued": true,
"threadsChangingSender": 8
}
Removes one mailbox and adds another in a single change, so the campaign is never left without a mailbox. This works on a single-mailbox campaign too. If the mailbox you add is already on the campaign, the call only removes the other one.
The answer is the same as for Set senders, and the same rules apply to the mailbox you add.
Requires the campaigns:write and senders:read scopes (legacy: both campaign-write and campaign-read).
Costs 5 quota units.
You can send an Idempotency-Key header so that a retried request is not applied twice.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The ID of the campaign. | |
| removeIntegrationID | Yes | The mailbox to take off the campaign. | |
| add | Yes | The mailbox to put on: an object with integrationID (required) and senderID (optional, as in Set senders). A bare integrationID is also accepted. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID, removeIntegrationID or add.integrationID is missing. |
| invalid_argument | 400 | The mailbox you add needs reconnecting or is disabled; its senderID isn’t on it; it has no sender address; an ID isn’t a positive whole number. |
| not_found | 404 | The campaign or the added mailbox isn’t on your team, or removeIntegrationID isn’t on the campaign. |
| invalid_state | 400 | The campaign is archived (unarchive it first) or is a template. |
| limit_reached | 429 | The campaign’s mailboxes were already changed 30 times this hour, or another change to them is still running. Retry later. |
| missing_scope | 401 | The token doesn’t have both campaigns:write and senders:read. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Senders on campaigns/get
For a rotation campaign, campaigns/get also returns:
{
"object": "campaign",
"id": 1,
"sender": {
"object": "sender",
"id": "554-76-false",
"emailAddress": "rotation@example-domain.com",
"fromName": "Ash Example",
"created": "2026-11-01T15:04:05.000Z"
},
"senders": [
{
"object": "sender",
"id": "555-77-false",
"emailAddress": "ash@example-domain.com",
"fromName": "Ash Example",
"created": "2026-10-20T09:00:00.000Z"
},
{
"object": "sender",
"id": "556-78-false",
"emailAddress": "sky@example-domain.com",
"fromName": "Sky Example",
"created": "2026-10-21T09:00:00.000Z"
}
]
}
For a rotation campaign, campaigns/get adds a senders array of Sender models: the real mailboxes the campaign rotates between, in the order they were added. sender is unchanged: on a rotation campaign it is still the internal stand-in that represents the rotation. A single-mailbox campaign has no senders field; use sender. The first number in each sender id is its integrationID. For each mailbox’s limits, sends today and status, use List senders.
Recipients
Add
mailshake.recipients.add({
campaignID: 1,
addAsNewList: true,
listOfEmails: '"John Doe" <john@doe.com>, "Jane Doe" <jane@doe.com>'
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/add" \
-u "my-api-key:" \
-d campaignID=1 \
-d addAsNewList=true \
-d listOfEmails="\"John Doe\" <john@doe.com>, \"Jane Doe\" <jane@doe.com>"
Adds new recipients to a campaign. Each campaign can hold up to 5,000 recipients.
If you pass along a full name for your recipients, Mailshake will automatically prepare first, last, and name (full name) as text replacements. If you only have a first name, use that value as their full name.
Any other fields you provide (like favorite_color) can be used as text replacements within your campaign. If a text replacement isn’t found, that recipient’s emails will not be scheduled until you make corrections.
Here’s an example message:
Hi {{first}},
Thanks for adding your name to my email list on {{topic}}. I think you’re really going to like it!
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to add these recipients to. | |
| addAsNewList | false | No | Pass true to keep these recipients grouped together. Otherwise they’ll be added to the last list you uploaded to your campaign. |
| truncateExtraFields | false | No | Mailshake limits you to 30 recipient fields. A validation error will reject your request if you go over that limit unless you pass “true” for this parameter. In that case, we will simply ignore the extra fields. |
| listOfEmails | Maybe | A comma or newline separated list of email addresses to add. You can include recipient names by using the format: "John Doe <john@doe.com>" |
|
| addresses | Maybe | A structured list of recipient data that can include custom fields. | |
| csvData | Maybe | A structured object representing a spreadsheet of comma-separated recipient data that can include custom columns as fields. |
Using addresses
mailshake.recipients.add({
campaignID: 1,
addAsNewList: true,
addresses: [
{
emailAddress: 'john@doe.com',
fullName: 'John Doe',
fields: {
favorite_color: 'Red'
}
}
]
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/add" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-X POST -d '{"campaignID":1,"addAsNewList":true,"addresses":[{"emailAddress":"john@doe.com","fullName":"John Doe","twitterID":"jdoe","instagramID":"jdoe","facebookUrl":"https://facebook.com/jdoe","linkedInUrl":"https://linkedin.com/in/jdoe","account":"J. Doe and Co.","phoneNumber":"5555555555","fields":{"favorite_color":"Red"}}]}'
This option lets you pass in an array of structured data. Each array item should be listed in this format;
| Key | Required | Description |
|---|---|---|
| emailAddress | Yes | The recipient’s email address. |
| fullName | No | The recipient’s full name, or first name if that’s all you have. |
| twitterID | No | The recipient’s Twitter ID (just tne username, not the full URL). |
| instagramID | No | The recipient’s Instagram ID (just tne username, not the full URL). |
| facebookUrl | No | The recipient’s Facebook profile URL. |
| linkedInUrl | No | The recipient’s LinkedIn profile URL. |
| account | No | The account the recipient is associated with. Use {{company}} (or {{account}}) in emails to merge it. |
| phoneNumber | No | The recipient’s phone number |
| fields | No | A simple JSON hash (not an array) of keys to values. Each field can be used as a text replacement. |
Using csvData
mailshake.recipients.add({
campaignID: 1,
addAsNewList: true,
csvData: {
csvRawData: 'email,name,favorite_color\njohn@doe.com,John Doe,Red',
emailColumnName: 'email',
fullNameColumnName: 'name'
}
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/add" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-X POST -d '{"campaignID":1,"addAsNewList":true,"csvData":{"csvRawData":"email,name,phone,fb,linkedin,ig,twitter,accountName,favorite_color\naug25-b@mailinator.com,John Doe,1231232233,https://www.facebook.com/jdoe,https://www.linkedin.com/jdoe,jdoeinsta,jdoetwitter,J. Doe and Co.,Red","emailColumnName":"email","fullNameColumnName":"name","phoneNumberColumnName":"phone","facebookUrlColumnName":"fb","linkedInUrlColumnName":"linkedin","instagramIDColumnName":"ig","twitterIDColumnName":"twitter","accountColumnName":"accountName"}}'
Pass in spreadsheet data in comma-separated-values format. You must have a column (of any name) that represents an email address, and optionally a column to represent a full name. All other columns will be translated into fields that can be used for text replacements.
Here is the format of the JSON object to be passed as the csvData parameter:
| Key | Required | Description |
|---|---|---|
| csvRawData | Maybe | Raw csv-formatted data. |
| link | Maybe | A publicly accessible link that hosts csv-formatted data. |
| emailColumnName | Yes | The name of the column that contains recipient email addresses. |
| fullNameColumnName | No | The name of the column that contains recipient full names (or first names if that’s all you have). |
| phoneNumberColumnName | No | The name of the column that contains recipient phone numbers |
| facebookUrlColumnName | No | The name of the column that contains recipient Facebook profile URLs. |
| linkedInUrlColumnName | No | The name of the column that contains recipient LinkedIn profile URLs. |
| instagramIDColumnName | No | The name of the column that contains recipient Instagram IDs (just the username, not the full URL). |
| twitterIDColumnName | No | The name of the column that contains the recipient Twitter IDs (just the username, not the full URL) |
| accountColumnName | No | The name of the column that contains the recipient account names |
Response
This endpoint returns a AddRecipientsRequest model.
Adding recipients is an asynchronous process and may take a few minutes to fully process, but you’ll receive an immediate response to indicate how things are going. Email addresses that are on your unsubscribe list or ones that are already in your campaign will be ignored.
AddStatus
mailshake.recipients.addStatus({
statusID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/add-status" \
-u "my-api-key:" \
-d statusID=1
This endpoint returns a AddedRecipients model.
Adding recipients is an asynchronous process, so this endpoint lets you check on how things are going. If isFinished is true, then the import has completed. The problems field will let you determine the exact success or failure of the import.
List
mailshake.recipients.list({
campaignID: 1,
search: 'Egon'
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/list" \
-u "my-api-key:" \
-d campaignID=1 \
-d search=Egon
Lists all of the recipients in a campaign. You can use this endpoint to search recipients, filter by activity, or find recipients who have some of kind of problem (like a missing text replacement or an email that failed to send).
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to look in. | |
| filter | No | Criteria to filter recipients with. | |
| search | No | Filters what recipients are returned. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
Filter options
// Find recipients who have not opened any messages
mailshake.recipients.list({
campaignID: 1,
filter: {
action: 'opened',
negateAction: true
}
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/list" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-X POST -d '{"campaignID":"1","filter":{"action":"opened","negateAction":true}}'
| Field | Default | Required | Description |
|---|---|---|---|
| action | Yes | The kind of recipient activity to look for. | |
| negateAction | false | No | true to find recipients who have NOT taken the given action. |
| campaignMessageID | No | If action is based on a message, you can limit it to only look at this message. |
Filter actions
| Action | Description |
|---|---|
| opened | Recipients who have opened a message. |
| clicked | Recipients who have clicked a link. |
| replied | Recipients who have replied. |
| wasSent | Recipients who were sent a message. |
| bounced | Recipients who bounced. |
| paused | Recipients who are paused. |
| hasProblems | Recipients who have a missing text replacement or a failed sent email. |
Get
mailshake.recipients.get({
campaignID: 1,
emailAddress: 'john@doe.com'
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/get" \
-u "my-api-key:" \
-d campaignID=1 \
-d emailAddress=john@doe.com
This endpoint returns a Recipient model.
Gets a single recipient’s basic information. A not_found error will be returned if the recipient could not be found.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| recipientID | Maybe | The ID of a recipient. | |
| campaignID | Maybe | The campaign that this recipient belongs to. Required if emailAddress is specified. |
|
| emailAddress | Maybe | The address of the recipient. |
Pause
mailshake.recipients.pause({
campaignID: 1,
emailAddress: 'john@doe.com'
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/pause" \
-u "my-api-key:" \
-d campaignID=1 \
-d emailAddress=john@doe.com
This endpoint returns a Recipient model.
Immediately pauses all sending for a single recipient. If any emails for recipient are currently being sent they will not be stopped.
A not_found error will be returned if the recipient could not be found.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign that this recipient belongs to. | |
| emailAddress | Yes | The address of the recipient. |
Unpause
mailshake.recipients.unpause({
campaignID: 1,
emailAddress: 'john@doe.com'
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/unpause" \
-u "my-api-key:" \
-d campaignID=1 \
-d emailAddress=john@doe.com
This endpoint returns a Recipient model.
Resumes sending for a recipient. This team’s sending calendar will reschedule itself to account for this recipient’s pending emails. In rare cases it may take up to 5 minutes for the calendar to show updated scheduled times.
A not_found error will be returned if the recipient could not be found.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to unpause. | |
| emailAddress | Yes | The address of the recipient. |
Unsubscribe
mailshake.recipients.unsubscribe({
emailAddresses: 'john@doe.com,jane@doe.com'
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/recipients/unsubscribe" \
-u "my-api-key:" \
-d emailAddresses=john@doe.com,jane@doe.com
This endpoint returns an empty response.
Adds a list of email addresses to your unsubscribe list.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| emailAddresses | Yes | A comma-separated list of email addresses to unsubscribe. |
Remove
curl "https://api.mailshake.com/2017-04-01/recipients/remove" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"campaignID": 42,
"recipientIDs": [8801, 8802]
}'
This endpoint returns:
{
"campaignID": 42,
"removedRecipientIDs": [8801, 8802]
}
Removes up to 100 recipients from one campaign, as deleting them in the Mailshake app does. Their queued emails are dropped and the campaign’s schedule is updated. This can’t be undone. To stop emailing someone without removing them, use recipients/pause or recipients/unsubscribe instead.
Every recipient must be in that campaign. If any isn’t (including another team’s recipients), nothing is removed and the call answers not_found with the refused IDs in data.recipientIDs. Listing an ID twice removes it once.
Requires the recipients:write scope (the legacy campaign-write scope grants it).
Costs 1 quota unit plus 2 per recipient ID listed.
Supports an optional Idempotency-Key header, as every write does.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign to remove recipients from. | |
| recipientIDs | Yes | An array of 1 to 100 recipient IDs in that campaign. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | campaignID or recipientIDs is missing, or recipientIDs is empty. |
| invalid_argument | 400 | An ID isn’t a positive whole number, or more than 100 recipient IDs. |
| not_found | 404 | The campaign isn’t your team’s, or some recipients aren’t in it (listed in data.recipientIDs). Nothing was removed. |
| unspecified_error | 400 | Removing recipients is down for maintenance. Nothing was removed; try again in a few minutes. |
| missing_scope | 401 | The token doesn’t have recipients:write. |
A
not_founderror for recipients looks like this:
{
"code": "not_found",
"error": "Recipient not found",
"time": "2026-11-13T15:12:40.114Z",
"data": {
"recipientIDs": [8802]
}
}
Unsubscribes
List
curl "https://api.mailshake.com/2017-04-01/unsubscribes/list" \
-u "my-api-key:" \
-d search="example-domain.com" \
-d since="2026-11-01T00:00:00Z"
This endpoint returns:
{
"results": [
{
"object": "unsubscribe",
"emailAddress": "sam@example-domain.com",
"type": "prospect",
"origin": "Reply",
"unsubscribeDate": "2026-11-10T14:22:05.000Z",
"name": "Sam Example"
},
{
"object": "unsubscribe",
"emailAddress": "example-domain.com",
"type": "domain",
"origin": "Manual",
"unsubscribeDate": "2026-11-02T09:00:00.000Z"
}
],
"nextToken": null
}
Your team’s unsubscribe list, newest first. It holds two kinds of entries:
prospect: an email address that unsubscribed or was unsubscribed.originsays how:Click(the unsubscribe link),Reply(an unsubscribe reply),BounceorManual.nameis the prospect’s name, ornull.domain: a whole domain your team blocked.emailAddressholds the domain,originis alwaysManual, and there is noname.
nextToken is null on the last page.
Requires the recipients:read scope (the legacy campaign-read scope grants it).
Costs 2 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| search | No | Only entries whose email address (or domain) or name contains this text. | |
| since | No | Only entries unsubscribed on or after this time (ISO 8601). | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 25 | No | How many results to get at once, up to 100. |
Errors
| Code | HTTP status | When |
|---|---|---|
| invalid_argument | 400 | since isn’t a valid date. |
| missing_scope | 401 | The token doesn’t have recipients:read. |
Remove
curl "https://api.mailshake.com/2017-04-01/unsubscribes/remove" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"emailAddresses": ["sam@example-domain.com", "lee@example-domain.com"],
"confirm": true
}'
This endpoint returns:
{
"resubscribed": ["sam@example-domain.com"],
"notUnsubscribed": ["lee@example-domain.com"]
}
Takes up to 100 email addresses off your team’s unsubscribe list (resubscribes them), so your campaigns can email them again.
This can restart contact with people who asked not to be emailed, so the call always needs confirm: true. Without it nothing changes and the call answers confirmation_required. Only resubscribe people who have asked to hear from you again.
Addresses come back in lower case. resubscribed lists the addresses taken off the list; notUnsubscribed lists the ones that weren’t on your team’s list (nothing changed for them). Blocked domains can’t be removed here.
Requires the recipients:write scope (the legacy campaign-write scope grants it).
Costs 1 quota unit plus 2 per address listed.
Supports an optional Idempotency-Key header, as every write does.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| emailAddresses | Yes | An array of 1 to 100 email addresses. | |
| confirm | Yes | Must be true. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | emailAddresses is missing or empty. |
| invalid_argument | 400 | More than 100 addresses, or some aren’t valid email addresses (listed in data.invalid). |
| confirmation_required | 400 | confirm isn’t true. Nothing changed; data.emailAddresses echoes your list. |
| missing_scope | 401 | The token doesn’t have recipients:write. |
A
confirmation_requirederror looks like this:
{
"code": "confirmation_required",
"error": "Resubscribing restarts contact with people who opted out. Send confirm: true to proceed.",
"time": "2026-11-13T15:12:40.114Z",
"data": {
"emailAddresses": ["sam@example-domain.com", "lee@example-domain.com"]
}
}
Activity
These endpoints let you see what’s been going on with your campaigns.
Sent
mailshake.activity.sent({
campaignMessageType: 'initial'
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/activity/sent" \
-u "my-api-key:" \
-d campaignMessageType=initial
This endpoint returns paginated SentMessage models.
Obtains the most recent emails you have sent. In most cases you’ll want to look at campaign-based emails, but this endpoint also lets you get one-off replies you’ve sent within Mailshake via Lead Catcher.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| messageType | any | No | If specified, you can filter to only one-off or campaign-message messages. one-off messages are replies you send manually within Mailshake, so in most cases you’ll want to omit this parameter or use campaign-message. |
| campaignMessageType | any | No | Filter to a specific type of message within a campaign (see CampaignMessageTypes). |
| campaignID | No | Restrict to a single campaign. | |
| campaignMessageID | No | Restrict to a single message within a campaign. | |
| recipientEmailAddress | No | Limit to specific recipients. If the value passed is not in the format of an email address, a fuzzy search will be done. Ergo, sending in firmxyz.com will match anyone on that domain. |
|
| excludeBody | No | Excludes the email body from the response. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 25 | No | How many results to get at once, up to 25. |
Opens
mailshake.activity.opens()
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/activity/opens" \
-u "my-api-key:"
Obtains the most recent emails opened.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | Restrict to a single campaign. | |
| campaignMessageID | No | Restrict to a single message within a campaign. | |
| excludeDuplicates | false | No | If true this will only not return data when recipients open the same email more than once. |
| recipientEmailAddress | No | Limit to specific recipients. If the value passed is not in the format of an email address, a fuzzy search will be done. Ergo, sending in firmxyz.com will match anyone on that domain. |
|
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
| since | No | Restrict results to events that occurred after since. Date is in UTC, and formatted like “2017-04-11 16:13:51” |
|
| assignedToUserID | No | Restrict results to campaigns assigned to user |
Clicks
mailshake.activity.clicks()
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/activity/clicks" \
-u "my-api-key:"
Obtains the most recent links clicked.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | Restrict to a single campaign. | |
| excludeDuplicates | false | No | If true this will only not return data when recipients click the same link more than once. |
| matchUrl | No | An exact matching of a specific link you’re tracking. | |
| recipientEmailAddress | No | Limit to specific recipients. If the value passed is not in the format of an email address, a fuzzy search will be done. Ergo, sending in firmxyz.com will match anyone on that domain. |
|
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
| since | No | Restrict results to events that occurred after since. Date is in UTC, and formatted like “2017-04-11 16:13:51” |
|
| assignedToUserID | No | Restrict results to campaigns assigned to user |
Replies
mailshake.activity.replies({
replyType: 'reply'
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/activity/replies" \
-u "my-api-key:" \
-d replyType=reply
Obtains the most recent replies to your sent emails. Pay special attention to replyType because you can use this endpoint to look at bounces, out-of-office replies, etc.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| replyType | any | No | Filter to only reply, bounce, out-of-office, unsubscribe or delay-notification replies. |
| campaignID | No | Restrict to a single campaign. | |
| recipientEmailAddress | No | Limit to specific recipients. If the value passed is not in the format of an email address, a fuzzy search will be done. Ergo, sending in firmxyz.com will match anyone on that domain. |
|
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 25 | No | How many results to get at once, up to 25. |
Created Leads
mailshake.activity.createdLeads({
campaignID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/activity/created-leads" \
-u "my-api-key:" \
-d campaignID=1
Obtains the most recently created leads. Usually leads are automatically created from the rules you’ve set up in Lead Catcher, but Mailshake users can also manually turn recipients into leads.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | Restrict to a single campaign. | |
| recipientEmailAddress | No | Limit to specific recipients. If the value passed is not in the format of an email address, a fuzzy search will be done. Ergo, sending in firmxyz.com will match anyone on that domain. |
|
| assignedToEmailAddress | No | Only get leads that are assigned to this person on your team. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
| since | No | Restrict results to events that occurred after since. Date is in UTC, and formatted like “2017-04-11 16:13:51” |
|
| assignedToUserID | No | Restrict results to campaigns assigned to user |
Assigned Leads
mailshake.activity.leadAssignments({
campaignID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/activity/lead-assignments" \
-u "my-api-key:" \
-d campaignID=1
Obtains the most recently assigned leads. Leads are assigned by Mailshake users manually assigning them.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | Restrict to a single campaign. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
| since | No | Restrict results to events that occurred after since. Date is in UTC, and formatted like “2017-04-11 16:13:51” |
|
| assignedToUserID | No | Restrict results to campaigns assigned to user |
Lead Status Changes
mailshake.activity.leadStatusChanges({
campaignID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/activity/lead-status-changes" \
-u "my-api-key:" \
-d campaignID=1
Obtains the most recently updated leads. A lead can be closed, ignored, opened, or reopened. A reopened lead has open as its status, it’s just that at one point that lead had been ignored or closed.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | Restrict to a single campaign. | |
| recipientEmailAddress | No | Limit to specific recipients. If the value passed is not in the format of an email address, a fuzzy search will be done. Ergo, sending in firmxyz.com will match anyone on that domain. |
|
| assignedToEmailAddress | No | Only get leads that are assigned to this person on your team. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
| since | No | Restrict results to events that occurred after since. Date is in UTC, and formatted like “2017-04-11 16:13:51” |
|
| assignedToUserID | No | Restrict results to campaigns assigned to user |
Leads
A lead in Mailshake is a recipient who may be interested in whatever you’re pitching in your campaigns. Lead Catcher will automatically find leads based on criteria you set up, but you can also create and manage leads via the API.
List
mailshake.leads.list({
campaignID: 1,
status: 'open'
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/leads/list" \
-u "my-api-key:" \
-d campaignID=1 \
-d status=open
Lists your leads. You can use this endpoint to search leads, filter by status, or find leads assigned to one of your teammates.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | Filter leads to the ones from this campaign. | |
| status | No | Filter to leads in a particular status. | |
| assignedToEmailAddress | No | Leads assigned to this teammate. | |
| search | No | Filters what leads are returned. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
Get
mailshake.leads.get({
campaignID: 1,
emailAddress: 'john@doe.com'
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/leads/get" \
-u "my-api-key:" \
-d campaignID=1 \
-d emailAddress=john@doe.com
This endpoint returns a Lead model.
Gets a single lead. A not_found error will be returned if the lead could not be found.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| leadID | Maybe | The ID of a lead. | |
| recipientID | Maybe | The ID of the recipient that this lead is for. | |
| campaignID | Maybe | The campaign that this recipient belongs to. Required if emailAddress is specified. |
|
| emailAddress | Maybe | The address of the recipient. |
Create
mailshake.leads.create({
recipientIDs: [1, 2, 3]
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
// Or
mailshake.leads.create({
campaignID: 1,
emailAddresses: [
'a@johndoe.com',
'c@johndoe.com',
'd@johndoe.com'
]
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/leads/create" \
-u "my-api-key:" \
-d recipientIDs=1
-d recipientIDs=2
-d recipientIDs=3
Or
curl "https://api.mailshake.com/2017-04-01/leads/create" \
-u "my-api-key:" \
-d campaignID=1
-d emailAddresses=a@johndoe.com
-d emailAddresses=b@johndoe.com
-d emailAddresses=c@johndoe.com
This endpoint returns CreatedLeads model.
Creates one or more leads from recipients of a campaign. You can either pass in the IDs of recipients or if it’s easier, you can pass their email addresses instead. If a recipient was already a lead and was won, this will reopen them as a lead.
Parameters
You can specify recipientIDs or emailAddresses or both.
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | The ID of the campaign from which to create a lead. | |
| emailAddresses | No | A list of email addresses to find recipients from for creating leads. This list will be added to the recipientIDs parameter if both are passed. |
|
| recipientIDs | No | A list of recipient IDs to create leads from. This list will be added to the recipientIDs parameter if both are passed. |
Close
mailshake.leads.close({
leadID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/leads/close" \
-u "my-api-key:" \
-d leadID=1
This endpoint returns an empty response.
Marks a lead as “Won” (or “Lost” if you send in that status). The alternative to these states is “Ignored” which means that the lead wasn’t worth pursuing.
Parameters
Only one identifier is required – just use what’s most convenient to you.
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | ||
| emailAddress | No | The email address of a recipient in this campaign. | |
| recipientID | No | The ID of the recipient that this lead refers to. | |
| leadID | No | The ID of the lead. | |
| status | “closed” | No | Can be set to “closed” or “lost”. |
Ignore
mailshake.leads.ignore({
leadID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/leads/ignore" \
-u "my-api-key:" \
-d leadID=1
This endpoint returns a LeadStatus model.
Marks a lead as “ignored” when means the lead wasn’t worth pursuing. Use Close and pass lost as the status to indicate you worked on this lead but it didn’t pan out.
Parameters
Only one identifier is required – just use what’s most convenient to you.
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | ||
| emailAddress | No | The email address of a recipient in this campaign. | |
| recipientID | No | The ID of the recipient that this lead refers to. | |
| leadID | No | The ID of the lead. |
Reopen
mailshake.leads.reopen({
leadID: 1
})
.then(result => {
console.log(JSON.stringify(result, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/leads/reopen" \
-u "my-api-key:" \
-d leadID=1
This endpoint returns a LeadStatus model.
Takes a closed or ignored lead and makes it open again and available for review.
Parameters
Only one identifier is required – just use what’s most convenient to you.
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | ||
| emailAddress | No | The email address of a recipient in this campaign. | |
| recipientID | No | The ID of the recipient that this lead refers to. | |
| leadID | No | The ID of the lead. |
Assign
curl "https://api.mailshake.com/2017-04-01/leads/assign" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"leadIDs": [3301, 3302],
"assignToEmailAddress": "lee@example-domain.com"
}'
This endpoint returns:
{
"object": "lead-assignment",
"leadIDs": [3301, 3302],
"assignedToUserID": 1207,
"changedLeadIDs": [3301]
}
Hands leads to a teammate, or unassigns them. Name the teammate by user ID or by the email address they log in with, or send unassign: true. Give exactly one of the three.
Every lead must be your team’s and the teammate must be on your team. Otherwise nothing changes and the call answers not_found.
changedLeadIDs lists the leads whose assignee changed; the others already had it. Each changed lead fires the same “lead reassigned” event as in the Mailshake app. assignedToUserID is null after an unassign.
Requires the leads:write scope (the legacy campaign-write scope grants it).
Costs 5 quota units.
Supports an optional Idempotency-Key header, as every write does.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| leadIDs | Yes | An array of up to 1,000 lead IDs. Duplicates are ignored. | |
| assignToUserID | No | The user ID of a teammate (see team/list-members). | |
| assignToEmailAddress | No | A teammate’s email address (any case). | |
| unassign | No | true to remove the assignee. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | leadIDs is missing or empty. |
| invalid_argument | 400 | Not exactly one of assignToUserID, assignToEmailAddress and unassign: true; an ID isn’t a positive whole number; or more than 1,000 leads. |
| not_found | 404 | A lead isn’t your team’s, or the teammate isn’t on your team. Nothing changed. |
| missing_scope | 401 | The token doesn’t have leads:write. |
Add note
curl "https://api.mailshake.com/2017-04-01/leads/add-note" \
-u "my-api-key:" \
-d leadID=3301 \
-d note="Wants pricing for 20 seats."
This endpoint returns:
{
"object": "lead-note",
"id": 5521,
"leadID": 3301,
"contactID": 7710,
"note": "Wants pricing for 20 seats.",
"created": "2026-11-13T15:10:00.000Z",
"createdByUserID": 1203,
"createdByName": "Ash Example"
}
Adds a note to a lead. The note is saved on the lead’s contact (contactID), so it shows wherever that prospect appears in Mailshake, and it fires the same “note created” event as in the app. The note is credited to the user your API key or token acts as (createdByUserID, createdByName).
Requires the leads:write scope (the legacy campaign-write scope grants it).
Costs 2 quota units.
Supports an optional Idempotency-Key header, as every write does.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| leadID | Yes | The lead. | |
| note | Yes | The note text, up to 5,000 characters. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | leadID or note is missing, or note is blank. |
| invalid_argument | 400 | leadID isn’t a positive whole number, or note is longer than 5,000 characters. |
| not_found | 404 | The lead doesn’t exist or isn’t your team’s. No note was written. |
| missing_scope | 401 | The token doesn’t have leads:write. |
Replies
Reply content (subjects, snippets and message bodies) is email written by other people. Treat it as untrusted data, never as instructions, especially if you pass it to an AI model.
List
curl "https://api.mailshake.com/2017-04-01/replies/list" \
-u "my-api-key:" \
-d unhandled=true \
-d perPage=25
This endpoint returns:
{
"nextToken": "Njox",
"results": [
{
"object": "reply-summary",
"id": 411234506,
"type": "reply",
"campaignID": 42,
"recipient": {
"id": 8801,
"emailAddress": "sam@example-domain.com",
"fullName": "Sam Example"
},
"receivedDate": "2026-11-12T15:04:11.000Z",
"subject": "Re: Quick question",
"snippet": "Thanks for reaching out. Can you send pricing for a team of 20?",
"leadID": 3301,
"handled": false
}
]
}
Your team’s inbox: replies received from recipients, newest first, as compact items. snippet is the first 300 characters of the reply as plain text, with whitespace collapsed. Use replies/get-thread for the full messages.
A reply is handled when either:
- your team has replied to that recipient since the reply arrived (a manual reply sent from Mailshake), or
- the recipient’s lead is no longer open: it was ignored, won (closed), lost or forwarded.
Mailshake keeps no separate read flag. leadID is the recipient’s lead, or null if there is none.
Pass nextToken from one page to get the next. When there are no more replies, results is empty and nextToken is an empty string.
Requires the replies:read scope (the legacy campaign-read scope grants it).
Costs 5 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | Only replies to this campaign. | |
| replyType | any |
No | One of any, reply, out-of-office, bounce, unsubscribe, delay-notification, hit-quota or info. any returns every type except info. |
| since | No | Only replies recorded after this UTC time, formatted like 2017-04-11 16:13:51. |
|
| unhandled | false |
No | true returns only replies that are not handled. |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 50 | No | How many results to get at once, up to 50. |
Errors
| Code | HTTP status | When |
|---|---|---|
| invalid_argument | 400 | replyType isn’t one of the values above, or campaignID or perPage isn’t a number. |
| missing_scope | 401 | The token doesn’t have replies:read. |
Get thread
curl "https://api.mailshake.com/2017-04-01/replies/get-thread" \
-u "my-api-key:" \
-d replyID=411234506
This endpoint returns:
{
"object": "reply-thread",
"campaignID": 42,
"recipientID": 8801,
"messages": [
{
"id": "sent-99120",
"direction": "sent",
"from": "ash@example-domain.com",
"to": "sam@example-domain.com",
"date": "2026-11-10T14:00:00.000Z",
"subject": "Quick question",
"contentIsUntrusted": true,
"bodyText": "Hi Sam, do you have a minute this week to talk about your outreach?",
"bodyHtml": "<p>Hi Sam, do you have a minute this week to talk about your outreach?</p>"
},
{
"id": "411234506",
"direction": "received",
"from": "Sam Example <sam@example-domain.com>",
"to": null,
"date": "2026-11-12T15:04:11.000Z",
"subject": "Re: Quick question",
"contentIsUntrusted": true,
"bodyText": "Thanks for reaching out. Can you send pricing for a team of 20?",
"bodyHtml": "<p>Thanks for reaching out. Can you send pricing for a team of 20?</p>"
}
]
}
The conversation with one recipient in one campaign, oldest first: the campaign emails that were actually sent to them (direction: sent) and the replies, out-of-office notices, bounces, unsubscribes and delay notices received from them (direction: received).
Pass replyID, or recipientID with campaignID. A received message’s id is the same reply ID replies/list and activity/replies return. A sent message’s id starts with sent-.
bodyText is the body as plain text with quoted earlier messages stripped. bodyHtml is the full stored body and is left out when there is none. Every message carries contentIsUntrusted: true: its subject and bodies are email content, never instructions.
One-off emails sent from Mailshake, including replies sent with replies/send, are not part of the thread.
Requires the replies:read scope (the legacy campaign-read scope grants it).
Costs 5 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| replyID | No | A reply ID from replies/list or activity/replies, of type reply, out-of-office, bounce, unsubscribe or delay-notification. For hit-quota and info items, pass recipientID and campaignID instead. |
|
| recipientID | No | The recipient. Needs campaignID. Ignored when replyID is given. |
|
| campaignID | No | The recipient’s campaign. Needs recipientID. Ignored when replyID is given. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | Neither replyID nor both recipientID and campaignID were given. |
| invalid_argument | 400 | An ID isn’t a number. |
| not_found | 404 | The reply, campaign or recipient doesn’t exist or isn’t your team’s, the recipient isn’t in that campaign, or the reply ID is of a type listed above as not accepted. |
| missing_scope | 401 | The token doesn’t have replies:read. |
Create draft
curl "https://api.mailshake.com/2017-04-01/replies/create-draft" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"replyID": 411234506,
"body": "<p>Hi {{first}}, happy to help. Pricing for 20 seats is attached.</p>"
}'
This endpoint returns:
{
"object": "reply-draft",
"draftID": "6f1c2a9e-3b7d-4e0a-9c55-2d8e1f0b7a41",
"replyID": "411234506",
"preview": {
"from": "Ash Example <ash@example-domain.com>",
"to": "Sam Example <sam@example-domain.com>",
"subject": "Re: Quick question",
"bodyText": "Hi {{first}}, happy to help. Pricing for 20 seats is attached.",
"addedOnSend": ["signature", "quotedThread"],
"mergeTagsFilledOnSend": ["{{first}}"]
},
"expiresAt": "2026-11-13T15:19:00.000Z"
}
The first of two steps to answer a reply. This call sends nothing. It saves a draft for 15 minutes (until expiresAt) and returns what would be sent, so you or your user can check it. Send it with replies/send.
You can answer a reply of type reply or out-of-office. Bounces, unsubscribes and other notices can’t be answered.
preview shows the sender, the recipient, the subject and your text as plain text. On send, Mailshake also adds what is listed in addedOnSend: the mailbox’s signature and the quoted earlier thread, as a reply from the Mailshake app does. Merge tags such as {{first}} are filled in on send; mergeTagsFilledOnSend lists the ones in your subject and body.
The mailbox is fromIntegrationID if you give one. Otherwise it is the mailbox that last emailed this recipient, or, if nothing was sent yet, the campaign’s own mailbox.
Requires the replies:send scope. No legacy scope grants it: an OAuth app must ask for replies:send itself. API keys have every scope.
Costs 5 quota units.
Supports an optional Idempotency-Key header, as every write does.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| replyID | Yes | The reply to answer, from replies/list or activity/replies. | |
| body | Yes | Your reply, as HTML or plain text, up to 50,000 characters. May contain merge tags. | |
| subject | Re: and the reply’s subject |
No | The subject. If the reply’s subject already starts with Re:, it is used as is. |
| fromIntegrationID | see above | No | The team mailbox to send from (an integrationID). |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | replyID or body is missing or body is blank. |
| invalid_argument | 400 | body is longer than 50,000 characters, or fromIntegrationID isn’t a number. |
| not_found | 404 | The reply doesn’t exist, isn’t your team’s, or isn’t a reply or out-of-office; or no mailbox of your team was found (including a fromIntegrationID of another team). |
| missing_scope | 401 | The token doesn’t have replies:send. |
Send
curl "https://api.mailshake.com/2017-04-01/replies/send" \
-u "my-api-key:" \
-H "Idempotency-Key: 0b8e2c4a-7f19-4d6e-a1c3-5e9f2b7d4c10" \
-d draftID=6f1c2a9e-3b7d-4e0a-9c55-2d8e1f0b7a41
This endpoint returns:
{
"object": "reply-sent",
"draftID": "6f1c2a9e-3b7d-4e0a-9c55-2d8e1f0b7a41",
"replyID": "411234506",
"emailID": 774512,
"sentDate": "2026-11-13T15:05:12.000Z"
}
Sends a draft from replies/create-draft, threaded under the reply it answers, from the draft’s mailbox. A draft is sent at most once.
This call requires an Idempotency-Key header (1 to 64 printable characters, new for each draft you mean to send). If your request fails or times out, retry with the same key: if the first try was sent, you get its answer again (header Idempotent-Replayed: true) instead of a second email. Without the header the call is refused with missing_parameter.
Sending can be refused before anything goes out. In that case the draft is kept and can be sent later (while it lasts), and the attempt doesn’t count toward the send limit:
- Sending paused. When Mailshake has paused all sending, the call answers
sending_paused. Try again later. - Send limit. At most 30 replies per team per 10-minute window. Over that, the call answers
limit_reached(HTTP 429). Try again in a few minutes. - Mailbox problems. If the mailbox is disabled, needs reconnecting or is on hold, the call answers
unspecified_errorwith a message that says which. - Recipient gone. If the recipient, or the campaign it was in, was deleted after the draft was made, the call answers
not_found(HTTP 404) saying so. Nothing is sent; the draft can’t be sent, so let it expire.
If the call fails in an unexpected way (HTTP 500), the email may have gone out, so the draft is not sent again. Check the conversation in Mailshake before you create a new draft.
Requires the replies:send scope. No legacy scope grants it: an OAuth app must ask for replies:send itself. API keys have every scope.
Costs 20 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| draftID | Yes | The draftID from replies/create-draft. Drafts last 15 minutes. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | The Idempotency-Key header or draftID is missing. |
| invalid_argument | 400 | The Idempotency-Key isn’t 1 to 64 printable characters. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still in progress. |
| invalid_state | 400 | The draft was already sent (or an earlier attempt may have sent it), or it expired. Create a new draft. |
| not_found | 404 | No draft with this ID exists for your team, or the draft’s recipient or campaign no longer exists. |
| sending_paused | 400 | Mailshake has paused all sending. Nothing was sent. |
| limit_reached | 429 | Your team sent 30 replies in this 10-minute window. Nothing was sent. |
| unspecified_error | 400 | The mailbox can’t send (disabled, needs reconnecting, on hold). Nothing was sent. |
| missing_scope | 401 | The token doesn’t have replies:send. |
Team
List Members
mailshake.team.listMembers()
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/team/list-members" \
-u "my-api-key:"
Lists the users belonging to this team.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| search | No | Filters the returned users. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
Senders
List
mailshake.senders.list({
search: '@gmail.com'
})
.then(result => {
result.results.forEach(campaign => {
console.log(JSON.stringify(campaign, null, 2));
});
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/senders/list" \
-u "my-api-key:" \
-d search="@gmail.com"
List all of a team’s senders.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| search | No | Filters what senders are returned. | |
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 100 | No | How many results to get at once, up to 100. |
Add SMTP/IMAP
mailshake.senders.addSmtpImap({
emailAddress: 'ash@example-domain.com',
fromName: 'Ash Example',
smtp: { host: 'smtp.example-host.com', port: 587 },
imap: { host: 'imap.example-host.com', port: 993 },
password: 'mailbox-password',
maxEmailsPerDay: 100,
minutesBetweenSends: 5
})
.then(sender => {
console.log(JSON.stringify(sender, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/senders/add-smtp-imap" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"emailAddress": "ash@example-domain.com",
"fromName": "Ash Example",
"smtp": { "host": "smtp.example-host.com", "port": 587 },
"imap": { "host": "imap.example-host.com", "port": 993 },
"password": "mailbox-password",
"maxEmailsPerDay": 100,
"minutesBetweenSends": 5
}'
This endpoint returns:
{
"integrationID": 555,
"senderID": 77,
"emailAddress": "ash@example-domain.com"
}
Connects one SMTP/IMAP mail account to your team as a sender. Mailshake tests the IMAP login, then the SMTP login, before saving anything. Each sender uses one mail account seat on your plan; if your plan has no free seat, the call is refused with sender_limit_reached and nothing is charged.
Requires the campaign-write scope.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| emailAddress | Yes | The mail account’s address. | |
| fromName | '' |
No | The name emails are sent from. |
| smtp | Yes | An object: host and port (25, 465, 587, 2525 or 2526). The port decides TLS, as in the app; a secure field is ignored. |
|
| imap | Yes | An object: host and port (143, 993 or 995). The port decides TLS, as in the app; a secure field is ignored. |
|
| username | emailAddress |
No | The login used for both SMTP and IMAP. |
| password | Yes | The password used for both SMTP and IMAP. It is stored encrypted and never returned or logged. | |
| maxEmailsPerDay | the app’s default | No | Daily sending limit, a whole number from 1 up to your team’s limit for SMTP accounts. |
| minutesBetweenSends | the app’s default | No | Minutes between sends, a whole number of at least 1. |
Hosts must be public mail servers: a host that is or resolves to a loopback, private, carrier-grade NAT, link-local or reserved address is refused with invalid_argument.
As in the app, a team member who is not a team admin can connect only one mail account; a second one answers already-connected.
Adding the same address twice never creates a second sender: the second call answers sender_already_exists (HTTP 409) with the existing sender’s integrationID in the error body.
Update schedule
mailshake.senders.updateSchedule({
integrationID: 555,
maxEmailsPerDay: 50
})
.then(result => {
console.log(JSON.stringify(result.schedule, null, 2));
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/senders/update-schedule" \
-u "my-api-key:" \
-d integrationID=555 \
-d maxEmailsPerDay=50
This endpoint returns:
{
"success": true,
"schedule": {
"maxEmailsPerDay": 50,
"minutesBetweenSends": 5
}
}
Changes the daily sending limit of a sender that was added with Add SMTP/IMAP (above). Emails already queued are rescheduled to follow the new limit. Senders connected any other way (for example in the Mailshake app) can’t be changed here and answer not_found.
Requires the campaign-write scope.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| integrationID | Yes | The integrationID returned by Add SMTP/IMAP. |
|
| maxEmailsPerDay | Yes | New daily sending limit, a whole number from 1 up to your team’s limit for SMTP accounts. | |
| minutesBetweenSends | unchanged | No | Minutes between sends, a whole number of at least 1. |
Remove
mailshake.senders.remove({
integrationID: 555
})
.then(result => {
console.log(result.success);
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/senders/remove" \
-u "my-api-key:" \
-d integrationID=555
This endpoint returns:
{
"success": true
}
Removes a sender that was added with Add SMTP/IMAP (above), the same way as removing a mail account in the app, and gives its mail account seat back. Senders connected any other way can’t be removed here and answer not_found.
Requires the campaign-write scope.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| integrationID | Yes | The integrationID returned by Add SMTP/IMAP. |
Get
curl "https://api.mailshake.com/2017-04-01/senders/get" \
-u "my-api-key:" \
-d integrationID=555
This endpoint returns:
{
"object": "sender",
"integrationID": 555,
"senderID": 77,
"emailAddress": "ash@example-domain.com",
"fromName": "Ash Example",
"type": "smtp-imap",
"status": "quota-wait",
"needsReauth": false,
"quotaWaitUntil": "2026-11-12T16:30:00.000Z",
"lastReplyCheckDate": "2026-11-12T15:58:12.000Z",
"replyCheckFailureCount": 0,
"schedule": {
"maxEmailsPerDay": 100,
"minutesBetweenSends": 5
},
"warmup": {
"enabled": true
},
"addedByApi": true
}
Gets the current health of one of your team’s mailboxes. Look it up by integrationID or by emailAddress; if you send both, integrationID is used.
typeisgoogle,microsoftorsmtp-imap.statusis the most important problem, checked in this order:needs-reauth: the mailbox must be reconnected before it can send.quota-wait: the provider’s quota makes Mailshake wait untilquotaWaitUntilbefore checking the mailbox again.quotaWaitUntilis only present with this status.reply-check-failing: reply checking has failed 3 or more times in a row.ok: none of the above.
lastReplyCheckDateis the last time Mailshake checked the mailbox for replies, ornull.replyCheckFailureCountis how many reply checks in a row have failed.scheduleis the mailbox’s daily limit and minutes between sends; both arenullif the mailbox has no schedule.warmup.enabledis true when warmup is running for this address, ornullwhen the warmup service can’t be reached (the rest of the answer is still current).addedByApiis true when the mailbox was added with Add SMTP/IMAP.
When a mailbox has several addresses (aliases), a lookup by integrationID returns its first address; a lookup by emailAddress returns the address you asked for.
Requires the senders:read scope (legacy: campaign-read).
Costs 2 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| integrationID | One of the two | The mailbox’s integrationID. |
|
| emailAddress | One of the two | The mailbox’s sending address. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | Neither integrationID nor emailAddress was sent. |
| invalid_argument | 400 | integrationID isn’t a number. |
| not_found | 404 | No mailbox on your team matches. |
| missing_scope | 401 | The token doesn’t have senders:read. |
Automatic action rules
curl "https://api.mailshake.com/2017-04-01/senders/auto-action-rules" \
-u "my-api-key:"
This endpoint returns:
{
"object": "auto-action-rules",
"team": {
"enabled": true,
"action": "swap",
"standbyIntegrationIDs": [601, 602],
"limits": {
"maxActionsPerDay": 3,
"cooldownHours": 24,
"minSends": 50
},
"notify": {
"userIDs": [12]
}
},
"campaigns": [
{
"campaignID": 1,
"rule": {
"enabled": false,
"action": "pause",
"standbyIntegrationIDs": [],
"limits": {
"maxActionsPerDay": 3,
"cooldownHours": 24,
"minSends": 50
},
"notify": {
"userIDs": []
}
}
}
]
}
Gets your team’s rules for automatic action on dipped mailboxes. A mailbox is dipped when its bounce rate has risen sharply or its reply rate has fallen sharply compared with its own recent past (see the signal in senders/stats). With automatic action on, Mailshake can take a dipped mailbox out of a running campaign’s rotation, or replace it with a standby mailbox.
Automatic action is off by default: team is null and campaigns is empty until you set a rule with Set automatic action rules.
team is the team-wide rule. campaigns lists per-campaign rules; a campaign’s own rule replaces the team rule for that campaign, so a campaign rule with enabled: false turns automatic action off for that campaign only. With campaignID, campaigns lists only that campaign’s rule (or is empty); team is always returned.
Requires the senders:read scope (legacy: campaign-read).
Costs 1 quota unit.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | No | Only show this campaign’s rule. |
Errors
| Code | HTTP status | When |
|---|---|---|
| invalid_argument | 400 | campaignID isn’t a positive whole number. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have senders:read. |
Set automatic action rules
curl "https://api.mailshake.com/2017-04-01/senders/set-auto-action-rules" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"scope": "team",
"enabled": true,
"action": "swap",
"standbyIntegrationIDs": [601, 602],
"limits": { "maxActionsPerDay": 3, "cooldownHours": 24, "minSends": 50 },
"notify": { "userIDs": [12] },
"confirm": true
}'
This endpoint returns the rules after the change, in the same shape as Automatic action rules.
Without
confirm, turning automatic action on answers:
{
"code": "confirmation_required",
"error": "Turning on automatic action needs confirm: true",
"time": "2026-11-12T15:00:00.000Z",
"data": {
"summary": "Mailshake will swap a dipped mailbox for the first healthy standby (601, 602) in every running campaign of the team, at most 3 times a day, at most once per mailbox every 24 hours, and only for mailboxes with at least 50 sends in the current window. Every action is logged and can be undone."
}
}
Sets the team rule (scope: team) or one campaign’s rule (scope: campaign). Rules apply to running campaigns only (not paused or archived).
When a mailbox in a campaign is dipped, the rule’s action decides what happens:
pause: the mailbox is taken out of that campaign’s rotation (its status in List senders becomesauto-paused). It stays connected and keeps sending for other campaigns. A pause never leaves a campaign with no mailbox that can send, so a single-mailbox campaign is never paused; useswapfor those.swap: the mailbox is replaced in that campaign with the first standby, in your order, that is connected, enabled, not dipped, under its daily limit and not already on the campaign.
The limits keep automation in check:
maxActionsPerDay(1 to 20, default 3): actions for the whole team per day (from midnight UTC).cooldownHours(1 to 168, default 24): at most one action per mailbox in this time, counted from its last action in any campaign, even if that action was undone.minSends(at least 20, default 50): the mailbox must have at least this many sends in the current 7-day window.
Every decision is logged, including the ones that were skipped (see Automatic action log), and every applied action can be undone.
Fields you leave out keep their current value; limits fields you leave out keep theirs. Turning automatic action off never needs confirm.
Turning automatic action on, or widening it while it is on, needs confirm: true. Widening means a different action, a new standby, a higher maxActionsPerDay, or a lower cooldownHours or minSends. Without confirm, the call answers confirmation_required (400) with a plain-language summary in data.summary, and nothing changes. Show the summary to the user before sending the call again with confirm: true.
The answer lists the team rule and, for scope: team, every campaign rule; for scope: campaign, only that campaign’s rule.
Requires the senders:write and campaigns:write scopes (legacy: campaign-write).
Costs 5 quota units.
You can send an Idempotency-Key header so that a retried request is not applied twice.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| scope | Yes | team for the team rule, or campaign for one campaign’s rule. |
|
| campaignID | With scope: campaign |
The campaign the rule is for. Ignored with scope: team. |
|
| enabled | Yes | true to turn automatic action on, false to turn it off. |
|
| action | current value, else pause |
No | pause or swap. Needed the first time a rule is turned on. |
| standbyIntegrationIDs | current value, else [] |
No | Mailboxes (integrationIDs) to swap in, tried in this order. Needed for swap. |
| limits | current values, else the defaults | No | An object: maxActionsPerDay, cooldownHours, minSends (see above). |
| notify | current value, else no one | No | An object: userIDs, the team members to notify when an action is applied. |
| confirm | false |
No | Must be true to turn automatic action on or widen it. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | scope or enabled is missing, or campaignID is missing with scope: campaign. |
| invalid_argument | 400 | scope isn’t team or campaign; enabled isn’t a boolean; action isn’t pause or swap (an action is needed the first time a rule is turned on); a limit is out of range; swap has no standby; a standby is repeated, isn’t a mailbox on your team, or (for a campaign rule) already sends for that campaign; a notify user isn’t on your team; an ID isn’t a positive whole number. |
| confirmation_required | 400 | The change turns automatic action on or widens it and confirm isn’t true. Nothing changed; data.summary describes the change. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have both senders:write and campaigns:write. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Automatic action log
curl "https://api.mailshake.com/2017-04-01/senders/auto-actions" \
-u "my-api-key:" \
-d status=applied \
-d perPage=20
This endpoint returns:
{
"results": [
{
"object": "auto-action",
"actionID": 9001,
"at": "2026-11-12T14:00:03.000Z",
"campaignID": 1,
"integrationID": 556,
"action": "swap",
"replacementIntegrationID": 601,
"reasons": [
{ "metric": "bounceRate", "current": 0.081, "baseline": 0.012 }
],
"status": "applied",
"skippedReason": null,
"threadsChangingSender": 4,
"undoneAt": null,
"undoneBy": null
}
],
"nextToken": "9001"
}
Lists every automatic decision for your team, newest first: actions that were applied, applied actions that were later undone, and decisions that were skipped.
reasonssays why the mailbox counted as dipped: themetric(bounceRateorreplyRate) with itscurrentandbaselinevalues.replacementIntegrationIDis the standby swapped in (swaponly).statusisapplied,undoneorskipped.skippedReasonsays why a decision was skipped:below-volume(fewer sends thanminSends),cooldown,daily-limit,would-empty-campaign(a pause would leave no mailbox able to send), orno-healthy-standby. If the change itself failed, it iserror:followed by the error code.threadsChangingSendercounts the recipients whose follow-ups will come from another mailbox.undoneAtandundoneBy(a user ID) are set once the action is undone.
Pass nextToken from the answer to get the next page; it is null on the last page.
Requires the senders:read scope (legacy: campaign-read).
Costs 2 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| from | No | Only decisions at or after this date and time (ISO 8601). | |
| to | No | Only decisions at or before this date and time (ISO 8601). | |
| campaignID | No | Only decisions for this campaign. | |
| integrationID | No | Only decisions about this mailbox. | |
| status | No | applied, undone or skipped. |
|
| nextToken | No | Fetches the next page from a previous request. | |
| perPage | 50 | No | How many results to get at once, up to 50. |
Errors
| Code | HTTP status | When |
|---|---|---|
| invalid_argument | 400 | perPage is above 50; status isn’t applied, undone or skipped; from or to isn’t a date; an ID isn’t a positive whole number. |
| not_found | 404 | campaignID doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token doesn’t have senders:read. |
Undo automatic action
curl "https://api.mailshake.com/2017-04-01/senders/undo-auto-action" \
-u "my-api-key:" \
-d actionID=9001
This endpoint returns:
{
"object": "auto-action",
"actionID": 9001,
"at": "2026-11-12T14:00:03.000Z",
"campaignID": 1,
"integrationID": 556,
"action": "swap",
"replacementIntegrationID": 601,
"reasons": [
{ "metric": "bounceRate", "current": 0.081, "baseline": 0.012 }
],
"status": "undone",
"skippedReason": null,
"threadsChangingSender": 4,
"undoneAt": "2026-11-12T15:10:44.000Z",
"undoneBy": 12,
"campaignResumed": false,
"campaignPausedReason": null
}
Reverses one applied automatic action. A pause is lifted, so the mailbox rejoins the campaign’s rotation. A swap puts the original mailbox back on the campaign and takes the standby off it. The answer is the action, now with status: undone, plus two fields about the campaign:
| Field | Description |
|---|---|
| campaignResumed | true when this undo resumed the campaign. That happens only when the mailbox came back as the campaign’s only sender after this action left the running campaign with no active mailbox, so the campaign paused. Otherwise false. |
| campaignPausedReason | null when the campaign is not paused after the undo. Otherwise why it stays paused (for example the user paused it), so you can tell the user to resume it. |
Undoing an action does not reset the cooldown: the mailbox can’t be acted on again until cooldownHours after the original action.
Requires the senders:write and campaigns:write scopes (legacy: campaign-write).
Costs 5 quota units.
You can send an Idempotency-Key header so that a retried request is not applied twice.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| actionID | Yes | The actionID from the Automatic action log. |
Errors
| Code | HTTP status | When |
|---|---|---|
| missing_parameter | 400 | actionID is missing. |
| invalid_argument | 400 | actionID isn’t a positive whole number, or (for a swap) the original mailbox is now disabled. |
| not_found | 404 | The action doesn’t exist or belongs to another team, or (for a swap) the standby is no longer on the campaign. |
| invalid_state | 400 | The action was skipped or is already undone; the original mailbox was deleted or needs to reconnect; (for a pause) the mailbox is no longer on the campaign; (for a swap) the campaign is archived or a template. |
| limit_reached | 429 | The campaign’s mailboxes were already changed 30 times this hour, or another change to them is still running. Retry later. |
| missing_scope | 401 | The token doesn’t have both senders:write and campaigns:write. |
| idempotency_conflict | 409 | The Idempotency-Key was already used with a different request, or that request is still running. |
Stats
These endpoints report sending, bounces and replies for a campaign or for a sending mailbox, over a date window you choose, plus a “dipped” flag that tells you when a mailbox’s deliverability or reply rate has dropped. They only read; nothing is changed.
Metrics (the same on every endpoint):
sent: emails sent (initial and follow-up).bounced: bounce notices received. Mailshake does not tell hard from soft bounces.delivered:sent - bounced(never below 0). This is an estimate: there are no delivery receipts.replied: distinct recipients who sent a real reply. Out-of-office and delay notices are not replies; they are counted asautoReplies.bounceRate:bounced / sent.replyRate:replied / delivered. Both are rounded to 4 decimals (0.0402 is 4.02%) and arenullwhen the denominator is 0.
Window. from and to are calendar days (YYYY-MM-DD) in timezone, and to is included. By default to is today in timezone and from is 29 days before to (30 days in all). The window is at most 90 days. timezone is an IANA name such as America/Chicago; the default is UTC. Every event counts on the day it happened in that timezone. The response echoes the window it used.
The dip rule. A mailbox’s signal compares two periods that end the day before to (bounces and replies arrive late):
- current: the 7 days ending the day before
to; - baseline: the 28 days before the current period.
If the current period has fewer than 50 sends or the baseline fewer than 100, status is insufficient-data. Otherwise the mailbox is dipped when either:
- its current bounce rate is at least 0.03 and at least the larger of 2 x the baseline bounce rate and the baseline bounce rate + 0.02; or
- the baseline reply rate is at least 0.01 and the current reply rate is at most half of it.
Each rule that fires adds an entry to reasons. If none fires, status is ok. The flag only reports; nothing is paused because of it.
All stats endpoints need the stats:read scope, and the sender ones also senders:read. The legacy campaign-read scope grants both.
Campaign stats
curl "https://api.mailshake.com/2017-04-01/campaigns/stats" \
-u "my-api-key:" \
-d campaignID=1 \
-d from=2026-10-15 \
-d to=2026-11-13 \
-d timezone=America/Chicago \
-d bySender=true
This endpoint returns:
{
"object": "campaign-stats",
"campaignID": 1,
"from": "2026-10-15",
"to": "2026-11-13",
"timezone": "America/Chicago",
"totals": {
"sent": 840,
"bounced": 21,
"delivered": 819,
"replied": 52,
"autoReplies": 11,
"opened": 610,
"clicked": 74,
"unsubscribed": 6
},
"rates": {
"bounceRate": 0.025,
"replyRate": 0.0635
},
"lifetime": {
"recipients": 500,
"sent": 1310,
"opened": 920,
"clicked": 101,
"replied": 88,
"bounced": 30,
"unsubscribed": 9,
"tasksCompleted": 4,
"callsMade": 2
},
"bySender": [
{
"integrationID": 1001,
"emailAddress": "outreach@example-domain.com",
"sent": 500,
"bounced": 9,
"delivered": 491,
"replied": 33,
"bounceRate": 0.018,
"replyRate": 0.0672
},
{
"integrationID": 1002,
"emailAddress": "sales@example-domain.com",
"sent": 340,
"bounced": 12,
"delivered": 328,
"replied": 19,
"bounceRate": 0.0353,
"replyRate": 0.0579
}
]
}
Totals and rates for one campaign over the window, its lifetime totals, and with bySender the same numbers split by sending mailbox.
totals uses the metrics above, plus:
autoReplies: out-of-office and delay notices.opened: distinct (recipient, message) opens, so one recipient opening two emails counts twice.clicked,unsubscribed: distinct recipients.
lifetime ignores the window. It counts only recipients who were sent at least one email: recipients is how many, sent is every email sent, opened is distinct (recipient, message) opens, and clicked, replied, bounced, unsubscribed are distinct recipients. callsMade is completed phone-call tasks; tasksCompleted is every other completed task.
bySender is left out unless you ask for it. Each event is credited to the mailbox that sent the email it belongs to; a reply that can’t be matched to an email goes to the mailbox that sent the recipient’s latest email. Only mailboxes still connected to your team are listed, sorted by integrationID, so the rows can add up to less than totals. replied counts distinct recipients per mailbox, so a recipient who replied to two mailboxes counts in both.
Results are cached for 60 seconds.
Requires the stats:read scope.
Costs 5 quota units, or 10 with bySender.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign’s ID. | |
| from | 29 days before to |
No | First day of the window, YYYY-MM-DD in timezone. |
| to | today | No | Last day of the window (included), YYYY-MM-DD in timezone. |
| timezone | UTC |
No | IANA timezone for event dates, such as America/Chicago. |
| bySender | false |
No | true adds the per-mailbox split (5 more quota units). |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing. |
| invalid_argument | 400 | campaignID is not a number; from or to is not a real YYYY-MM-DD date; from is after to; the window is over 90 days; timezone is unknown or not supported by Mailshake’s database. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token lacks stats:read. |
Campaign stats per day
curl "https://api.mailshake.com/2017-04-01/campaigns/stats-daily" \
-u "my-api-key:" \
-d campaignID=1 \
-d from=2026-11-11 \
-d to=2026-11-13 \
-d timezone=America/Chicago
This endpoint returns:
{
"object": "campaign-stats-daily",
"campaignID": 1,
"from": "2026-11-11",
"to": "2026-11-13",
"timezone": "America/Chicago",
"days": [
{
"date": "2026-11-11",
"sent": 40,
"bounced": 1,
"delivered": 39,
"replied": 3,
"autoReplies": 0,
"bounceRate": 0.025,
"replyRate": 0.0769
},
{
"date": "2026-11-12",
"sent": 0,
"bounced": 0,
"delivered": 0,
"replied": 0,
"autoReplies": 0,
"bounceRate": null,
"replyRate": null
},
{
"date": "2026-11-13",
"sent": 35,
"bounced": 0,
"delivered": 35,
"replied": 1,
"autoReplies": 1,
"bounceRate": 0,
"replyRate": 0.0286
}
]
}
One campaign’s sent, bounced, delivered, replied and auto-replies for each day of the window, with that day’s rates. Every day of the window is listed, oldest first; a day with no activity has zeros and null rates. replied counts distinct recipients per day, so the days can add up to more than the window total from Campaign stats.
Results are cached for 5 minutes.
Requires the stats:read scope.
Costs 5 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| campaignID | Yes | The campaign’s ID. | |
| from | 29 days before to |
No | First day, YYYY-MM-DD in timezone. |
| to | today | No | Last day (included), YYYY-MM-DD in timezone. |
| timezone | UTC |
No | IANA timezone that decides which day each event falls on. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | campaignID is missing. |
| invalid_argument | 400 | campaignID is not a number; from or to is not a real YYYY-MM-DD date; from is after to; the window is over 90 days; timezone is unknown or not supported by Mailshake’s database. |
| not_found | 404 | The campaign doesn’t exist or belongs to another team. |
| missing_scope | 401 | The token lacks stats:read. |
Sender stats
curl "https://api.mailshake.com/2017-04-01/senders/stats" \
-u "my-api-key:" \
-d integrationID=1002 \
-d from=2026-10-15 \
-d to=2026-11-13 \
-d timezone=America/Chicago
This endpoint returns:
{
"object": "sender-stats",
"integrationID": 1002,
"emailAddress": "sales@example-domain.com",
"from": "2026-10-15",
"to": "2026-11-13",
"timezone": "America/Chicago",
"totals": {
"sent": 1150,
"bounced": 26,
"delivered": 1124,
"replied": 38,
"autoReplies": 9
},
"rates": {
"bounceRate": 0.0226,
"replyRate": 0.0338
},
"today": {
"sent": 38,
"dailyCap": 50
},
"health": {
"needsReauth": false,
"hitQuotaDate": null,
"replyCheckFailureCount": 0,
"inCampaigns": 3
},
"signal": {
"status": "dipped",
"current": {
"from": "2026-11-06",
"to": "2026-11-12",
"sent": 280,
"bounced": 14,
"replied": 5,
"bounceRate": 0.05,
"replyRate": 0.0188
},
"baseline": {
"from": "2026-10-09",
"to": "2026-11-05",
"sent": 1100,
"bounced": 11,
"replied": 44,
"bounceRate": 0.01,
"replyRate": 0.0404
},
"reasons": [
{ "metric": "bounceRate", "current": 0.05, "baseline": 0.01 },
{ "metric": "replyRate", "current": 0.0188, "baseline": 0.0404 }
]
}
}
One mailbox’s totals and rates over the window, today’s sends, its health and its dip signal. integrationID is the id of the mailbox as returned by Senders > List.
totals uses the metrics above. Here sent counts emails sent from this mailbox, and each bounce, reply and auto-reply is credited to the mailbox that sent the email it belongs to (a reply that can’t be matched to an email goes to the mailbox that sent the recipient’s latest email). Because sends are counted from the mailbox’s emails rather than the campaign’s send events, these numbers can differ slightly from Campaign stats.
With campaignID, totals and rates count only that campaign. today, health and signal always cover the whole mailbox, and campaignID is echoed in the response only when you send it.
today.sent: emails sent today, as the sending limit counts them (today in the mailbox’s own schedule timezone, nottimezone).today.dailyCap: the mailbox’s daily sending limit, ornullif it has no schedule.health.needsReauth: the mailbox must be reconnected before it can send.health.hitQuotaDate: when the mail provider last refused a send for being over its quota (ISO 8601), ornull.health.replyCheckFailureCount: how many times in a row checking the mailbox for replies has failed.health.inCampaigns: how many campaigns use the mailbox, directly or in a rotation.signal: the dip flag.currentandbaselinegive each period’s dates, counts and rates;reasonslists the rules that fired, each with themetricand the current and baseline rates compared (anullrate is compared as 0). See the dip rule at the top of this section.
Results are cached for 5 minutes.
Requires the stats:read and senders:read scopes.
Costs 5 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| integrationID | Yes | The mailbox’s ID. | |
| campaignID | No | Count only this campaign’s sends, bounces and replies in totals. |
|
| from | 29 days before to |
No | First day of the window, YYYY-MM-DD in timezone. |
| to | today | No | Last day of the window (included), YYYY-MM-DD in timezone. The dip periods end the day before it. |
| timezone | UTC |
No | IANA timezone for event dates and the dip periods. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | integrationID is missing. |
| invalid_argument | 400 | integrationID or campaignID is not a number; from or to is not a real YYYY-MM-DD date; from is after to; the window is over 90 days; timezone is unknown. |
| not_found | 404 | The mailbox doesn’t exist, belongs to another team, or is a rotation placeholder rather than a real mailbox (message Sender not found); or campaignID doesn’t exist or belongs to another team (message Campaign not found). |
| missing_scope | 401 | The token lacks stats:read or senders:read. |
Sender stats per day
curl "https://api.mailshake.com/2017-04-01/senders/stats-daily" \
-u "my-api-key:" \
-d integrationID=1002 \
-d from=2026-11-11 \
-d to=2026-11-13 \
-d timezone=America/Chicago
This endpoint returns:
{
"object": "sender-stats-daily",
"integrationID": 1002,
"from": "2026-11-11",
"to": "2026-11-13",
"timezone": "America/Chicago",
"days": [
{
"date": "2026-11-11",
"sent": 45,
"bounced": 3,
"delivered": 42,
"replied": 1,
"autoReplies": 0,
"bounceRate": 0.0667,
"replyRate": 0.0238
},
{
"date": "2026-11-12",
"sent": 0,
"bounced": 0,
"delivered": 0,
"replied": 0,
"autoReplies": 0,
"bounceRate": null,
"replyRate": null
},
{
"date": "2026-11-13",
"sent": 38,
"bounced": 1,
"delivered": 37,
"replied": 0,
"autoReplies": 1,
"bounceRate": 0.0263,
"replyRate": 0
}
]
}
One mailbox’s sent, bounced, delivered, replied and auto-replies for each day of the window, counted as in Sender stats, with that day’s rates. Every day of the window is listed, oldest first; a day with no activity has zeros and null rates. This endpoint always covers the whole mailbox: it has no campaignID filter.
Results are cached for 5 minutes.
Requires the stats:read and senders:read scopes.
Costs 5 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| integrationID | Yes | The mailbox’s ID. | |
| from | 29 days before to |
No | First day, YYYY-MM-DD in timezone. |
| to | today | No | Last day (included), YYYY-MM-DD in timezone. |
| timezone | UTC |
No | IANA timezone that decides which day each event falls on. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | integrationID is missing. |
| invalid_argument | 400 | integrationID is not a number; from or to is not a real YYYY-MM-DD date; from is after to; the window is over 90 days; timezone is unknown. |
| not_found | 404 | The mailbox doesn’t exist, belongs to another team, or is a rotation placeholder. |
| missing_scope | 401 | The token lacks stats:read or senders:read. |
Sender stats list
curl "https://api.mailshake.com/2017-04-01/senders/stats-list" \
-u "my-api-key:" \
-d to=2026-11-13 \
-d timezone=America/Chicago \
-d perPage=2
This endpoint returns:
{
"object": "sender-stats-list",
"results": [
{
"integrationID": 1001,
"emailAddress": "outreach@example-domain.com",
"totals": {
"sent": 900,
"bounced": 9,
"delivered": 891,
"replied": 40,
"autoReplies": 5
},
"rates": {
"bounceRate": 0.01,
"replyRate": 0.0449
},
"signal": {
"status": "ok",
"current": {
"from": "2026-11-06",
"to": "2026-11-12",
"sent": 210,
"bounced": 2,
"replied": 9,
"bounceRate": 0.0095,
"replyRate": 0.0433
},
"baseline": {
"from": "2026-10-09",
"to": "2026-11-05",
"sent": 820,
"bounced": 8,
"replied": 36,
"bounceRate": 0.0098,
"replyRate": 0.0443
},
"reasons": []
}
},
{
"integrationID": 1002,
"emailAddress": "sales@example-domain.com",
"totals": {
"sent": 1150,
"bounced": 26,
"delivered": 1124,
"replied": 38,
"autoReplies": 9
},
"rates": {
"bounceRate": 0.0226,
"replyRate": 0.0338
},
"signal": {
"status": "dipped",
"current": {
"from": "2026-11-06",
"to": "2026-11-12",
"sent": 280,
"bounced": 14,
"replied": 5,
"bounceRate": 0.05,
"replyRate": 0.0188
},
"baseline": {
"from": "2026-10-09",
"to": "2026-11-05",
"sent": 1100,
"bounced": 11,
"replied": 44,
"bounceRate": 0.01,
"replyRate": 0.0404
},
"reasons": [
{ "metric": "bounceRate", "current": 0.05, "baseline": 0.01 },
{ "metric": "replyRate", "current": 0.0188, "baseline": 0.0404 }
]
}
}
],
"nextToken": "1002",
"from": "2026-10-15",
"to": "2026-11-13",
"timezone": "America/Chicago"
}
Every mailbox on your team with its window totals, rates and dip signal, counted as in Sender stats, sorted by integrationID, one page at a time. Rotation placeholders are never listed. Rows have no today or health; call Sender stats for those.
To get the next page, send the response’s nextToken back as nextToken, with the same other parameters. When nextToken is missing from the response, you have the last page. An unreadable nextToken starts again from the first page.
With status=dipped, each page keeps only the dipped mailboxes from the perPage mailboxes it looked at, so a page can hold fewer than perPage rows, or none, and still have a nextToken. Keep following nextToken until it is missing.
This endpoint is not cached.
Requires the stats:read and senders:read scopes.
Costs 10 quota units per page.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| status | No | dipped keeps only dipped mailboxes. No other value is accepted. |
|
| perPage | 50 | No | Mailboxes looked at per page, 1 to 50. |
| nextToken | No | The nextToken of the previous page. |
|
| from | 29 days before to |
No | First day of the window, YYYY-MM-DD in timezone. |
| to | today | No | Last day of the window (included), YYYY-MM-DD in timezone. The dip periods end the day before it. |
| timezone | UTC |
No | IANA timezone for event dates and the dip periods. |
Errors
| Code | HTTP | When |
|---|---|---|
| invalid_argument | 400 | status is not dipped; perPage is not a number or not 1 to 50; from or to is not a real YYYY-MM-DD date; from is after to; the window is over 90 days; timezone is unknown. |
| missing_scope | 401 | The token lacks stats:read or senders:read. |
Pushes
The type of request we’ll send to your servers:
{
"resource_url": "https://api.mailshake.com/2017-04-01/..."
}
let express = require('express');
let bodyParser = require('body-parser');
let PushHandler = require('mailshake-node').PushHandler;
// Start your web server
let app = express();
app.use(bodyParser.json({}));
// Hook up the Mailshake push handler
let handler = new PushHandler(mailshake, {
baseUrl: 'https://yourwebsite.com',
rootPath: 'path/to/your/handler',
secret: 'my-secret'
});
handler.on('push', push => {
console.log(JSON.stringify(push, null, 2));
});
handler.on('pushError', err => {
console.error(`${err.code}: ${err.stack}`);
});
handler.hookExpress(app);
// Start your server
app.listen(80);
// Verify that it's hooked up properly by visiting your site, something like:
// https://yourwebsite.com/path/to/your/handler/my-secret/some-unique-id
One of the cooler things you can do with the Mailshake API is subscribe to pushes. Whenever an action occurs that you’ve subscribed to, Mailshake will make a HTTP request to your servers so you can react in real time.
Your servers need to accept POST requests from us using the application/json content type. We’ll include a simple object with resource_url as its only key. Send an HTTP request to this url and be sure to include the same authentication as with our other API operations.
Your server should respond to us with a 200 status indicating that you’ve handled the request (otherwise we’ll wait and try a few more times in case your server is under maintenance).
Create
handler.subscribe('Clicked')
.then(targetUrl => {
// Save your targetUrl somewhere so you can unsubscribe later
})
.catch(err => {
console.error(`${err.code}: ${err.stack}`);
});
curl "https://api.mailshake.com/2017-04-01/push/create" \
-u "my-api-key:" \
-d event=Clicked \
-d targetUrl=https://mysite.com/some-secret/some-unique-id
Starts a subscription for a type of push.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| targetUrl | Yes | The publicly accessible url to your servers that we should send a POST request to. We highly recommend using https and including a secret key so that other actors can’t send requests as if they were Mailshake. |
|
| event | Yes | The type of event you’re subscribing to. | |
| filter | No | If you only want subscriptions when certain criteria are met, specify them as a JSON object. |
Filters
You can apply a filter to some events so that you only get pushes that meet certain criteria.
Filter fields:
| Field | Description |
|---|---|
| campaignID | To only get events for a specific campaign. |
| campaignMessageID | For events based on message, only get events for a specific message. |
| excludeDuplicates | true if you don’t want to get pushes for duplicate opens or clicks. |
| matchUrl | For clicks you can only be notified when this exact url is clicked. |
| messageType | For sent messages you can be notified only when certain types of messages are sent. |
Events
| Event | Description |
|---|---|
| Clicked | Someone clicked a link. |
| Opened | Someone opened an email. |
| Replied | Someone replied to one of your emails. Note: a Replied push is also sent for bounces, out-of-office replies and delay notices. Fetch the reply and read its type to count only real replies. |
| MessageSent | Mailshake sent an email on your behalf. |
| LeadCreated | A lead was created. |
| LeadStatusChanged | A lead’s status was changed. |
Delete
let targetUrl; // Look this up from when you subscribed
handler.unsubscribe(targetUrl)
.then(() => {
// Done
})
.catch(err => {
console.error(`${err.code}: ${err.message}`);
});
curl "https://api.mailshake.com/2017-04-01/push/delete" \
-u "my-api-key:" \
-d targetUrl=https://mysite.com/some-secret/some-unique-id
Unsubscribes a push you previously created. Since all subscribed pushes require a unique targetUrl, that’s all you need to send in to delete your push.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| targetUrl | Yes | The unique target url of a push. |
Webhooks (version 2)
A version 2 delivery:
{
"id": "evt_3f1c9a52-7d4e-4b8a-9c61-2e5b0d8f7a14",
"type": "email.bounced",
"created": 1794582245,
"teamID": 123,
"data": {
"object": "recipient-action",
"actionType": "Bounced",
"id": 456,
"recipientID": 789,
"campaignID": 12,
"campaignMessageID": 34,
"integrationID": 5,
"actionDate": "2026-11-13T15:04:05.000Z",
"resourceUrl": "https://api.mailshake.com/2017-04-01/activity/replies?recipientActionID=..."
}
}
Its headers:
Content-Type: application/json
User-Agent: Mailshake-Webhooks/2
Mailshake-Signature: t=1794582245,v1=cd9c5a4709bdaf4a5b926851711a08a26e6fa352c0003b4f0b527423d58d98a7
Mailshake-Delivery-Id: dlv_8a0e6c3b-2f71-4d59-b1e4-7c9d2a6f0b33
Version 2 subscriptions are signed, can listen to several events at once, and can be listed, tested and inspected. Create one with version: 2 (below). Version 1 subscriptions (one event, a resource_url payload) keep working as described above.
The full guide, with signature checks in Node and Python, is at api-docs.mailshake.com/v2/webhooks.html.
Payload
Mailshake sends a POST with a JSON body: id (the event ID, evt_...), type (the event), created (when the event happened, in unix seconds), teamID and data. data carries the IDs of what changed and, for most events, a resourceUrl: an API GET that returns the full record, called with your usual authentication. The body never holds a full copy of the record.
The same event can arrive more than once. De-duplicate on id.
Headers
Mailshake-Signature:t=<unix seconds>,v1=<signature>. In the 24 hours after a secret rotation there are twov1values, one per secret; accept either.Mailshake-Delivery-Id:dlv_..., one per delivery. Every retry of a delivery sends the same value.
Signature
v1 is the HMAC-SHA256 of the string <t>.<raw body>, keyed with your whole secret (whsec_ included, as UTF-8), written as lowercase hex. t is the time of this attempt, not the event’s created, so a retry carries a new t. To verify: recompute the HMAC from the raw request body before you parse it, compare it with each v1 value in constant time, and refuse a t too far from your clock (the guide uses 5 minutes).
Answering, retries and failures
- Answer with a 2xx status within 10 seconds. Redirects are not followed, so a 3xx counts as a failure.
- Any other answer, a timeout or a connection error is retried 8 times: after 5 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 8 hours and 8 hours (about 24 hours in all). After the 8th retry the delivery is dropped.
- Answer
410and the subscription is deleted. - Each failed attempt adds 1 to the subscription’s
consecutiveFailures; a 2xx sets it back to 0. At 50 the subscription is turned off (disabled: true), no more events are sent to it, and the team admins get an email. A turned-off subscription can’t be turned back on, and it keeps its URL and its place in the limit of 50: delete it, then create it again. - Targets that are or resolve to a loopback, private, link-local or reserved address are never contacted. Such a delivery fails like any other (
error: "blocked-target"in List deliveries). - A new subscription can take up to a minute to start receiving events.
Version 2 events
| Event | Sent when | data |
|---|---|---|
| email.sent | Mailshake sent an email. | A recipient action (see below). |
| email.opened | An email was opened. | A recipient action. |
| link.clicked | A link was clicked. | A recipient action, plus url. |
| reply.received | A reply came in. | A recipient action. |
| email.bounced | A bounce notice came in. | A recipient action. |
| reply.out_of_office | An out-of-office reply came in. | A recipient action. |
| recipient.unsubscribed | A recipient unsubscribed. | A recipient action. |
| sender.quota_hit | A mailbox hit its sending quota. | A recipient action, without integrationID or resourceUrl. |
| call.completed | A phone call was logged. | A recipient action, without integrationID or resourceUrl. |
| lead.created | A lead was created. | object: "lead", id, recipientID, campaignID, status, assignedToUserID, resourceUrl (Leads get). |
| lead.status_changed | A lead’s status changed. | As lead.created. |
| lead.assigned | A lead was reassigned. | As lead.created. |
| task.created | A task was created. | object: "task", id, recipientID, campaignID, completedDate. No resourceUrl. |
| task.completed | A task was completed. | As task.created. |
| sender.needs_reauth | A mailbox lost its connection and must be reconnected. | object: "sender", integrationID, emailAddress, affectedCampaignIDs. |
| campaign.paused | A campaign was paused. | object: "campaign", campaignID, byUserID. |
| campaign.resumed | A campaign was unpaused. | As campaign.paused. |
| sender.auto_action | An automatic action paused or swapped a mailbox in a campaign, or was undone. | actionID, campaignID, integrationID, action (pause or swap), replacementIntegrationID, status (applied or undone). |
A recipient action is object: "recipient-action", actionType, id, recipientID, campaignID, campaignMessageID, integrationID (the mailbox that sent the email), actionDate and resourceUrl (the matching activity call).
Send a test event sends a test.ping event, whose data is {"subscriptionID": <id>}. You can’t subscribe to it.
There is no “campaign completed” event: Mailshake doesn’t mark a campaign as completed today. A running campaign that Mailshake pauses because its last mailbox was removed sends campaign.paused too, with byUserID: null.
Create a v2 subscription
curl "https://api.mailshake.com/2017-04-01/push/create" \
-u "my-api-key:" \
-H "Content-Type: application/json" \
-d '{
"version": 2,
"targetUrl": "https://example.com/mailshake-hook",
"events": ["email.bounced", "reply.received"],
"filter": { "campaignID": 12 }
}'
This endpoint returns (HTTP 201):
{
"object": "push-subscription",
"id": 42,
"version": 2,
"targetUrl": "https://example.com/mailshake-hook",
"events": ["email.bounced", "reply.received"],
"filter": { "campaignID": 12 },
"disabled": false,
"disabledAt": null,
"consecutiveFailures": 0,
"created": "2026-11-13T15:04:05.000Z",
"secret": "whsec_zFMoCAJrKpDKeRDV6UvJLWCoeGAzBfgCNH6CUQugK8"
}
Creates a version 2 subscription for one or more events. The answer is the subscription plus its signing secret. The secret is shown only here: store it, because it verifies every delivery. If you lose it, use Rotate the signing secret.
A team can have at most 50 subscriptions, version 1 and 2 together, turned-off ones included. A URL can be used by only one of the team’s version 2 subscriptions; a version 1 subscription may share it.
Send the request as JSON so filter arrives as an object. When the call carries an Idempotency-Key and is repeated with the same key, it answers 409 idempotency_conflict instead of the first answer, because the secret is not kept.
Requires the webhooks:manage scope (the legacy campaign-write scope grants it). Costs 100 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| version | 1 |
Yes | 2 for a version 2 subscription. Any other value creates a version 1 subscription. |
| targetUrl | Yes | An https URL that accepts POST. target_url is accepted too. |
|
| events | Yes | The events to receive: an array, or a comma-separated string. Repeats are removed. | |
| filter | No | An object. campaignID sends only events of that campaign. campaignMessageID sends only recipient-action events of that message; it also stops every lead and task event. Campaign events and sender.auto_action follow campaignID only; sender.needs_reauth ignores the filter. Other fields are stored and ignored. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | targetUrl or events is missing or empty. |
| invalid_argument | 400 | An event isn’t in the list, the URL isn’t valid, or it isn’t https. |
| already_exists | 400 | One of the team’s version 2 subscriptions already uses this URL. |
| too_many_push_subscriptions | 400 | The team already has 50 subscriptions. |
| idempotency_conflict | 409 | The Idempotency-Key was used before (see above). |
| missing_scope | 401 | The token lacks webhooks:manage. |
| not_authorized | 400 | The call wasn’t made with an API key or token. |
List subscriptions
curl "https://api.mailshake.com/2017-04-01/push/list" \
-u "my-api-key:"
This endpoint returns:
{
"results": [
{
"object": "push-subscription",
"id": 41,
"version": 1,
"targetUrl": "https://example.com/some-secret/some-unique-id",
"event": "Clicked",
"filter": null,
"disabled": false,
"disabledAt": null,
"consecutiveFailures": 0,
"created": "2026-11-12T09:30:00.000Z"
},
{
"object": "push-subscription",
"id": 42,
"version": 2,
"targetUrl": "https://example.com/mailshake-hook",
"events": ["email.bounced", "reply.received"],
"filter": { "campaignID": 12 },
"disabled": false,
"disabledAt": null,
"consecutiveFailures": 0,
"created": "2026-11-13T15:04:05.000Z"
}
]
}
Lists all of the team’s subscriptions, version 1 and 2, oldest first, whoever created them. Secrets are never shown. A version 1 subscription has event; a version 2 one has events. disabled is true once a version 2 subscription was turned off after 50 failures in a row. Version 1 subscriptions always show consecutiveFailures: 0.
Requires the webhooks:manage scope (the legacy campaign-write scope grants it). Costs 2 quota units.
Parameters
None.
Errors
| Code | HTTP | When |
|---|---|---|
| missing_scope | 401 | The token lacks webhooks:manage. |
Get a subscription
curl "https://api.mailshake.com/2017-04-01/push/get?id=42" \
-u "my-api-key:"
This endpoint returns:
{
"object": "push-subscription",
"id": 42,
"version": 2,
"targetUrl": "https://example.com/mailshake-hook",
"events": ["email.bounced", "reply.received"],
"filter": { "campaignID": 12 },
"disabled": false,
"disabledAt": null,
"consecutiveFailures": 0,
"created": "2026-11-13T15:04:05.000Z"
}
Gets one of the team’s subscriptions (version 1 or 2), without its secret.
Requires the webhooks:manage scope (the legacy campaign-write scope grants it). Costs 1 quota unit.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| id | Yes | The subscription’s ID. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | id is missing or isn’t a positive whole number. |
| not_found | 404 | No subscription of your team has this ID (another team’s subscription answers the same). |
| missing_scope | 401 | The token lacks webhooks:manage. |
Send a test event
curl "https://api.mailshake.com/2017-04-01/push/test" \
-u "my-api-key:" \
-d id=42
This endpoint returns:
{
"delivered": true,
"httpStatus": 200,
"error": null,
"eventID": "evt_3f1c9a52-7d4e-4b8a-9c61-2e5b0d8f7a14",
"deliveryID": "dlv_8a0e6c3b-2f71-4d59-b1e4-7c9d2a6f0b33"
}
Sends one signed test.ping event to a version 2 subscription now, with the same headers and signature as a real delivery, and waits for the answer (up to 10 seconds). It is sent once, never retried, and doesn’t change consecutiveFailures. The attempt shows in List deliveries with isTest: true.
The call succeeds whatever your server answers. delivered is true for a 2xx answer. httpStatus is your server’s status, or null when there was no answer; then error names the failure (for example Error for a timeout or a connection that was refused).
Requires the webhooks:manage scope (the legacy campaign-write scope grants it). Costs 10 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| id | Yes | The subscription’s ID. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | id is missing or isn’t a positive whole number. |
| not_found | 404 | No subscription of your team has this ID. |
| invalid_state | 400 | The subscription is version 1. |
| invalid_argument | 400 | The URL is or resolves to a loopback, private or reserved address. |
| missing_scope | 401 | The token lacks webhooks:manage. |
Rotate the signing secret
curl "https://api.mailshake.com/2017-04-01/push/rotate-secret" \
-u "my-api-key:" \
-d id=42
This endpoint returns:
{
"id": 42,
"secret": "whsec_cQee48PMA3yynGWZZAMvGKKMyBdSvsjtmMiZ0",
"previousSecretValidUntil": "2026-11-14T15:04:05.000Z"
}
Gives a version 2 subscription a new signing secret, shown only in this answer. For the next 24 hours (until previousSecretValidUntil) each delivery carries two v1 signatures, one with the new secret and one with the old, so you can switch over without missing a delivery. Only one old secret is kept: rotating again within those 24 hours ends the older one at once.
Requires the webhooks:manage scope (the legacy campaign-write scope grants it). Costs 10 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| id | Yes | The subscription’s ID. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | id is missing or isn’t a positive whole number. |
| not_found | 404 | No subscription of your team has this ID. |
| invalid_state | 400 | The subscription is version 1 (it has no secret). |
| idempotency_conflict | 409 | Another rotation of the same subscription ran at the same moment. Rotate again. |
| missing_scope | 401 | The token lacks webhooks:manage. |
List deliveries
curl "https://api.mailshake.com/2017-04-01/push/deliveries?id=42" \
-u "my-api-key:"
This endpoint returns:
{
"results": [
{
"object": "push-delivery",
"deliveryID": "dlv_8a0e6c3b-2f71-4d59-b1e4-7c9d2a6f0b33",
"eventID": "evt_3f1c9a52-7d4e-4b8a-9c61-2e5b0d8f7a14",
"eventType": "email.bounced",
"attempt": 2,
"httpStatus": 200,
"durationMs": 184,
"error": null,
"isTest": false,
"created": "2026-11-13T15:09:07.000Z"
},
{
"object": "push-delivery",
"deliveryID": "dlv_8a0e6c3b-2f71-4d59-b1e4-7c9d2a6f0b33",
"eventID": "evt_3f1c9a52-7d4e-4b8a-9c61-2e5b0d8f7a14",
"eventType": "email.bounced",
"attempt": 1,
"httpStatus": 503,
"durationMs": 92,
"error": null,
"isTest": false,
"created": "2026-11-13T15:04:06.000Z"
}
]
}
The latest 100 delivery attempts of one subscription, newest first, with no paging. Each retry is its own row with the same deliveryID and a higher attempt. httpStatus is your server’s answer, or null when there was none; then error says why (blocked-target for a private address, interrupted when the attempt was cut off on our side, otherwise a short error name). An attempt still in progress shows httpStatus and error as null. Version 1 subscriptions have no delivery records, so they return an empty list.
Requires the webhooks:manage scope (the legacy campaign-write scope grants it). Costs 2 quota units.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| id | Yes | The subscription’s ID. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | id is missing or isn’t a positive whole number. |
| not_found | 404 | No subscription of your team has this ID. |
| missing_scope | 401 | The token lacks webhooks:manage. |
Delete a subscription
curl "https://api.mailshake.com/2017-04-01/push/delete" \
-u "my-api-key:" \
-d id=42
This endpoint returns:
{}
Deletes one of the team’s subscriptions by id, version 1 or 2, whoever created it. Deliveries already queued for it are dropped.
Deleting by targetUrl, as in Delete above, still works as before and only ever removes your own version 1 subscription; it never removes a version 2 subscription with the same URL. When both are sent, id is used.
Requires the webhooks:manage scope (the legacy campaign-write scope grants it). Costs 1 quota unit.
Parameters
| Parameter | Default | Required | Description |
|---|---|---|---|
| id | Yes | The subscription’s ID. |
Errors
| Code | HTTP | When |
|---|---|---|
| missing_parameter | 400 | id isn’t a positive whole number. |
| not_found | 404 | No subscription of your team has this ID. |
| missing_scope | 401 | The token lacks webhooks:manage. |
| not_authorized | 400 | The call wasn’t made with an API key or token. |
Models
Most models will have these common fields:
| Field | Type | Description |
|---|---|---|
| object | string | The type of model this data represents. |
| id | integer | The unique ID of this data. |
User
{
"object": "user",
"id": 1,
"teamID": 1,
"teamName": "My Team",
"isTeamAdmin": true,
"isDisabled": false,
"emailAddress": "me@example.com",
"fullName": "Jane Doe",
"first": "Jane",
"last": "Doe",
"teamBlockedDate": null
}
A Mailshake user and the team that they are on.
Campaign
{
"object": "campaign",
"id": 1,
"title": "My campaign",
"created": "2017-08-19T02:31:22.218Z",
"isArchived": false,
"isPaused": false,
"messages": [
{
"object": "message",
"id": 1,
"type": "initial",
"subject": "My subject",
"replyToID": null,
"isPaused": false
},
{
"object": "message",
"id": 2,
"type": "follow-up",
"subject": "null",
"replyToID": 1,
"isPaused": false
},
{
"object": "message",
"id": 3,
"type": "follow-up",
"subject": "null",
"replyToID": 1,
"isPaused": false
},
{
"object": "message",
"id": 4,
"type": "drip",
"subject": "Here's a drip email",
"replyToID": null,
"isPaused": false
},
{
"object": "message",
"id": 5,
"type": "on-click",
"subject": "You clicked my link",
"replyToID": null,
"isPaused": false
}
],
"sender": {
"object": "sender",
"id": "abc",
"emailAddress": "mysender@company.com",
"fromName": "Firm ABC",
"created": "2017-08-19T02:31:22.218Z"
},
"url": "https://mailshake.com/app/#/..."
}
A Mailshake campaign is the container for a sequence of messages and the recipients to whom they’ll be sent.
Notable fields:
| Field | Description |
|---|---|
| isArchived | Will be set to true if this campaign is archived. Archived campaigns must be unarchived via the web interface before they can be fully interacted with. |
Message
{
"object": "message",
"id": 423,
"type": "initial",
"subject": "My subject",
"replyToID": null,
"isPaused": false
}
{
"object": "message",
"id": 424,
"type": "follow-up",
"subject": null,
"replyToID": 423,
"isPaused": false
}
A message in your campaign such as a follow-up or a drip message.
Notable fields:
| Field | Description |
|---|---|
| replyToID | Only for follow-up messages, this is the message that indicates the root of the reply chain. If 4 messages will be sent in one reply chain, they’ll all have the same replyToID value. |
MessageTypes
| Type | Description |
|---|---|
| initial | The first email in a campaign. |
follow-up |
Replies to the initial message sent only if the recipient doesn’t reply. |
| drip | Secondary emails that are not stopped by a recipient’s reply. |
on-click |
Email fired whenever the recipient clicks a specific link in any of the emails. |
Sender
{
"object": "sender",
"id": "abc",
"emailAddress": "mysender@company.com",
"fromName": "Firm ABC",
"created": "2017-08-19T02:31:22.218Z"
}
A connected email address responsible for sending emails for their associated campaigns.
CreatedLeads
{
"leads": [
{
"recipientID": 1,
"leadID": 1
}
],
"emailsNotFound": [
"me@example.com"
],
"invalidEmails": [
"invalidexample.com"
],
"recipientIDsNotFound": [2, 3],
"isEmpty": false
}
The results of an attempt to create leads.
Notable fields:
| Key | Description |
|---|---|
| emailsNotFound | A list of email addresses that were not turned into leads because they did not match any recipients. |
| invalidEmails | A list of email addresses that were not turned into leads because they did not pass validation. |
| recipientIDsNotFound | A list of recipient IDs that were not found. |
| isEmpty | true if no email addresses or recipient IDs were actually turned into leads. |
LeadStatus
{
"status": "ignored",
"leadID": 1
}
The result of a status change of a lead. See Lead Statuses.
SentMessage
{
"object": "sent-message",
"id": 1,
"actionDate": "2017-04-06T17:45:07.188Z",
"recipient": {
"object": "recipient",
"id": 399,
"emailAddress": "john@doe.com",
"fullName": "John Doe",
"first": "John",
"last": "Doe",
"created": "2017-04-06T17:45:07.188Z",
"fields": {
"favorite_color": "Red"
}
},
"campaign": {
"object": "campaign",
"id": 248,
"title": "My Campaign",
"created": "2017-04-06T17:45:07.188Z"
},
"type": "campaign-message",
"message": {
"object": "message",
"id": 423,
"type": "initial",
"subject": "My subject"
},
"from": {
"object": "email-address",
"address": "sally@doe.com",
"fullName": "Sally Doe",
"first": "Sally",
"last": "Doe"
},
"to": [
{
"object": "email-address",
"address": "john@doe.com",
"fullName": "John Doe",
"first": "John",
"last": "Doe"
}
],
"subject": "This is my subject",
"externalID": "...",
"externalRawMessageID": "...",
"externalConversationID": "...",
"rawBody": "...",
"body": "...",
"plainTextBody": "..."
}
An email that was sent via Mailshake. Most messages have a messageType of campaign which means they were sent as part of a campaign sequence. Messages with one-off were manual replies sent via Lead Catcher.
Notable fields:
| Field | Description |
|---|---|
| message | For campaign sent messages, this is the message inside your campaign’s sequence. one-off sent messages will omit this field. |
| externalID | The ID of the email on the mail account’s platform. |
| externalRawMessageID | The actual ID of the email message from the emails’ headers. |
| externalConversationID | The ID of the email thread on the mail account’s platform. |
| rawBody | The raw HTML. |
| body | This is is the HTML with tracking and replies stripped out. |
| plainTextBody | A display-friendly version of the email body. |
Message Types
| Type | Description |
|---|---|
| one-off | An email sent as a manual reply via Lead Catcher. |
| campaign | An email sent as part of a campaign sequence. |
Open
{
"object": "open",
"id": 1,
"actionDate": "2017-04-06T17:40:23.194Z",
"isDuplicate": false,
"contactID": 1,
"recipient": {
"object": "recipient",
"id": 1,
"emailAddress": "john@doe.com",
"fullName": "John Doe",
"first": "John",
"last": "Doe",
"created": "2017-04-06T17:45:07.188Z",
"fields": {
"favorite_color": "Red"
}
},
"campaign": {
"object": "campaign",
"id": 1,
"title": "My Campaign",
"created": "2017-04-06T17:40:23.194Z"
},
"parent": {
"object": "sent-message",
"id": 1,
"type": "campaign-message",
"message": {
"object": "message",
"id": 1,
"type": "initial",
"subject": "My subject"
}
}
}
The result of a recipient opening one of your sent emails.
Notable fields:
| Field | Description |
|---|---|
| parent | An abbreviated version of the sent message that was opened. In most cases this is an email in your campaign sequence, but it could be a one-off email sent via Lead Catcher. |
| isDuplicate | true if this recipient is opening the email for the second or nth time. |
Click
{
"object": "click",
"id": 1,
"link": "http://google.com",
"actionDate": "2017-04-06T17:38:53.369Z",
"isDuplicate": false,
"contactID": 1,
"recipient": {
"object": "recipient",
"id": 1,
"emailAddress": "john@doe.com",
"fullName": "John Doe",
"first": "John",
"last": "Doe",
"created": "2017-04-06T17:45:07.188Z",
"fields": {
"favorite_color": "Red"
}
},
"campaign": {
"object": "campaign",
"id": 1,
"title": "My Campaign",
"created": "2017-04-06T17:40:23.194Z"
},
"parent": {
"object": "sent-message",
"id": 1,
"type": "campaign-message",
"message": {
"object": "message",
"id": 1,
"type": "initial",
"subject": "My subject"
}
}
}
The result of a recipient clicking a link in one of your sent emails.
Notable fields:
| Field | Description |
|---|---|
| link | The full url that was clicked. |
| parent | An abbreviated version of the sent message that was opened. In most cases this is an email in your campaign sequence, but it could be a one-off email sent via Lead Catcher. |
| isDuplicate | true if this recipient is clicking the link for the second or nth time. |
Reply
{
"object": "reply",
"id": 1,
"actionDate": "2017-04-06T17:42:54.475Z",
"recipient": {
"object": "recipient",
"id": 1,
"emailAddress": "john@doe.com",
"fullName": "John Doe",
"first": "John",
"last": "Doe",
"created": "2017-04-06T17:45:07.188Z",
"fields": {
"favorite_color": "Red"
}
},
"campaign": {
"object": "campaign",
"id": 1,
"title": "My Campaign",
"created": "2017-04-06T17:40:23.194Z"
},
"type": "out-of-office",
"parent": {
"object": "sent-message",
"id": 1,
"type": "campaign-message",
"message": {
"object": "message",
"id": 1,
"type": "initial",
"subject": "My subject"
}
},
"subject": "Re: This is my subject",
"externalID": "...",
"externalRawMessageID": "...",
"externalConversationID": "...",
"rawBody": "...",
"body": "...",
"plainTextBody": "...",
"contactID": 1,
}
Represents any kind of reply received from a recipient to one of your sent emails.
Notable fields:
| Field | Description |
|---|---|
| type | The type of reply. |
| parent | An abbreviated version of the sent message that was opened. In most cases this is an email in your campaign sequence, but it could be a one-off email sent via Lead Catcher. |
| externalID | The ID of the email on the mail account’s platform. |
| externalRawMessageID | The actual ID of the email message from the emails’ headers. |
| externalConversationID | The ID of the email thread on the mail account’s platform. |
| rawBody | The raw HTML. |
| body | This is is the HTML with tracking and replies stripped out. |
| plainTextBody | A display-friendly version of the email body. |
ReplyType
| Type | Description |
|---|---|
| reply | A normal reply. |
| bounce | Information about why your email bounced. |
| out-of-office | An “I’m out of the office” reply. Follow-ups will still be sent to these folks unless you pause them. |
| unsubscribe | The user was unsubscribed because their reply requested us to do so. |
| delay-notification | Your mail account indicated that your original message is still trying to be sent. |
Lead
{
"object": "lead",
"id": 1,
"created": "2017-04-11T16:13:51.956Z",
"openedDate": "2017-04-11T16:13:51.955Z",
"lastStatusChangeDate": null,
"contactID": 1,
"assignedOnDate": "2017-04-11T16:13:51.955Z",
"recipient": {
"object": "recipient",
"id": 1,
"emailAddress": "john@doe.com",
"fullName": "John Doe",
"first": "John",
"last": "Doe",
"created": "2017-04-06T17:45:07.188Z",
"fields": {
"favorite_color": "Red"
}
},
"campaign": {
"object": "campaign",
"id": 1,
"title": "My Campaign",
"created": "2017-04-11T16:13:51.956Z",
},
"status": "open",
"assignedTo": {
"object": "user",
"id": 1,
"emailAddress": "lucy@yourteam.com",
"fullName": "Lucy Doe",
"first": "Lucy",
"last": "Doe"
}
}
A recipient that was (at least at one time) a prospect. Leads are created in the open status and can be set closed, lost, or ignored.
Notable fields:
| Field | Description |
|---|---|
| status | The current status of this lead. |
Lead Statuses
| Status | Description |
|---|---|
| open | The lead is available for review. |
| ignored | The lead wasn’t worth pursuing. |
| closed | The lead turned into a successful interaction. |
| lost | The lead didn’t pan out. |
AddRecipientsRequest
{
"invalidEmails": ["oneexample.com", "twoexample.com"],
"isEmpty": false,
"checkStatusID": 1
}
Notable fields:
| Key | Description |
|---|---|
| invalidEmails | A list of email addresses that were not imported because they did not pass validation. |
| isEmpty | true if no email addresses were actually imported. |
| checkStatusID | An ID you can use to monitor the import. |
AddedRecipients
{
"isFinished": true,
"problems": {
"unsubscribedEmails": ["one@example.com"],
"alreadyInCampaignEmails": ["two@example.com"],
"passedAccountLimitEmails": ["three@example.com"],
"hasProblems": true
}
}
Describes the progress in adding a batch of recipients.
Notable fields for problems:
| Key | Description |
|---|---|
| unsubscribedEmails | A list of email addresses that are on your unsubscribe list. |
| alreadyInCampaignEmails | A list of email addresses that were already part of this campaign. |
| passedAccountLimitEmails | A list of email addresses that could not be imported because your campaign exceeded the number of allowed recipients it can hold. |
Recipient
{
"object": "recipient",
"id": 1,
"emailAddress": "john@doe.com",
"fullName": "John Doe",
"first": "John",
"last": "Doe",
"created": "2017-04-06T17:45:07.188Z",
"isPaused": false,
"contactID": 1,
"fields": {
"favorite_color": "Red"
}
}
Notable fields:
| Key | Description |
|---|---|
| fields | A simple JSON hash (not an array) of keys to values. Each field can be used as a text replacement. |
CampaignExportRequest
{
"isEmpty": false,
"checkStatusID": 1
}
Notable fields:
| Key | Description |
|---|---|
| isEmpty | true if no campaigns were actually exported. |
| checkStatusID | An ID you can use to monitor the export. |
CampaignExport
{
"isFinished": true,
"csvDownloadUrl": "https://.../something-unique.csv"
}
Notable fields:
| Key | Description |
|---|---|
| isFinished | true when the export is done, false to wait a bit and check again. |
| csvDownloadUrl | When finished, this is the url of the CSV file you can download containing your export. |
Errors
A raw error response looks like this:
{
"code": "invalid_api_key",
"error": "Invalid api key",
"time": "2017-08-21T13:23:11.814Z"
}
Mailshake uses the following error codes:
General errors
| Code | Description |
|---|---|
| invalid_api_key | The key you provided us was either missing or invalid. |
| missing_team_admin | Your team doesn’t have an active team administrator (check that your billing is up to date) |
| missing_dependent_data | The object on which you’re acting wasn’t found or you don’t have permission. An example would be trying to pause a campaign with an ID that doesn’t reference a campaign. |
| missing_parameter | Your request is missing a required parameter. |
| invalid_argument | One of your request’s parameters has a value we can’t accept (for example a port that isn’t allowed). The message names the parameter. |
| invalid_parameter | One of your request’s parameter is in an unsupported format. |
| not_authorized | Your credentials don’t allow you to execute this request. |
| not_found | A more semantically permissive version of missing_dependent_data. We’re splitting hairs a bit here, but generally speaking when this code is returned your application might just want to note the problem and carry on. Whereas if you encounter the missing_dependent_data error it’s more of a show-stopper. |
| exceeds_monthly_recipients | You can’t add this many recipients because you will pass your monthly quota allowance. You can contact us to request an increase. |
| user_not_admin | The user on file for your application must be an administrator of your team. |
| user_is_disabled | The user on file for your application must have an active account (check your billing) |
| missing_subscription | Your team must have an active and paid subscription to Mailshake. |
| team_blocked | Your team has been blocked while our compliance team runs a review of your usage of our platform. |
| limit_reached | Your application has exceeded it’s quota and must wait to make more requests, or you can contact us to request an increased quota. The message will indicate the next time you can try a request: Please wait and try again after: 2017-08-21T15:16:15.207Z |
| internal_error | Something general went wrong with Mailshake. This may be a temporary issue or we may have a bug (if so notify us). |
| unspecified_error | Your request was probably rejected by some kind of validation. |
Specific to senders
| Code | Description |
|---|---|
| sender_already_exists | (HTTP 409) A mail account with this address is already connected to your team. The error body includes its integrationID. |
| smtp_connection_failed | Mailshake couldn’t log in to the SMTP server with the details you sent (or the host doesn’t resolve yet). Check them, or try again later if the mailbox was just created. |
| imap_connection_failed | Mailshake couldn’t log in to the IMAP server with the details you sent (or the host doesn’t resolve yet). |
| sender_limit_reached | (HTTP 403) Your plan has no free mail account seat. Nothing is charged; upgrade your plan to add more mail accounts. |
| already-connected | You are not a team admin and have already connected a mail account; only team admins can connect more. |
A
sender_limit_reachederror looks like this:
{
"code": "sender_limit_reached",
"error": "Your plan does not allow additional mail accounts. Please upgrade your subscription.",
"time": "2026-11-05T13:23:11.814Z"
}
Newer operations
These codes come from the campaign senders, campaign management, sequence, stats, replies, unsubscribes, automatic action and webhook (version 2) operations. Each operation’s section lists when it returns them.
| Code | Description |
|---|---|
| missing_scope | (HTTP 401) Your token lacks a scope this operation needs. The message names the scope. |
| not_found | (HTTP 404) The object doesn’t exist or belongs to another team. |
| invalid_state | (HTTP 400) The object is in the wrong state for this action, for example an archived campaign, a draft that was already sent, or an action that was already undone. |
| confirmation_required | (HTTP 400) The change needs confirm: true. Nothing changed; data describes what would change. |
| idempotency_conflict | (HTTP 409) The Idempotency-Key was used with a different request, or that request is still running. |
| sending_paused | (HTTP 400) Mailshake has paused sending; try again later. |
| already_exists | (HTTP 400) That object already exists, for example a version 2 webhook with the same URL. |
| too_many_push_subscriptions | (HTTP 400) Your team has the maximum of 50 push subscriptions. |
| limit_reached | (HTTP 429) Besides the hourly quota, also used for per-operation caps: 30 reply sends per team per 10 minutes, and 30 mailbox changes per campaign per hour. |
| rate_limited | (HTTP 429) Too many requests per second. Wait for Retry-After. |
Specific to OAuth2
| Code | Description |
|---|---|
| unauthorized_request | Your request is missing authentication. |
| invalid_client | Your client_id or client_secret parameter is wrong. |
| invalid_grant | Your request for authorization is malformed. |
| app_not_approved | Your application is not allowed to be used by other teams. |
| invalid_token | Your token has expired. Try using your refresh token to get another access token. |
| missing_scope | (HTTP 401) Your token doesn’t have the scope this operation needs, or your authentication request did not specify any scopes. For example, a token granted only campaign-read gets this on any write. Ask the user to authorize the missing scope. |
Limits
Based on your plan with us, your API key will have a few limitations on your usage. You can contact us to request an increase.
New recipients / month
Each Mailshake campaign can hold up to 5,000 recipients. However, adding recipients through the Mailshake API is limited to a certain number per month. This isn’t a per-campaign limit, it’s accumulative across all campaigns. If your app attempts to exceed this limit, you’ll get the exceeds_monthly_recipients error back.
The monthly window is aligned with the calendar year. Ergo on the 1st of each month your recipient limit will reset.
Rate limits
As an example of quota units work, check this out:
// Quota units: 400
mailshake.campaigns.pause(1)
// Quota units: 395
mailshake.campaigns.pause(2)
mailshake.campaigns.pause(3)
// Quota units: 385
mailshake.recipients.add([ /* 32 recipients */ ])
// This ^^ costs 20 + 32, or 52
// Quota units: 343
// ...an hour passes by ...
// Quota units: 400
Each call to our API costs a varying number of “quota units,” and you’re allowed X quota units per hour to limit how frequently you can make requests. If you hit a limit, you’ll get the error code limit_reached. The error message will indicate when you can try again (see our error codes).
| Units | Operation |
|---|---|
| 10 | Campaigns > List |
| 5 | Campaigns > Pause |
| 25 | Campaigns > Unpause |
20 + N |
Campaigns > Export |
| 25 | Leads > Create |
| 5 | Leads > Close |
| 5 | Leads > Ignore |
| 5 | Leads > Reopen |
20 + N |
Recipients > Add |
| 10 | Recipients > List |
| 5 | Recipients > Pause |
| 10 | Recipients > Unpause |
| 2 | Recipients > Unsubscribe |
| 100 | Push > Create |
| 3 | Activity > Clicks |
| 2 | Activity > Opens |
| 1 | Activity > Sent |
| 10 | Activity > Replies |
| 5 | Activity > CreatedLeads |
| 5 | Activity > LeadStatusChanges |