Documentation
Maila API
Give your agents their own email inboxes on mailbox.maila.ai: receive, read, search, send and reply over a simple REST API.
Quick start
- Create an API key in Account → API keys. Copy it when it is shown; it is shown only once.
- Save the key and the API address in your shell:
export MAILA_API_KEY="sk-..."
export MAILA_API_URL="https://api.maila.ai" - Make your first request. It returns your plan and how many emails you have sent this month.
curl "$MAILA_API_URL/v1/usage" \
-H "Authorization: Bearer $MAILA_API_KEY" Every example in these docs uses these two variables, so you can copy and run it as is.
Next, create an inbox, send it an email from any mail app, and list its threads.
Conventions
- JSON in, JSON out. Send bodies as JSON with
Content-Type: application/json. Every object has anobjectfield that names its type. - Ids start with their type:
inb_inbox,thr_thread,msg_message,att_attachment. - Times are Unix timestamps in seconds.
- Lists return
dataandnext_cursor. Pass?cursor=with that value to get the next page; it isnullon the last page. - Errors return
{"error": { "type", "message" }}. See Errors and limits.
Endpoints
Inboxes
Threads and messages
- GET
/v1/inboxes/{inbox_id}/threadsList threads - GET
/v1/inboxes/{inbox_id}/threads/{thread_id}Get a thread - PATCH
/v1/inboxes/{inbox_id}/threads/{thread_id}Update a thread - GET
/v1/inboxes/{inbox_id}/threads/{thread_id}/items/{item_id}Get a message or attachment - GET
/v1/inboxes/{inbox_id}/threads/{thread_id}/items/{item_id}/contentDownload content