Skip to main content

Mailtrap

Mailtrap is an email delivery platform that provides sending, testing, and delivery infrastructure for developers, including transactional and bulk email. Its API lets you manage sending domains, suppressions, webhooks, and query sending statistics across your account.

Mailtrap icon

Power end-to-end data operations for your Mailtrap API with Nexla. Our bi-directional Mailtrap connector is purpose-built for Mailtrap, making it simple to ingest data, sync it across systems, and deliver it anywhere — all with no coding required. Nexla turns API-sourced data into ready-to-use, reusable data products and makes it easy to send data to Mailtrap or any other destination. With comprehensive monitoring, lineage tracking, and access controls, Nexla keeps your Mailtrap workflows fast, secure, and fully governed.

Features

Type: API

SourceDestination

  • Seamless API Integration: Connect to any endpoint as source or destination without coding, with automatic data product creation
  • Visual Composition & Chaining: Build complex integrations using visual templates, chain API calls, and compose workflows with data validation and filtering
  • API Proxy: Expose curated slices of your data securely with a secure and customizable API proxy that validates and transforms data on the fly
  • Request optimization with intelligent batching, retry, and caching to minimize API calls and costs

Prerequisites

Before creating a Mailtrap credential, you need a Mailtrap account and an API token. Mailtrap authenticates every API request with an API token, which is sent in the Authorization header as a bearer token (Authorization: Bearer {api_token}).

To obtain your Mailtrap API token, follow these steps:

  1. Sign in to your Mailtrap account at mailtrap.io.

  2. In the left menu, click Settings, then click API Tokens.

  3. Click Add Token to create a new API token. Give the token a descriptive name (for example, "Nexla Integration") and grant it Admin access to your account so it can manage domains, suppressions, and webhooks.

  4. Copy the generated token value and store it securely. The token does not have an expiration date, but it can be reset manually from the same API Tokens screen if it is ever compromised.

Mailtrap also creates a token automatically for each sending domain you add; that token is available under Sending Domains on the Integration tab. For account-level operations such as querying stats or managing suppressions across domains, an account API token with Admin access is recommended. For complete details, see the Mailtrap API documentation and the Mailtrap API Tokens guide.

Authenticate

Credentials required

FieldRequiredSecretDescription
API Key ValueYesYesAn encoded string value used as a secret token to authenticate API requests

Create a credential in Nexla

  1. After selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.

  2. Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.

  3. Enter your Mailtrap API token in the API Key Value field. Nexla sends this value in the Authorization header as a bearer token for all API requests to Mailtrap, so it must be kept confidential.

    If your API token is compromised, reset it from Settings > API Tokens in your Mailtrap account and update the credential in Nexla with the new value.

  4. Click the Save button at the bottom of the overlay. The newly added credential will now appear in a tile on the Authenticate screen during data source/destination creation.

Use as a data source

To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Select the Mailtrap connector tile, then select the credential that will be used to connect to Mailtrap, and click Next; or, create a new Mailtrap credential for use in this flow.

Endpoint templates

Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common Mailtrap endpoints. Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below.

[Rest API] List domains

This endpoint template retrieves the list of sending domains configured in your Mailtrap account. Use this template to inventory your domains, monitor their verification status, or feed domain metadata into downstream flows.

  • This endpoint requires no additional parameters and returns all domains accessible to your API token.

[Rest API] Create domain

This endpoint template creates a new sending domain in your Mailtrap account and returns the DNS records that must be configured to verify it. Use this template to provision a sending domain and capture the DNS records it produces.

  • Domain: The domain name to add to your Mailtrap account. This is sent in the request body.

[Rest API] Get domain

This endpoint template retrieves the details and DNS records for a single sending domain. Use this template to check a specific domain's verification status and configuration.

  • Domain Id: The identifier of the domain to retrieve. This is used in the request path.

[Rest API] Update domain

This endpoint template updates an existing sending domain and returns its current DNS records. Use this template to modify a domain's configuration in your Mailtrap account.

  • Domain Id: The identifier of the domain to update. This is used in the request path.
  • Domain: The updated domain value. This is sent in the request body.

[Rest API] Get company info

This endpoint template retrieves the company information associated with a sending domain. Use this template to read the company details configured for a specific domain.

  • Domain Id: The identifier of the domain whose company info you want to retrieve. This is used in the request path.

[Rest API] List suppressions

This endpoint template retrieves the suppression list for your Mailtrap account. Suppressions are recipient addresses that Mailtrap will not send to, such as bounced or unsubscribed contacts. Use this template to sync suppression data for reporting or list hygiene.

  • Email: Optional filter to return suppressions matching a specific email address.
  • Start Time and End Time: Optional filters to restrict results to a time window.
  • Last Id: Optional cursor used to page through results.

[Rest API] Get Sending Stats

This endpoint template retrieves aggregate sending statistics for your account. Use this template to pull delivery, bounce, and engagement metrics for analysis and reporting.

  • Start Date and End Date: Optional filters to define the reporting window.
  • Domain Ids[], Sending Streams[], Categories[], and Email Service Providers[]: Optional filters to narrow the statistics returned.

[Rest API] Get Sending Stats by Domains

This endpoint template retrieves sending statistics broken down by sending domain. Use this template to compare delivery performance across the domains in your account.

  • Start Date and End Date: Optional filters to define the reporting window.
  • Domain Ids[], Sending Streams[], Categories[], and Email Service Providers[]: Optional filters to narrow the statistics returned.

[Rest API] Get Sending Stats by Categories

