API di posta
Riferimento JSON per collegare agenti e applicazioni ad Ace Email.
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.
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 '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/jsonNessuna operazione corrispondente.
Accesso
POST/auth/loginOttieni un token con le credenziali della casella
{
"email": "usuario@ace.email",
"password": "TU_CONTRASEÑA",
"device_name": "my-agent"
}
{
"data": {
"access_token": "example_token_not_a_credential",
"token_type": "Bearer",
"expires_in": 31536000
}
}
POST/auth/logoutRevoca il token corrente
{
"data": {
"revoked": true
}
}
GET/meConsulta l’account autenticato
{
"data": {
"email": "usuario@ace.email",
"name": "Example User"
}
}
Cartelle e messaggi
GET/foldersElenca cartelle e viste con contatori
{
"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{
"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
{
"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
{
"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
{
"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
{
"action": "read",
"version": 1
}
{
"data": {
"id": 123,
"is_read": true,
"version": 2
}
}
POST/messages/actionsEsegui un gruppo con risultati individuali
{
"action": "archive",
"messages": [
{
"id": 123,
"version": 1
},
{
"id": 124,
"version": 2
}
]
}
{
"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
{
"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=="
}
]
}
{
"data": {
"id": 789,
"status": "draft",
"version": 1
}
}
PATCH/drafts/{id}Modifica i campi di una bozza
{
"version": 1,
"subject": "Updated subject",
"body_text": "Updated body."
}
{
"data": {
"id": 789,
"status": "draft",
"version": 2
}
}
POST/drafts/{id}/sendRichiedi un invio con Idempotency-Key
Idempotency-Key: send-example-789{
"version": 2
}
{
"data": {
"id": 789,
"status": "queued",
"version": 3
}
}
POST/messages/{id}/replyCrea una bozza di risposta senza inviarla
{
"body_text": "Thank you.",
"reply_all": false
}
{
"data": {
"id": 790,
"status": "draft",
"in_reply_to": "<example@example.net>",
"version": 1
}
}
POST/messages/{id}/forwardCrea una bozza di inoltro senza inviarla
{
"to": [
{
"address": "colleague@example.net"
}
],
"body_text": "For your review.",
"include_attachments": true
}
{
"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
{
"folder": "unread",
"q": "invoice",
"has_attachments": true
}
{
"data": {
"id": "exp_example_123",
"status": "pending"
}
}
GET/exports/{id}Consulta avanzamento e scadenza
{
"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
{
"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.
invalid_credentials / invalid_tokenforbiddennot_foundconflictexport_expired / message_unavailablepayload_too_largevalidation_errorsecurity_check_failedrate_limitedmail_server_unavailable{
"error": {
"code": "validation_error",
"message": "Invalid request.",
"details": {
"email": [
"A valid email address is required."
]
},
"request_id": "req_example_123"
}
}