Ace Email / API documentation

Email API

JSON reference for connecting your agents and applications to Ace Email.

v1 specification

This reference defines the API integration contract. The endpoints described are not enabled yet; the examples illustrate the intended requests and responses.

Getting started

Use your full email address and normal mailbox password to obtain a token. Then send it in the Authorization header. Access is limited to that account’s resources.

Contract base URLhttps://ace.email/api/v1Download OpenAPI
cURL · POST /auth/login
curl --request POST 'https://ace.email/api/v1/auth/login' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --data '{"email":"usuario@ace.email","password":"TU_CONTRASEÑA","device_name":"my-agent"}'
cURL · GET /messages
curl 'https://ace.email/api/v1/messages?folder=unread&per_page=30' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Accept: application/json'

Authentication

Tokens will be valid for 365 days. API logout will revoke the current token. Changing the password through admads or deleting the account will revoke its tokens. This API does not grant administration access.

Authorization: Bearer YOUR_TOKENAccept: application/jsonContent-Type: application/json

Access

POST/auth/loginObtain a token with mailbox credentials
JSON request
{
    "email": "usuario@ace.email",
    "password": "TU_CONTRASEÑA",
    "device_name": "my-agent"
}
Example response · HTTP 200
{
    "data": {
        "access_token": "example_token_not_a_credential",
        "token_type": "Bearer",
        "expires_in": 31536000
    }
}
POST/auth/logoutRevoke the current token
Example response · HTTP 200
{
    "data": {
        "revoked": true
    }
}
GET/meRetrieve the authenticated account
Example response · HTTP 200
{
    "data": {
        "email": "usuario@ace.email",
        "name": "Example User"
    }
}

Folders and messages

GET/foldersList folders and views with counts
Example response · HTTP 200
{
    "data": [
        {
            "id": "inbox",
            "name": "Inbox",
            "is_virtual": false,
            "total": 143,
            "unread": 12
        },
        {
            "id": "unread",
            "name": "Unread",
            "is_virtual": true,
            "total": 12,
            "unread": 12
        }
    ]
}
GET/messagesList and search message metadata

Query parameters