This endpoint template retrieves sending statistics broken down by category. Use this template to analyze delivery performance across the message categories you assign when sending.

  • Start Date and End Date: Optional filters to define the reporting window.
  • Domain Ids[], Sending Streams[], Categories[], and Email Service Providers[]: Optional filters to narrow the statistics returned.

[Rest API] Get Sending Stats by Email Service Providers

This endpoint template retrieves sending statistics broken down by recipient email service provider. Use this template to understand how your email performs across providers such as Gmail, Outlook, and Yahoo.

  • Start Date and End Date: Optional filters to define the reporting window.
  • Domain Ids[], Sending Streams[], Categories[], and Email Service Providers[]: Optional filters to narrow the statistics returned.

[Rest API] Get Sending Stats by Date

This endpoint template retrieves sending statistics broken down by date. Use this template to build time-series reports of your account's delivery and engagement metrics.

  • Start Date and End Date: Optional filters to define the reporting window.
  • Domain Ids[], Sending Streams[], Categories[], and Email Service Providers[]: Optional filters to narrow the statistics returned.

Once the selected endpoint template has been configured, click the Test button to the right of the endpoint selection menu to retrieve a sample of the data that will be fetched. Sample data will be displayed in the Endpoint Test Result panel on the right, allowing you to verify that the source is configured correctly before saving.

Manual configuration

Mailtrap data sources can also be manually configured to ingest data from any valid Mailtrap API endpoint, including endpoints not covered by the pre-built templates, chained API calls, or custom request parameters. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, endpoint URL, date/time and lookup macros, path to data, metadata, and request headers.

Once all of the relevant settings have been configured, click the Create button in the upper right corner of the screen to save and create the new Mailtrap data source. Nexla will now begin ingesting data from the configured endpoint and will organize any data that it finds into one or more Nexsets.

Use as a destination

Click the + icon on the Nexset that will be sent to the Mailtrap destination, and select the Send to Destination option from the menu. Select the Mailtrap connector from the list of available destination connectors, then select the credential that will be used to connect to Mailtrap, and click Next; or, create a new Mailtrap credential for use in this flow.

Endpoint templates

Nexla provides pre-built templates that can be used to rapidly configure destinations to send data to common Mailtrap endpoints. Select the endpoint to which data will be sent from the Endpoint pulldown menu. Then, click on the template in the list below to expand it, and follow the instructions to configure additional endpoint settings.

[Rest API] Delete domain

This endpoint template deletes a sending domain from your Mailtrap account using records from a Nexset. Use this template to automate removal of domains you no longer send from.

  • Domain Id: The identifier of the domain to delete. This is used in the request path.

[Rest API] Send setup instructions

This endpoint template sends domain setup instructions to a specified email address. Use this template to forward the DNS configuration steps for a domain to a teammate responsible for completing verification.

  • Domain Id: The identifier of the domain whose setup instructions will be sent. This is used in the request path.
  • Email: The recipient address the instructions will be sent to.

[Rest API] Create company info

This endpoint template creates the company information for a sending domain using records from a Nexset. Use this template to populate the company details required for a domain.

  • Domain Id: The identifier of the domain to associate the company info with. This is used in the request path.
  • Company Info: The company information payload sent in the request body.

[Rest API] Update company info

This endpoint template updates the company information for a sending domain using records from a Nexset. Use this template to keep a domain's company details current.

  • Domain Id: The identifier of the domain whose company info will be updated. This is used in the request path.
  • Company Info: The updated company information payload sent in the request body.

[Rest API] Create suppression

This endpoint template adds an address to your account's suppression list using records from a Nexset. Use this template to programmatically suppress recipients so Mailtrap stops sending to them.

  • Email: The recipient address to suppress.
  • Domain Id: The domain the suppression applies to.
  • Sending Stream: The sending stream the suppression applies to.
  • Type: The type of suppression to create.

[Rest API] Delete suppression

This endpoint template removes an address from your account's suppression list using records from a Nexset. Use this template to re-enable sending to a previously suppressed recipient.

  • Suppression Id: The identifier of the suppression to delete. This is used in the request path.

[Rest API] Create a webhook

This endpoint template creates a webhook in your Mailtrap account using records from a Nexset. Use this template to register endpoints that should receive Mailtrap event notifications.

  • Webhook: The webhook configuration payload sent in the request body.

[Rest API] Update a webhook

This endpoint template updates an existing webhook using records from a Nexset. Use this template to change a webhook's configuration.

  • Webhook Id: The identifier of the webhook to update. This is used in the request path.
  • Webhook: The updated webhook configuration payload sent in the request body.

[Rest API] Delete a webhook

This endpoint template deletes a webhook from your Mailtrap account using records from a Nexset. Use this template to remove event notification endpoints you no longer need.

  • Webhook Id: The identifier of the webhook to delete. This is used in the request path.

Manual configuration

Mailtrap destinations can also be manually configured to send data to any valid Mailtrap API endpoint. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, data format, endpoint URL, request headers, attribute exclusions, record batching, and response webhooks.

Mailtrap APIs typically expect JSON format for most operations. For update operations, include the ID of the object to be updated at the end of the URL.

Save & activate

Once all endpoint settings have been configured, click the Done button in the upper right corner of the screen to save and create the destination. To send the data to the configured Mailtrap endpoint, open the destination resource menu, and select Activate.

The Nexset data will not be sent to the Mailtrap endpoint until the destination is activated. Destinations can be activated immediately or at a later time, providing full control over data movement.