Start

Quickstart

You need a TuskMail user mailbox, an API key and an app password. Then one request sends your first message.

TuskMail API: Quickstart

How do I get credentials?

  1. Open Settings in the TuskMail web app

    Sign in as the mailbox you want to send from. API access is available for user mailboxes, not group mailboxes.
  2. Create an app password

    Go to Settings, then App passwords, and create one. Copy it right away. You can give it an expiry and, optionally, restrict it to specific IP addresses.
  3. Create an API key

    Go to Settings, then Developers, and create a key. It starts with tk_live_ and is shown once, so store it safely.

Set them in your shell:

Shell
export TK_API_KEY="tk_live_..."
export MAILBOX_EMAIL="[email protected]"
export APP_PASSWORD="your-app-password"

How do I send my first message?

Post a JSON body to /v1/messages. The response confirms the message was sent.

curl -X POST "https://api.tuskmail.africa/v1/messages" \
  -H "X-API-Key: $TK_API_KEY" \
  -u "$MAILBOX_EMAIL:$APP_PASSWORD" \
  -H "Idempotency-Key: order-1001-confirmation" \
  -H "Content-Type: application/json" \
  -d '{
  "to": [
    {
      "email": "[email protected]",
      "name": "Amina"
    }
  ],
  "subject": "Your order is confirmed",
  "text": "Hello Amina, your order 1001 is confirmed.",
  "html": "<p>Hello Amina, your order <b>1001</b> is confirmed.</p>"
}'
201 Created
{
  "id": "Mabc123",
  "sent": true
}

The sent message appears in the Sent folder of the mailbox. Use the messages reference to read, search and manage mail.

What should I read next?