folder=inboxq=invoiceunread=truestarred=falsehas_attachments=truelabel_id=10page=1per_page=30
Example response · HTTP 200
{
    "data": [
        {
            "id": 123,
            "folder": "inbox",
            "subject": "Example message",
            "from": [
                {
                    "address": "contact@example.net",
                    "name": "Example Contact"
                }
            ],
            "to": [
                {
                    "address": "usuario@ace.email"
                }
            ],
            "date": "2026-11-24T12:00:00Z",
            "is_read": false,
            "is_starred": false,
            "has_attachments": true,
            "version": 1
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 30,
        "total": 143,
        "last_page": 5
    }
}
GET/messages/{id}Read text, HTML and attachment metadata
Example response · HTTP 200
{
    "data": {
        "id": 123,
        "folder": "inbox",
        "subject": "Example message",
        "from": [
            {
                "address": "contact@example.net",
                "name": "Example Contact"
            }
        ],
        "to": [
            {
                "address": "usuario@ace.email"
            }
        ],
        "date": "2026-11-24T12:00:00Z",
        "is_read": false,
        "is_starred": false,
        "has_attachments": true,
        "version": 1,
        "body_text": "Example message body.",
        "body_html": "<p>Example message body.</p>",
        "cc": [],
        "bcc": [],
        "reply_to": [],
        "attachments": [
            {
                "id": 456,
                "name": "example.txt",
                "content_type": "text/plain",
                "size": 4
            }
        ]
    }
}
GET/messages/{id}/attachments/{attachment_id}Get a complete Base64 attachment
Example response · HTTP 200
{
    "data": {
        "id": 456,
        "name": "example.txt",
        "content_type": "text/plain",
        "size": 4,
        "encoding": "base64",
        "content": "SG9sYQ=="
    }
}
GET/messages/{id}/originalGet the EML original as JSON with Base64
Example response · HTTP 200
{
    "data": {
        "id": 123,
        "content_type": "message/rfc822",
        "encoding": "base64",
        "content": "RnJvbTogY29udGFjdEBleGFtcGxlLm5ldA0KVG86IHVzdWFyaW9AYWNlLmVtYWlsDQpTdWJqZWN0OiBFeGFtcGxlDQoNCkhlbGxvDQo="
    }
}

Actions

read, unread, star and unstar change flags. archive, inbox, spam and trash move messages; inbox can restore from Trash. snooze requires snoozed_until in ISO 8601. labels accepts your own label_ids. Permanent deletion is not defined.

POST/messages/{id}/actionsApply an action to one message
JSON request
{
    "action": "read",
    "version": 1
}
Example response · HTTP 200
{
    "data": {
        "id": 123,
        "is_read": true,
        "version": 2
    }
}
POST/messages/actionsRun a batch with individual results
JSON request
{
    "action": "archive",
    "messages": [
        {
            "id": 123,
            "version": 1
        },
        {
            "id": 124,
            "version": 2
        }
    ]
}
Example response · HTTP 200
{
    "data": [
        {
            "id": 123,
            "success": true,
            "version": 2
        },
        {
            "id": 124,
            "success": false,
            "error": {
                "code": "not_found",
                "message": "Message unavailable."
            }
        }
    ]
}

Drafts and delivery

POST/draftsCreate a draft with recipients and attachments
JSON request
{
    "to": [
        {
            "address": "contact@example.net"
        }
    ],
    "cc": [],
    "bcc": [],
    "subject": "Example subject",
    "body_text": "Hello.",
    "body_html": "<p>Hello.</p>",
    "attachments": [
        {
            "name": "example.txt",
            "content_type": "text/plain",
            "size": 4,
            "encoding": "base64",
            "content": "SG9sYQ=="
        }
    ]
}
Example response · HTTP 201
{
    "data": {
        "id": 789,
        "status": "draft",
        "version": 1
    }
}
PATCH/drafts/{id}Update draft fields
JSON request
{
    "version": 1,
    "subject": "Updated subject",
    "body_text": "Updated body."
}
Example response · HTTP 200
{
    "data": {
        "id": 789,
        "status": "draft",
        "version": 2
    }
}
POST/drafts/{id}/sendRequest delivery with Idempotency-Key
Idempotency-Key: send-example-789
JSON request
{
    "version": 2
}
Example response · HTTP 202
{
    "data": {
        "id": 789,
        "status": "queued",
        "version": 3
    }
}
POST/messages/{id}/replyCreate a reply draft without sending it
JSON request
{
    "body_text": "Thank you.",
    "reply_all": false
}
Example response · HTTP 201
{
    "data": {
        "id": 790,
        "status": "draft",
        "in_reply_to": "<example@example.net>",
        "version": 1
    }
}
POST/messages/{id}/forwardCreate a forward draft without sending it
JSON request
{
    "to": [
        {
            "address": "colleague@example.net"
        }
    ],
    "body_text": "For your review.",
    "include_attachments": true
}
Example response · HTTP 201
{
    "data": {
        "id": 791,
        "status": "draft",
        "version": 1
    }
}

Exports

Exports will run in the background using the requested folder and filters. Poll every 5 seconds until status=completed and retrieve result using the owner’s token. The result will be one JSON with messages, Base64 attachments and errors for omissions. It expires after 24 hours; messages over 30 MB and security-blocked content appear in the report.

POST/exportsRequest one JSON with all messages
JSON request
{
    "folder": "unread",
    "q": "invoice",
    "has_attachments": true
}
Example response · HTTP 202
{
    "data": {
        "id": "exp_example_123",
        "status": "pending"
    }
}
GET/exports/{id}Check progress and expiry
Example response · HTTP 200
{
    "data": {
        "id": "exp_example_123",
        "status": "completed",
        "total": 143,
        "exported": 142,
        "skipped": 1,
        "expires_at": "2026-11-25T12:00:00Z"
    }
}
GET/exports/{id}/resultGet the full JSON using the owner’s token
Example response · HTTP 200
{
    "schema_version": "1.0",
    "folder": "inbox",
    "total": 1,
    "exported": 1,
    "skipped": 0,
    "messages": [
        {
            "id": 123,
            "folder": "inbox",
            "subject": "Example message",
            "from": [
                {
                    "address": "contact@example.net",
                    "name": "Example Contact"
                }
            ],
            "to": [
                {
                    "address": "usuario@ace.email"
                }
            ],
            "date": "2026-11-24T12:00:00Z",
            "is_read": false,
            "is_starred": false,
            "has_attachments": true,
            "version": 1,
            "body_text": "Example message body.",
            "body_html": "<p>Example message body.</p>",
            "attachments": [
                {
                    "id": 456,
                    "name": "example.txt",
                    "content_type": "text/plain",
                    "size": 4,
                    "encoding": "base64",
                    "content": "SG9sYQ=="
                }
            ]
        }
    ],
    "errors": []
}

Reading, actions and sending

  • Reading messages and attachments will not mark them as read. Use the read action to change that flag.
  • Use IDs returned by the API, not IMAP UIDs. version detects concurrent changes with a 409 error.
  • Sending requires Idempotency-Key. The same key and content return the original operation; different content produces a 409. Uncertain delivery has status uncertain and is not automatically retried.

Contract limits

30 messages per page by default, up to 100. Batches up to 100 IDs. Messages up to 30 MB, attachments up to 20 MB, at most 20 attachments and 50 recipients per delivery. Base64 increases JSON size. Downloads will respect security checks.

Per token per minute: 60 reads, 30 writes, 10 sends. Login: 5 attempts per account/IP, capped at 20 per IP. A 429 will include Retry-After.

Errors and retries

Errors always use JSON, with a stable code and request ID. Connection failures will be distinguished from incorrect passwords. Batches will return one result per message, including partial failures.

401invalid_credentials / invalid_token
403forbidden
404not_found
409conflict
410export_expired / message_unavailable
413payload_too_large
422validation_error
423security_check_failed
429rate_limited
503mail_server_unavailable
Example response · HTTP 422
{
    "error": {
        "code": "validation_error",
        "message": "Invalid request.",
        "details": {
            "email": [
                "A valid email address is required."
            ]
        },
        "request_id": "req_example_123"
    }
}