Riferimento API
Integra MailAudit nella tua applicazione: controlli DNS, blacklist e reputazione, e test completi della deliverability email tramite un’API REST.
Chiave API obbligatoria
Gratuita: creane una nella dashboardRate limit
60 richieste / minuto, 1.000 / giorno per chiave
Base URL
https://api.mailaudit.io/api/v1
Autenticazione
Ogni richiesta richiede una chiave API. Inviala nell’header Authorization come token Bearer (oppure nell’header X-API-Key). Mantieni segreta la tua chiave: non inserirla nel codice eseguito nel browser.
curl -H "Authorization: Bearer ma_live_xxxxxxxxxxxx" \
"https://api.mailaudit.io/api/v1/tools/mx-check?domain=example.com"Ogni risposta include gli header X-RateLimit-Remaining e X-RateLimit-Daily-Remaining. Quando un limite viene superato ricevi un HTTP 429 con l’header Retry-After.
Endpoint
Controllo record MX
/tools/mx-checkInterroga i record MX di un dominio, oltre alle impostazioni SPF e DMARC.
Parametri
domainstringobbligatorioEsempio di richiesta
curl -H "Authorization: Bearer $MAILAUDIT_API_KEY" \
"https://api.mailaudit.io/api/v1/tools/mx-check?domain=gmail.com"Esempio di risposta
1{
2 "domain": "gmail.com",
3 "hasMx": true,
4 "records": [
5 {
6 "exchange": "gmail-smtp-in.l.google.com",
7 "priority": 5,
8 "ip": ["142.250.150.27"]
9 },
10 {
11 "exchange": "alt1.gmail-smtp-in.l.google.com",
12 "priority": 10,
13 "ip": ["142.250.141.26"]
14 }
15 ],
16 "hasSpf": true,
17 "spfRecord": "v=spf1 redirect=_spf.google.com",
18 "hasDmarc": true,
19 "dmarcRecord": "v=DMARC1; p=none; sp=quarantine; rua=mailto:..."
20}Controllo blacklist
/tools/blacklist-checkVerifica se un indirizzo IP o un dominio è presente nelle principali blocklist antispam (32 DNSBL).
Parametri
querystringobbligatorioEsempio di richiesta
curl -H "Authorization: Bearer $MAILAUDIT_API_KEY" \
"https://api.mailaudit.io/api/v1/tools/blacklist-check?query=8.8.8.8"Esempio di risposta
1{
2 "query": "8.8.8.8",
3 "queryType": "ip",
4 "totalChecked": 32,
5 "totalListed": 0,
6 "results": [
7 {
8 "name": "Spamhaus ZEN",
9 "zone": "zen.spamhaus.org",
10 "listed": false,
11 "responseTime": 45
12 },
13 {
14 "name": "Barracuda",
15 "zone": "b.barracudacentral.org",
16 "listed": false,
17 "responseTime": 32
18 }
19 // ...
20 ]
21}Controllo reputazione dominio
/tools/reputationCalcolo del punteggio di reputazione del dominio. Controlla record SPF, DKIM, DMARC, MX, stato blacklist, supporto STARTTLS, età del dominio e reverse DNS.
Parametri
domainstringobbligatorioEsempio di richiesta
curl -H "Authorization: Bearer $MAILAUDIT_API_KEY" \
"https://api.mailaudit.io/api/v1/tools/reputation?domain=gmail.com"Scala di valutazione
Esempio di risposta
1{
2 "domain": "gmail.com",
3 "ip": "142.250.150.27",
4 "score": 100,
5 "grade": "A+",
6 "factors": [
7 { "name": "SPF", "status": "pass", "detail": "Policy: present", "impact": 15 },
8 { "name": "DKIM", "status": "warn", "detail": "Not found", "impact": 0 },
9 { "name": "DMARC", "status": "warn", "detail": "Policy: none", "impact": 5 },
10 { "name": "MX Records", "status": "pass", "detail": "5 record(s)", "impact": 10 },
11 { "name": "Blacklists", "status": "pass", "detail": "Clean (39 checked)", "impact": 20 },
12 { "name": "STARTTLS", "status": "pass", "detail": "Supported", "impact": 10 },
13 { "name": "Domain Age", "status": "pass", "detail": "30.3 years", "impact": 10 },
14 { "name": "Reverse DNS", "status": "pass", "detail": "wa-in-f27.1e100.net", "impact": 5 }
15 ],
16 "details": {
17 "mx": { "valid": true, "count": 5, "primary": "gmail-smtp-in.l.google.com" },
18 "spf": { "valid": true, "record": "v=spf1 redirect=_spf.google.com" },
19 "dkim": { "valid": false, "selectors": [] },
20 "dmarc": { "valid": true, "policy": "none", "rua": ["mailto:..."] },
21 "blacklists": { "checked": 10, "listed": 0, "clean": true },
22 "tls": { "valid": true, "starttls": true },
23 "domainAge": { "valid": true, "years": 30.3, "registrationDate": "1995-08-13" },
24 "rdns": { "valid": true, "hostname": "wa-in-f27.1e100.net" }
25 },
26 "checkedAt": "2025-12-03T07:05:46.232Z",
27 "cached": false
28}Test di deliverability email
Crea un indirizzo di test, inviagli la tua email dal server che vuoi testare, quindi interroga il risultato finché lo stato non è completed (di solito entro un minuto). Gli indirizzi di test scadono dopo un’ora.
/test/generateCrea un nuovo indirizzo email di test.
Esempio di richiesta
curl -X POST -H "Authorization: Bearer $MAILAUDIT_API_KEY" \
"https://api.mailaudit.io/api/v1/test/generate"Esempio di risposta
1{
2 "testId": "k3v9x2m1qa",
3 "email": "[email protected]",
4 "expiresAt": "2026-09-24T18:44:14.762Z",
5 "checkUrl": "/test/k3v9x2m1qa"
6}/test/{testId}Restituisce lo stato e i risultati di un test. Stato: pending → processing → completed (oppure expired / error). Il punteggio va da 0 a 10.
Parametri
testIdstringobbligatorioEsempio di richiesta
curl -H "Authorization: Bearer $MAILAUDIT_API_KEY" \
"https://api.mailaudit.io/api/v1/test/k3v9x2m1qa"Esempio di risposta
1{
2 "testId": "k3v9x2m1qa",
3 "status": "completed",
4 "score": 9.2,
5 "createdAt": "2026-09-24T17:44:14.763Z",
6 "receivedAt": "2026-09-24T17:45:02.118Z",
7 "expiresAt": "2026-09-24T18:44:14.762Z",
8 "email": {
9 "from": "[email protected]",
10 "subject": "Our September newsletter",
11 "bounceAddress": null
12 },
13 "checks": {
14 "spf": { "status": "pass", ... },
15 "dkim": { "status": "pass", ... },
16 "dmarc": { "status": "pass", ... },
17 "blacklist": { "status": "pass", ... },
18 "spamassassin": { "status": "pass", ... }
19 }
20}/test/{testId}/recheckEsegue di nuovo tutti i controlli su un’email già ricevuta, senza inviarne una nuova.
Parametri
testIdstringobbligatorioEsempio di risposta
1{
2 "success": true,
3 "testId": "k3v9x2m1qa",
4 "message": "Recheck initiated - checks are running"
5}Casella di sviluppo
Ogni account ha il proprio indirizzo usa e getta ([email protected], con qualsiasi +tag). La posta inviata a questo indirizzo viene conservata per 24 ore e può essere letta tramite l’API, nella dashboard o tramite un link di condivisione. Usalo nei test end-to-end al posto di una casella reale.
/inbox/waitAttende (long polling, fino a 60 s) l’arrivo di un messaggio corrispondente e lo restituisce con testo, HTML, link e codici monouso. Restituisce 408 se non arriva nulla in tempo.
Parametri
tagstringtimeoutnumbersinceISO 8601Esempio di richiesta
1curl -H "Authorization: Bearer $MAILAUDIT_API_KEY" \
2 "https://api.mailaudit.io/api/v1/inbox/address?tag=signup-42"
3# → { "address": "[email protected]", … }
4
5curl -H "Authorization: Bearer $MAILAUDIT_API_KEY" \
6 "https://api.mailaudit.io/api/v1/inbox/wait?tag=signup-42&timeout=60"Disponibili anche:
- GET /inbox · GET /inbox/address · GET /inbox/messages?tag=&since=
- GET /inbox/messages/{id} · GET /inbox/messages/{id}/raw · DELETE /inbox/messages/{id}
Esempio di risposta
1{
2 "id": "81ab56fe-9546-41a1-b7d1-b0f1a594ad37",
3 "to": "[email protected]",
4 "tag": "signup-42",
5 "from": { "address": "[email protected]", "name": "YourApp" },
6 "subject": "Confirm your email address",
7 "receivedAt": "2026-09-24T19:53:43.624Z",
8 "expiresAt": "2026-09-25T19:53:43.624Z",
9 "links": ["https://yourapp.dev/confirm?t=abc"],
10 "codes": ["482913"],
11 "shareUrl": "https://mailaudit.io/m/UjKgBYNGYXjTaGLe…",
12 "text": "Your code: 482 913 …",
13 "html": "<p>Your code: <b>482 913</b></p>…",
14 "headers": { "subject": "Confirm your email address", … }
15}Usala da un agente AI (MCP)
La stessa casella è un server MCP, quindi Claude Code, Cursor e altri client MCP possono creare indirizzi, attendere la posta e leggerla in autonomia:
claude mcp add --transport http mailaudit https://api.mailaudit.io/mcp \
--header "Authorization: Bearer $MAILAUDIT_API_KEY"Strumenti: new_address, wait_for_message, list_messages, get_message, extract, share_link, delete_message.
Codici di stato HTTP
| Codice | Stato | Descrizione |
|---|---|---|
| 200 | OK | Richiesta riuscita |
| 400 | Bad Request | Parametro mancante o non valido |
| 401 | Unauthorized | Chiave API mancante, non valida o revocata |
| 404 | Not Found | Test non trovato |
| 429 | Too Many Requests | Limite di richieste superato (60/minuto o 1.000/giorno) |
| 500 | Internal Server Error | Errore lato server |
Risposte di errore
In caso di errore, la risposta contiene un campo error con la descrizione:
{
"error": "Domain is required"
}Esempi di codice
JavaScript / Node.js
1// Query record MX
2const response = await fetch(
3 'https://api.mailaudit.io/api/v1/tools/mx-check?domain=example.com',
4 { headers: { Authorization: `Bearer ${process.env.MAILAUDIT_API_KEY}` } }
5);
6const data = await response.json();
7
8if (data.hasMx) {
9 console.log('Record MX:', data.records);
10 console.log('SPF:', data.hasSpf ? data.spfRecord : 'Nessuno');
11 console.log('DMARC:', data.hasDmarc ? data.dmarcRecord : 'Nessuno');
12}Python
1import os
2import requests
3
4# Controllo blacklist
5response = requests.get(
6 'https://api.mailaudit.io/api/v1/tools/blacklist-check',
7 params={'query': '192.168.1.1'},
8 headers={'Authorization': f"Bearer {os.environ['MAILAUDIT_API_KEY']}"},
9)
10data = response.json()
11
12print(f"Controllate: {data['totalChecked']} liste")
13print(f"Presente in: {data['totalListed']} voci")
14
15for result in data['results']:
16 if result['listed']:
17 print(f"⚠️ {result['name']}: IN LISTA")Python - Reputation Check
1import os
2import requests
3
4# Controllo reputazione dominio
5response = requests.get(
6 'https://api.mailaudit.io/api/v1/tools/reputation',
7 params={'domain': 'example.com'},
8 headers={'Authorization': f"Bearer {os.environ['MAILAUDIT_API_KEY']}"},
9)
10data = response.json()
11
12print(f"Score: {data['score']}/100 ({data['grade']})")
13print("\nFattori:")
14for factor in data['factors']:
15 icon = "✅" if factor['status'] == 'pass' else "⚠️" if factor['status'] == 'warn' else "❌"
16 print(f" {icon} {factor['name']}: {factor['detail']} ({factor['impact']:+d})")Python - Email deliverability test
1import os
2import time
3import requests
4
5# Test completo di deliverability
6api = 'https://api.mailaudit.io/api/v1'
7headers = {'Authorization': f"Bearer {os.environ['MAILAUDIT_API_KEY']}"}
8
9test = requests.post(f'{api}/test/generate', headers=headers).json()
10print('Send your email to:', test['email'])
11
12while True:
13 result = requests.get(f"{api}/test/{test['testId']}", headers=headers).json()
14 if result['status'] in ('completed', 'expired', 'error'):
15 break
16 time.sleep(10)
17
18print(f"Status: {result['status']}, score: {result['score']}/10")PHP
1<?php
2// Controllo MX
3$domain = 'example.com';
4$url = "https://api.mailaudit.io/api/v1/tools/mx-check?domain=" . urlencode($domain);
5
6$context = stream_context_create(['http' => [
7 'header' => 'Authorization: Bearer ' . getenv('MAILAUDIT_API_KEY'),
8]]);
9$response = file_get_contents($url, false, $context);
10$data = json_decode($response, true);
11
12if ($data['hasMx']) {
13 foreach ($data['records'] as $mx) {
14 echo "MX: {$mx['exchange']} (priorità: {$mx['priority']})\n";
15 }
16}
17?>Vuoi provare l’API?
Prova i nostri strumenti dall’interfaccia web oppure inizia a sviluppare con l’API.