mail· Developers

ontechmail API

Send and manage email programmatically over HTTPS. Mail is delivered DKIM-signed from your own domain (SPF/DKIM/DMARC aligned) — no SMTP setup, no spam folder.

Base URL & auth

All requests go to https://mail.ontech.co.zm/api. Authenticate with a mailbox's credentials to get a bearer token, then send that token on every call. CORS is open, so browser apps work too.

1Authenticate

POST/auth/login — form-encoded; returns an access token (valid 24h).

# form fields, NOT json
curl -X POST https://mail.ontech.co.zm/api/auth/login \
  -d "username=you@yourdomain.co.zm" \
  --data-urlencode "password=YOUR_PASSWORD"

# → {"access_token": "eyJ...", "token_type": "bearer"}

2Find your mailbox id

GET/mailboxes — the send endpoint needs the sender mailbox's id.

curl https://mail.ontech.co.zm/api/mailboxes \
  -H "Authorization: Bearer $TOKEN"

# → [{"id": 42, "address": "you@yourdomain.co.zm", ...}]

3Send a message

POST/messages/send — JSON. Returns 201 with the queued message.

curl -X POST https://mail.ontech.co.zm/api/messages/send \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mailbox_id": 42,
    "to": ["ops@example.com"],
    "subject": "Hello from the API",
    "body_text": "Plain-text body.",
    "body_html": "<p>HTML body.</p>"
  }'

# → 201 {"id": 1234, "status": "queued", "from_addr": "you@yourdomain.co.zm", ...}
The message is delivered DKIM-signed from your address a few seconds after queueing (an undo-send window). Attachments? Use /messages/send-files (multipart). Unsend a queued message with POST /messages/{id}/cancel.

The ontech CLI

Deploy a site, tail build logs and provision databases from your terminal — one Python file, no dependencies.

curl -fsSL https://mail.ontech.co.zm/cli -o /usr/local/bin/ontech && chmod +x /usr/local/bin/ontech

ontech login
ontech host    yourdomain.com
ontech connect yourdomain.com --repo https://github.com/you/app.git --runtime node --start "npm start"
ontech deploy  yourdomain.com          # build + release, live status
ontech db create yourdomain.com        # a PostgreSQL database, injected as $DATABASE_URL
connect prints a GitHub webhook URL + secret — add it once and every push auto-deploys.

Everything else

Mailboxes, folders, message search & read, contacts, DNS zones/records, and admin endpoints follow the same bearer-token pattern. The interactive API reference is not exposed on the public host; write to info@ontech.co.zm for the OpenAPI document. Prefer plain SMTP? Applications can also send through authenticated SMTP submission on port 465 or 587 with a mailbox's credentials.

← ontechmail  ·  Get a mailbox  ·  Sign in