Shoora

Mailbox API

Let your own server read, organise and send email for a @shoora.me mailbox over plain HTTPS and JSON.

1. Get a key

  1. A Shoora super admin opens Admin → Mail (shoora.me/stats/mail), then Edit · password · delete on the mailbox.
  2. Under 🔌 API, press Create API key. The key starts with shm_ and is shown once: copy it to your server's secret store.
  3. Every new key may read write send. Untick any of them and press Save rights to limit it.
  4. Replace key makes a new one and stops the old one at once. Remove key turns the API off for that mailbox.
One key per mailbox. Keep it like a password: anyone with it can act as that mailbox. Shoora keeps only a hash of it, so a lost key cannot be shown again; replace it instead.

2. Call it

Base URL: https://shoora.me/api/mail/v1. Send the key in every request:

Authorization: Bearer shm_your_key

Bodies are JSON (Content-Type: application/json). Answers are JSON.

curl -s https://shoora.me/api/mail/v1/me -H "Authorization: Bearer $SHOORA_MAIL_KEY"
# {"address":"[email protected]","read":true,"write":true,"send":true}

3. Endpoints

CallRightWhat it does
GET /meanyThe mailbox this key belongs to and its rights.
GET /foldersreadFolders with total and unread counts.
GET /messagesreadNewest first. Query: folder (inbox, sent, drafts, junk, trash, archive, a folder name or id; default inbox), q (text search), unread=1, limit (1–100, default 25), offset.
GET /messages/{id}readOne message with text, html and its attachment list. Opening it marks it read.
GET /messages/{id}/attachments/{attId}readDownloads one attachment (raw file).
PATCH /messages/{id}writeAny of {"seen": true|false, "flagged": true|false, "folder": "archive"}.
DELETE /messages/{id}writeMoves it to Trash. Deleting a message that is already in Trash removes it for good.
POST /draftswriteSaves a draft: {"to":[…],"cc":[…],"subject":"…","text":"…"}. Returns its id.
POST /sendsendSends from the mailbox. A copy goes to Sent.

Send

curl -s https://shoora.me/api/mail/v1/send \
  -H "Authorization: Bearer $SHOORA_MAIL_KEY" -H "Content-Type: application/json" \
  -d '{
    "to": ["[email protected]"],
    "cc": [],
    "subject": "Your visit summary",
    "text": "Hello, …",
    "html": "<p>Hello, …</p>",
    "from_name": "Shoora",
    "reply_to": "[email protected]",
    "in_reply_to": ["<[email protected]>"],
    "attachments": [{ "name": "summary.pdf", "type": "application/pdf", "content_base64": "JVBERi0x…" }]
  }'
# {"ok":true}

Required: to, subject, and text or html. Up to 50 recipients per message and 10 attachments; the whole request may be up to 30 MB. To reply in the same thread, pass the original message_id in in_reply_to and references.

Read new mail (Python)

import os, requests
API = "https://shoora.me/api/mail/v1"
H = {"Authorization": "Bearer " + os.environ["SHOORA_MAIL_KEY"]}

new = requests.get(f"{API}/messages", headers=H, params={"folder": "inbox", "unread": 1}).json()
for m in new["messages"]:
    full = requests.get(f"{API}/messages/{m['id']}", headers=H).json()   # marks it read
    print(full["from"], full["subject"], full["text"][:200])
    requests.patch(f"{API}/messages/{m['id']}", headers=H, json={"folder": "archive"})

Node.js

const API = 'https://shoora.me/api/mail/v1';
const H = { Authorization: `Bearer ${process.env.SHOORA_MAIL_KEY}`, 'Content-Type': 'application/json' };
await fetch(`${API}/send`, { method: 'POST', headers: H,
  body: JSON.stringify({ to: ['[email protected]'], subject: 'Hello', text: 'Sent from our server.' }) });

4. Errors and limits

StatusMeaning
400Something in the request is missing or wrong; message says what.
401No key, or the key was replaced or removed.
403The key does not have this right (read, write or send).
404No such message, folder or endpoint.
429Too many calls: at most 600 per 15 minutes from one address. Wait for Retry-After seconds.
502The mail server had a problem; try again shortly.

Errors look like {"error": "forbidden", "message": "This key may not send."}.

Sending shares the Shoora daily limit of 300 recipients across all mailboxes. Every send is logged on the admin Mail page with the key's last four characters.

5. Good practice