Mailtrap

App · 20 actions

Manage email sandboxes and projects; inspect captured messages and delivery diagnostics.

Actions

ActionWhat it does
Analyze message htmlCheck a test email's HTML for parts that email clients don't support, returning each problem found and which clients it affects.
Clean sandboxDelete every test email in a sandbox, leaving the sandbox itself in place.
Create projectCreate a new Email Sandbox project with the given name in an account.
Create sandboxCreate a new email sandbox with the given name in a project.
Delete messageDelete one test email from a sandbox by its ID.
Delete projectDelete a sandbox project from an account by its ID.
Delete sandboxDelete an email sandbox by its ID, along with all the test emails in it.
Get messageGet one test email in a sandbox by its ID, returning its sender, recipients, subject, sent time, size and links to its body.
Get message headersGet the full email headers of a test email in a sandbox, such as its sender, recipients, date and message ID.
Get projectGet one sandbox project by its ID, returning its name and the sandboxes in it.
Get sandboxGet one email sandbox by its ID, returning its name, email address, SMTP settings and message counts.
Get spam reportGet the spam analysis of a test email, returning its overall spam score and the rules it triggered.
List accountsList the Mailtrap accounts the API token can reach, returning each account's ID, name and your access level.
List messagesList the test emails caught in a sandbox, optionally matching a search term.
List projectsList the Email Sandbox projects in an account, returning each project with its ID, name and sandboxes.
List sandboxesList the email sandboxes (test inboxes) in an account, returning each one's ID, name, email address and message counts.
Send test emailCapture a test email in a Mailtrap sandbox.
Update messageMark a test email in a sandbox as read or unread.
Update projectRename a sandbox project by its ID.
Update sandboxChange an email sandbox's name or the username part of its email address.

Analyze message html

Check a test email's HTML for parts that email clients don't support, returning each problem found and which clients it affects.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.
Message IDmessage_idnumberRequired
Message ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "errors": [],
    "status": "example"
  }
}

Clean sandbox

Delete every test email in a sandbox, leaving the sandbox itself in place. Returns the emptied sandbox.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {}
}

Create project

Create a new Email Sandbox project with the given name in an account. Returns the new project and its ID.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
NamenametextRequired
Name.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "id": 1,
    "inboxes": [],
    "name": "example"
  }
}

Create sandbox

Create a new email sandbox with the given name in a project. Returns the new sandbox with its ID and SMTP settings.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Projectproject_idnumberRequired
Project ID.At least 1.
NamenametextRequired
Name.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "id": 1,
    "name": "example",
    "project_id": 1
  }
}

Delete message

Delete one test email from a sandbox by its ID.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.
Message IDmessage_idnumberRequired
Message ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {}
}

Delete project

Delete a sandbox project from an account by its ID.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Projectproject_idnumberRequired
Project ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {}
}

Delete sandbox

Delete an email sandbox by its ID, along with all the test emails in it.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {}
}

Get message

Get one test email in a sandbox by its ID, returning its sender, recipients, subject, sent time, size and links to its body.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.
Message IDmessage_idnumberRequired
Message ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "created_at": "example",
    "id": 1,
    "inbox_id": 1,
    "is_read": false,
    "sent_at": "example",
    "subject": "example"
  }
}

Get message headers

Get the full email headers of a test email in a sandbox, such as its sender, recipients, date and message ID.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.
Message IDmessage_idnumberRequired
Message ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "headers": {}
  }
}

Get project

Get one sandbox project by its ID, returning its name and the sandboxes in it.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Projectproject_idnumberRequired
Project ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "id": 1,
    "inboxes": [],
    "name": "example"
  }
}

Get sandbox

Get one email sandbox by its ID, returning its name, email address, SMTP settings and message counts.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "id": 1,
    "name": "example",
    "project_id": 1
  }
}

Get spam report

Get the spam analysis of a test email, returning its overall spam score and the rules it triggered.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.
Message IDmessage_idnumberRequired
Message ID.At least 1.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "Details": [],
    "Score": 1.0,
    "Spam": false
  }
}

List accounts

List the Mailtrap accounts the API token can reach, returning each account's ID, name and your access level.

Inputs

None.

Outputs

datalist
Response.
Example output
{
  "data": []
}

List messages

List the test emails caught in a sandbox, optionally matching a search term. Returns one page; pass the last message ID for the next page.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.
Last IDlast_idnumber
Last ID.At least 1.
Searchsearchtext
Search.

Outputs

datalist
Response.
Example output
{
  "data": []
}

List projects

List the Email Sandbox projects in an account, returning each project with its ID, name and sandboxes.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.

Outputs

datalist
Response.
Example output
{
  "data": []
}

List sandboxes

List the email sandboxes (test inboxes) in an account, returning each one's ID, name, email address and message counts.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.

Outputs

datalist
Response.
Example output
{
  "data": []
}

Send test email

Capture a test email in a Mailtrap sandbox. No email is delivered to real recipients.

Inputs

Accountaccount_idnumberRequired
Account id.At least 1.
Inboxinbox_idnumberRequired
Inbox id.At least 1.
Sender emailsender_emailtextRequired
Sender email.
Recipient emailsrecipient_emailslistRequired
Recipient emails.
SubjectsubjecttextRequired
Subject.
TexttexttextRequired
Text.
Htmlhtmltext
Html.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "message_ids": [],
    "success": false
  }
}

Update message

Mark a test email in a sandbox as read or unread. Returns the updated message.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.
Message IDmessage_idnumberRequired
Message ID.At least 1.
Is readis_readtrue/falseRequired
Is read.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "created_at": "example",
    "id": 1,
    "inbox_id": 1,
    "is_read": false,
    "sent_at": "example",
    "subject": "example"
  }
}

Update project

Rename a sandbox project by its ID. Returns the updated project.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Projectproject_idnumberRequired
Project ID.At least 1.
NamenametextRequired
Name.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "id": 1,
    "inboxes": [],
    "name": "example"
  }
}

Update sandbox

Change an email sandbox's name or the username part of its email address. Returns the updated sandbox.

Inputs

Accountaccount_idnumberRequired
Account ID.At least 1.
Inboxinbox_idnumberRequired
Inbox ID.At least 1.
Namenametext
Name.
Email usernameemail_usernametext
Email username.

Outputs

dataobject
Response.
Example output
{
  "data": {
    "id": 1,
    "name": "example",
    "project_id": 1
  }
}

On this page