Keys / MailerSend

MAILERSEND_API_KEY

The MailerSend API token your app sends email with. It has sending, full or custom access, for one domain or all of them.

Starts with
mlsn.
Expires
you choose; 24 hours if you don't
API
create, list, pause and delete, with a token that has API tokens access

Get it

Create one on app.mailersend.com/api-tokens. The steps aren't recorded yet.

Set it

MAILERSEND_API_KEY=mlsn....

The Python and PHP SDKs read it from this variable when you don't pass a key. The Ruby SDK reads MAILERSEND_API_TOKEN; with the others, your app passes it in. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. Under Developer Tools, API tokens, click Create new token. Give it the same domain and permissions as the old one, and an expiration date.
  2. Deploy it everywhere that reads MAILERSEND_API_KEY. Both tokens work in the meantime.
  3. Check that nothing still uses the old token, then delete it. It stops working at once.

Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.

Sources, checked 2026-11-16