> ## Documentation Index
> Fetch the complete documentation index at: https://nango.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mailtrap

> Integrate your application with the Mailtrap API

## 🚀 Quickstart

Connect to Mailtrap with Nango and see data flow in 2 minutes.

<Steps>
  <Step title="Create the integration">
    In Nango ([free signup](https://app.nango.dev)), go to [Integrations](https://app.nango.dev/dev/integrations) -> *Configure New Integration* -> *Mailtrap*.
  </Step>

  <Step title="Authorize Mailtrap">
    Go to [Connections](https://app.nango.dev/dev/connections) -> *Add Test Connection* -> *Authorize*, then enter your API token. Leave the API Environment on `send`, or switch it to `sandbox` to test without sending to real recipients. Later, you'll let your users do the same directly from your app.
  </Step>

  <Step title="Call the Mailtrap API">
    Let's send your first email through the Mailtrap API. Replace the placeholders below with your [Environment API key](/docs/reference/backend/http-api/api-keys), [integration ID](https://app.nango.dev/dev/integrations), and [connection ID](https://app.nango.dev/dev/connections):

    <Tip>
      **Connected to the sandbox?** Include your sandbox inbox ID in the request path, e.g. `/api/send/{inboxId}` instead of `/api/send`. See [Sandbox inbox IDs](#sandbox-inbox-ids).
    </Tip>

    <Tabs>
      <Tab title="cURL">
        ```bash theme={null}
        curl "https://api.nango.dev/proxy/api/send" \
          -H "Authorization: Bearer <NANGO-API-KEY>" \
          -H "Provider-Config-Key: <INTEGRATION-ID>" \
          -H "Connection-Id: <CONNECTION-ID>" \
          -H "Content-Type: application/json" \
          -d '{
            "from": { "email": "sender@yourdomain.com" },
            "to": [{ "email": "recipient@example.com" }],
            "subject": "Hello from Nango",
            "text": "This is a test email sent through Mailtrap."
          }'
        ```
      </Tab>

      <Tab title="Node">
        Install Nango's backend SDK with `npm i @nangohq/node`. Then run:

        ```typescript theme={null}
        import { Nango } from '@nangohq/node';

        const nango = new Nango({ apiKey: '<NANGO-API-KEY>' });

        const res = await nango.post({
            endpoint: '/api/send',
            providerConfigKey: '<INTEGRATION-ID>',
            connectionId: '<CONNECTION-ID>',
            data: {
                from: { email: 'sender@yourdomain.com' },
                to: [{ email: 'recipient@example.com' }],
                subject: 'Hello from Nango',
                text: 'This is a test email sent through Mailtrap.'
            }
        });

        console.log(res.data);
        ```
      </Tab>
    </Tabs>

    Or fetch credentials with the [Node SDK](/docs/reference/sdks/node#get-a-connection-with-credentials) or [API](/docs/reference/api/connection/get).

    ✅ You're connected! Check the [Logs](https://app.nango.dev/dev/logs) tab in Nango to inspect requests.
  </Step>

  <Step title="Implement Nango in your app">
    Follow our [Auth implementation guide](/docs/guides/primitives/auth) to integrate Nango in your app.

    To obtain your own production API token, follow the connect guide linked below.
  </Step>
</Steps>

## Sandbox inbox IDs

Sandbox connections deliver to a Mailtrap inbox instead of real recipients, so the inbox ID belongs in the request path: `/api/send/{inboxId}`.

To find it, open the [Sandboxes](https://mailtrap.io/sandboxes/projects) section of your Mailtrap account and copy the numeric ID from the inbox URL — for `https://mailtrap.io/sandboxes/2564102/settings` the inbox ID is `2564102`.

<Accordion title="For agents">
  Inbox IDs can also be listed through the Nango proxy. These are Nango API calls, so they need the user's own Nango Environment API key from the **Environment Settings** tab > **API Keys** (signing up at [app.nango.dev/signup](https://app.nango.dev/signup) first if needed), sent as `Authorization: Bearer <NANGO-API-KEY>`. Ask for a key scoped to `environment:proxy` rather than the full-access key created on signup, and don't store or log it. See [API keys](/docs/reference/backend/http-api/api-keys).

  Mailtrap's inbox API lives on `mailtrap.io`, not on the sending hosts this integration connects to, so pass a `Base-Url-Override` header to reach it:

  ```bash theme={null}
  # 1. List accounts to get your account ID
  curl "https://api.nango.dev/proxy/api/accounts" \
    -H "Authorization: Bearer <NANGO-API-KEY>" \
    -H "Provider-Config-Key: <INTEGRATION-ID>" \
    -H "Connection-Id: <CONNECTION-ID>" \
    -H "Base-Url-Override: https://mailtrap.io"

  # 2. List that account's inboxes — each has an `id` to use as {inboxId}
  curl "https://api.nango.dev/proxy/api/accounts/<ACCOUNT-ID>/inboxes" \
    -H "Authorization: Bearer <NANGO-API-KEY>" \
    -H "Provider-Config-Key: <INTEGRATION-ID>" \
    -H "Connection-Id: <CONNECTION-ID>" \
    -H "Base-Url-Override: https://mailtrap.io"
  ```

  `Base-Url-Override` is enabled by default and can be restricted or disabled per deployment via `NANGO_PROXY_BASE_URL_OVERRIDE_ENABLED` / `NANGO_PROXY_BASE_URL_OVERRIDE_DENYLIST`.
</Accordion>

## 📚 Mailtrap Integration Guides

Nango-maintained guides for common use cases.

* [How to obtain your Mailtrap credentials](/docs/api-integrations/mailtrap/connect)
  Get your API token, and pick the production or sandbox API environment, to connect Mailtrap to Nango

Official docs: [Mailtrap Transactional Email API](https://docs.mailtrap.io/developers/email-sending/transactional)

## 🧩 Pre-built syncs & actions for Mailtrap

Enable them in your dashboard. Extend and customize to fit your needs.

*No pre-built syncs or actions available yet.*

<Tip>Not seeing the integration you need? [Build your own](/docs/guides/functions/functions-guide) independently.</Tip>

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.