Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to MailerSend

Scalekit connector
Open markdown

The MailerSend connector lets your AI agent act in each user's MailerSend account. Each user connects their own MailerSend access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 56 tools.

Tools
56
What they doRead · write · destructive
31 · 17 · 831 read17 write8 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the MailerSend connection

    In AgentKit > Connections, create a MailerSend connection. The name you give it is the connection_name your code passes. See Configure connections.

    Console steps with screenshots

    Register a MailerSend API token with Scalekit so it can call MailerSend on behalf of your users. MailerSend sends the token as a Bearer token. You need a MailerSend account with at least one domain added, because each token is created for a domain.

    1. Create a MailerSend API token

      • Sign in to MailerSend and go to Developer Tools → API tokens.
      • Click Create new token and give it a name, such as Scalekit.
      • Select the domain the token is for.
      • Set an expiration date. If you leave it empty, MailerSend expires the token after 24 hours.
      • Choose the access: Full access, or Custom access with the endpoints your agent uses, such as Email to send and Activity or Analytics to read. A call outside the token’s access fails with 403.
      • Click Generate token and copy the token. It starts with mlsn..

      See MailerSend’s Managing API tokens for every access option.

    2. Create a connection in Scalekit

      • In the Scalekit dashboard, go to AgentKit → Connections → Create Connection.
      • Search for MailerSend and click Create.
      • Note the Connection name. Use it as connection_name in your code, for example mailersend.
    3. Add a connected account

      A connected account links a user ID in your app to a MailerSend API token. Add one in the dashboard to test. In production, each user adds their own through the authorization link: they paste their MailerSend API token on the page it opens.

      In the dashboard, to test

      • Open the connection and click the Connected Accounts tab → Add account.
      • Fill in Your User’s ID and API Token, then click Save.

      From your backend, if your app already has the token

      For example, when users enter it on a settings page in your app:

      import { ConnectorStatus } from '@scalekit-sdk/node'
      const { connectedAccount } = await scalekit.actions.upsertConnectedAccount({
      connectionName: 'mailersend',
      identifier: 'user_123',
      authorizationDetails: {
      details: {
      case: 'staticAuth',
      value: { details: { token: process.env.USER_MAILERSEND_TOKEN } },
      },
      },
      });
      console.log(connectedAccount && ConnectorStatus[connectedAccount.status]);
  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'mailersend'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize MailerSend:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'mailersend_account_get',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their MailerSend credentials there. If your app already has a user's credentials, add the account from your backend instead, as the console steps above show. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • mailersend_account_getGet the account's plan, email usage, rate limits and resource limits.Read-only

    Get Account

    Get the account's plan, email usage, rate limits and resource limits. Returns name, status, plan_type, data_retention_days, emails (sent, received, limit), rate_limits, resources and addons.

    Inputs

    This tool takes no inputs.

  • mailersend_activity_listList raw email events (sent, delivered, bounced, opened, clicked, unsubscribed and more) for a domain in a date range.Read-only

    List Email Activity

    List raw email events (sent, delivered, bounced, opened, clicked, unsubscribed and more) for a domain in a date range. Returns data, an array of activities with id, type, created_at and the email (from, subject, recipient, status), plus meta and links for paging.

    Inputs

    date_fromstringrequired
    Start of the range: a Unix timestamp, ISO 8601 (2026-11-01T00:00:00Z) or 'YYYY-MM-DD HH:MM:SS', in UTC. Example: 2026-11-01T00:00:00Z
    date_tostringrequired
    End of the range, in the same formats as date_from; must be later than date_from. Example: 2026-11-13T23:59:59Z
    domain_idstringrequired
    Domain ID (from mailersend_domains_list) Example: jy7zpl9xqo4l5vx6
    eventarray
    Only these event types. Example: ["delivered", "hard_bounced"]
    limitinteger
    Results per page, 10 to 100. Defaults to 25. Example: 25
    pageinteger
    Page number to return, starting at 1. Example: 1
  • mailersend_analytics_by_date_getGet counts of email events per day, week, month or year over a range of up to 183 days.Read-only

    Get Analytics by Date

    Get counts of email events per day, week, month or year over a range of up to 183 days. Returns data with date_from, date_to, group_by and stats, an array of buckets with date and a count per requested event. Use mailersend_analytics_opens_by_get for opens by country or email client.

    Inputs

    date_fromstringrequired
    Start of the range: a Unix timestamp, ISO 8601 (2026-11-01T00:00:00Z) or 'YYYY-MM-DD HH:MM:SS', in UTC. Example: 2026-11-01
    date_tostringrequired
    End of the range, in the same formats as date_from; must be later than date_from (not in the future) Example: 2026-11-13
    eventarrayrequired
    Events to count. Example: ["sent", "delivered", "opened", "clicked"]
    domain_idstring
    Domain ID (from mailersend_domains_list); leave empty for all domains. Example: jy7zpl9xqo4l5vx6
    group_bystring
    Bucket size. Defaults to days. Example: daysone of daysweeksmonthsyears
    tagsarray
    Only emails with these tags. Example: ["order-shipped"]
  • mailersend_analytics_opens_by_getGet email opens broken down by recipient country, email client name or client type over a range of up to 183 days.Read-only

    Get Opens by Country or Client

    Get email opens broken down by recipient country, email client name or client type over a range of up to 183 days. Returns data with date_from, date_to and stats, an array with name (country code, client or type) and count.

    Inputs

    date_fromstringrequired
    Start of the range: a Unix timestamp, ISO 8601 (2026-11-01T00:00:00Z) or 'YYYY-MM-DD HH:MM:SS', in UTC. Example: 2026-11-01
    date_tostringrequired
    End of the range, in the same formats as date_from; must be later than date_from (not in the future) Example: 2026-11-13
    dimensionstringrequired
    Breakdown: country, ua-name (email client name) or ua-type (client type) Example: countryone of countryua-nameua-type
    domain_idstring
    Domain ID (from mailersend_domains_list); leave empty for all domains. Example: jy7zpl9xqo4l5vx6
    tagsarray
    Only emails with these tags. Example: ["order-shipped"]
  • mailersend_api_quota_getCheck how many API requests remain in the current daily quota.Read-only

    Get API Quota

    Check how many API requests remain in the current daily quota. Does not count toward the quota. Returns quota, remaining and reset (when the quota resets).

    Inputs

    This tool takes no inputs.

  • mailersend_bulk_email_status_getCheck the progress and result of a bulk email request.Read-only

    Get Bulk Email Status

    Check the progress and result of a bulk email request. Returns data with state (queued, processing, completed), total_recipients_count, suppressed_recipients_count, validation_errors_count, messages_id and validation_errors.

    Inputs

    bulk_email_idstringrequired
    Bulk email ID returned by mailersend_bulk_email_send. Example: 614470d1588b866d0454f3e2
  • mailersend_domain_dns_records_getGet the DNS records (SPF, DKIM, return-path, custom tracking, inbound routing) to publish for a domain.Read-only

    Get Domain DNS Records

    Get the DNS records (SPF, DKIM, return-path, custom tracking, inbound routing) to publish for a domain. Returns data with each record's hostname, type, value and status.

    Inputs

    domain_idstringrequired
    Domain ID. Example: jy7zpl9xqo4l5vx6
  • mailersend_domain_getRetrieve one domain with its verification status and settings.Read-only

    Get Domain

    Retrieve one domain with its verification status and settings. Returns data with id, name, dkim, spf, tracking, is_verified, is_dns_active and domain_settings.

    Inputs

    domain_idstringrequired
    Domain ID. Example: jy7zpl9xqo4l5vx6