Skip to content

Authentication

MX18 uses a secure, token-based authentication mechanism to validate all email sending requests — both via API and SMTP.


Getting your API token

An API token is automatically generated for your account at the time of signup.

You can view or regenerate it anytime via the MX18 web app:

  1. Go to app.mx18.com
  2. Navigate to Settings > API Keys
  3. Copy your existing token or create a new one

⚠️ Treat your API token like a password. Keep it secret, do not share it publicly or commit it to source code repositories.


Using the token with mail send API

To send emails via API, you must include the x-api-key header with the api_key_value for every request.

Endpoint

POST https://api.mx18.com/api/1/mail/send

Required Header

X-Api-Key : "value"

Sample request

curl --location 'https://api.mx18.com/api/1/mail/send' \
--header 'X-Api-Key: mx18_yourtoken' \
--header 'Content-Type: application/json' \
--data-raw '{
  "from": {
    "name": "your_from_name",
    "email": "info@example.com"
  },
  "to": [
    {
      "name": "recipient_name",
      "email": "youruser@example.com",
      "personalizationData": {
        "userName": "ExampleName",
        "NotificationType": "Onboarding Example",
        "Date": "xxxx"
      }
    }
  ],
  "cc": [
    {
      "name": "recipient_name",
      "email": "youruser@example.com",
    }
  ],
  ,
  "bcc": [
    {
      "name": "recipient_name",
      "email": "youruser@example.com",
    }
  ]
  "message": {
    "subject": "Hello {{userName}}, welcome to our platform ✌️✌️",
    "content": [
      {
        "type": "text/plain",
        "value": "this is a plain text test to test below variables: {{NotificationType}} {{Date}} and {{userName}}"
      }
    ]
  }
}'

You must authenticate with a valid token and use only domains verified in your account.

Using the Token with SMTP The same API token can be used as the SMTP password for sending emails via standard mail clients.


SMTP configuration

  • SMTP Server: smtp.mx18.com

  • Port (STARTTLS): 587

  • Username: Your registered email address with MX18

  • Password: Your API token

Please note : SMTP Method is not available by default for free users, please raise a request to support@mx18.com in order to get it enabled for your account.


Token usage guidelines

Your token is specific to your account

  • You can only send emails from verified sender domains

  • Unauthorized or expired tokens will result in a 401 Unauthorized error

  • Rotate tokens regularly for security

Need help?

If you're facing issues with your token: