mail.alpha61.com

Authenticated REST API for the archimedes@alpha61.com inbox.

Authentication

All endpoints require a Bearer token in the Authorization header:

Authorization: Bearer <token>

Endpoints

GET /api/mail

List all messages (summary: id, from, subject, date).

curl -H "Authorization: Bearer " https://mail.alpha61.com/api/mail

GET /api/mail/<id>

Read a single message (full headers + body). Moves message from new/ to cur/.

curl -H "Authorization: Bearer " https://mail.alpha61.com/api/mail/<id>

DELETE /api/mail/<id>

Permanently delete a message.

curl -X DELETE -H "Authorization: Bearer " https://mail.alpha61.com/api/mail/<id>

Responses

All responses are JSON. Unauthorized requests return 401. Unknown message IDs return 404.

Python Client

import requests

API = "https://mail.alpha61.com/api/mail"
TOKEN = "your-token-here"
HEADERS = {"Authorization": f"Bearer {TOKEN}"}

# List all messages
# Returns: {"count": N, "messages": [{"id", "from", "subject", "date"}, ...]}
response = requests.get(API, headers=HEADERS).json()
for m in response["messages"]:
    print(f"[{m['id']}] {m['date']}  {m['from']}  {m['subject']}")

# Read a single message by id
# Returns: {"id", "from", "to", "subject", "date", "body", "headers"}
#   body    - plain text content (or HTML if no plain text part)
#   headers - dict of all email headers
msg = requests.get(f"{API}/{msg_id}", headers=HEADERS).json()
print(msg["subject"])
print(msg["body"])

# Delete a message by id
# Returns: {"ok": true, "deleted": "<id>"}
requests.delete(f"{API}/{msg_id}", headers=HEADERS)