Ace Email / Documentazione API

API di posta

Riferimento JSON per collegare agenti e applicazioni ad Ace Email.

Specifica v1

Questo riferimento definisce il contratto di integrazione dell’API. Gli endpoint descritti non sono ancora abilitati; gli esempi illustrano richieste e risposte previste.

Primi passi

Usa l’indirizzo completo e la password della casella per ottenere un token. Poi invialo nell’header Authorization. L’accesso è limitato alle risorse dell’account.

URL di base del contrattohttps://ace.email/api/v1Scarica 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'

Autenticazione

I token saranno validi 365 giorni. Il logout API revocherà il token corrente. Cambiare la password da admads o eliminare l’account revocherà i token. Nessun accesso amministrativo.

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

Accesso

POST/auth/loginOttieni un token con le credenziali della casella
Richiesta JSON
{
    "email": "usuario@ace.email",
    "password": "TU_CONTRASEÑA",
    "device_name": "my-agent"
}
Risposta di esempio · HTTP 200
{
    "data": {
        "access_token": "example_token_not_a_credential",
        "token_type": "Bearer",
        "expires_in": 31536000
    }
}
POST/auth/logoutRevoca il token corrente
Risposta di esempio · HTTP 200
{
    "data": {
        "revoked": true
    }
}
GET/meConsulta l’account autenticato
Risposta di esempio · HTTP 200
{
    "data": {
        "email": "usuario@ace.email",
        "name": "Example User"
    }
}

Cartelle e messaggi

GET/foldersElenca cartelle e viste con contatori
Risposta di esempio · 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/messagesElenca e cerca metadati dei messaggi

Parametri di ricerca

folder=inboxq=invoiceunread=truestarred=falsehas_attachments=truelabel_id=10page=1per_page=30
Risposta di esempio · 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}Leggi testo, HTML e metadati degli allegati
Risposta di esempio · 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}Ottieni un allegato completo in Base64
Risposta di esempio · HTTP 200
{
    "data": {
        "id": 456,
        "name": "example.txt",
        "content_type": "text/plain",
        "size": 4,
        "encoding": "base64",
        "content": "SG9sYQ=="
    }
}
GET/messages/{id}/originalOttieni l’originale EML come JSON con Base64
Risposta di esempio · HTTP 200
{
    "data": {
        "id": 123,
        "content_type": "message/rfc822",
        "encoding": "base64",
        "content": "RnJvbTogY29udGFjdEBleGFtcGxlLm5ldA0KVG86IHVzdWFyaW9AYWNlLmVtYWlsDQpTdWJqZWN0OiBFeGFtcGxlDQoNCkhlbGxvDQo="
    }
}

Azioni

read, unread, star e unstar cambiano gli stati. archive, inbox, spam e trash spostano i messaggi; inbox ripristina dal cestino. snooze richiede snoozed_until in ISO 8601. labels riceve i propri label_ids. Nessuna eliminazione permanente.

POST/messages/{id}/actionsApplica un’azione a un messaggio
Richiesta JSON
{
    "action": "read",
    "version": 1
}
Risposta di esempio · HTTP 200
{
    "data": {
        "id": 123,
        "is_read": true,
        "version": 2
    }
}
POST/messages/actionsEsegui un gruppo con risultati individuali
Richiesta JSON
{
    "action": "archive",
    "messages": [
        {
            "id": 123,
            "version": 1
        },
        {
            "id": 124,
            "version": 2
        }
    ]
}
Risposta di esempio · HTTP 200
{
    "data": [
        {
            "id": 123,
            "success": true,
            "version": 2
        },
        {
            "id": 124,
            "success": false,
            "error": {
                "code": "not_found",
                "message": "Message unavailable."
            }
        }
    ]
}

Bozze e invio

POST/draftsCrea una bozza con destinatari e allegati
Richiesta JSON
{
    "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=="
        }
    ]
}
Risposta di esempio · HTTP 201
{
    "data": {
        "id": 789,
        "status": "draft",
        "version": 1
    }
}
PATCH/drafts/{id}Modifica i campi di una bozza
Richiesta JSON
{
    "version": 1,
    "subject": "Updated subject",
    "body_text": "Updated body."
}
Risposta di esempio · HTTP 200
{
    "data": {
        "id": 789,
        "status": "draft",
        "version": 2
    }
}
POST/drafts/{id}/sendRichiedi un invio con Idempotency-Key
Idempotency-Key: send-example-789
Richiesta JSON
{
    "version": 2
}
Risposta di esempio · HTTP 202
{
    "data": {
        "id": 789,
        "status": "queued",
        "version": 3
    }
}
POST/messages/{id}/replyCrea una bozza di risposta senza inviarla
Richiesta JSON
{
    "body_text": "Thank you.",
    "reply_all": false
}
Risposta di esempio · HTTP 201
{
    "data": {
        "id": 790,
        "status": "draft",
        "in_reply_to": "<example@example.net>",
        "version": 1
    }
}
POST/messages/{id}/forwardCrea una bozza di inoltro senza inviarla
Richiesta JSON
{
    "to": [
        {
            "address": "colleague@example.net"
        }
    ],
    "body_text": "For your review.",
    "include_attachments": true
}
Risposta di esempio · HTTP 201
{
    "data": {
        "id": 791,
        "status": "draft",
        "version": 1
    }
}

Esportazioni

Esportazioni in background con cartella e filtri richiesti. Consulta ogni 5 secondi fino a status=completed e recupera result con il token del proprietario. Un unico JSON con messages, allegati Base64 ed errors. Scadenza dopo 24 ore; messaggi oltre 30 MB e contenuti bloccati segnalati.

POST/exportsRichiedi un unico JSON con tutti i messaggi
Richiesta JSON
{
    "folder": "unread",
    "q": "invoice",
    "has_attachments": true
}
Risposta di esempio · HTTP 202
{
    "data": {
        "id": "exp_example_123",
        "status": "pending"
    }
}
GET/exports/{id}Consulta avanzamento e scadenza
Risposta di esempio · 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}/resultOttieni il JSON completo con il token del proprietario
Risposta di esempio · 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": []
}

Lettura, azioni e invio

  • Consultare messaggi e allegati non li segnerà come letti. Usa l’azione read.
  • Usa gli ID dell’API, non gli UID IMAP. version rileva conflitti con un errore 409.
  • Gli invii richiedono Idempotency-Key. Stessa chiave e contenuto: operazione originale; contenuto diverso: 409. Una consegna incerta avrà stato uncertain senza reinvio automatico.

Limiti del contratto

30 messaggi per pagina, massimo 100. Gruppi di 100 ID. Messaggi fino a 30 MB, allegati fino a 20 MB, massimo 20 allegati e 50 destinatari per invio. Base64 aumenta il JSON. Controlli di sicurezza mantenuti.

Per token al minuto: 60 letture, 30 scritture, 10 invii. Login: 5 tentativi per account/IP, massimo 20 per IP. Un 429 includerà Retry-After.

Errori e nuovi tentativi

Errori in JSON con codice stabile e ID richiesta. Connessioni fallite distinte dalle password errate. Un risultato per messaggio, compresi gli errori parziali.

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
Risposta di esempio · HTTP 422
{
    "error": {
        "code": "validation_error",
        "message": "Invalid request.",
        "details": {
            "email": [
                "A valid email address is required."
            ]
        },
        "request_id": "req_example_123"
    }
}