## Autenticazione Scopri come ottenere e utilizzare le chiavi API ## Ottieni Chiave API Prima di utilizzare l'API, devi ottenere una chiave API. Puoi creare la tua chiave API nella pagina Profilo. ### Utilizzo della Chiave API Includi la tua chiave API negli header delle richieste per tutte le richieste API: [Code (bash)] X-API-Key: Bearer TUA_CHIAVE_API [/Code] ### Note Importanti - Mantieni la tua chiave API sicura e non esporla in luoghi pubblici - La chiave API ha gli stessi permessi del tuo account, usala con cautela - Se la tua chiave API è compromessa, rigenerala immediatamente nella pagina Profilo --- ## API Email Crea e gestisci email ## Ottieni Domini Disponibili Ottieni tutti i domini email disponibili nel sistema. ### Richiesta [Code (bash)] GET /api/email/domains [/Code] ### Esempio di Richiesta [Code (bash)] curl https://chat-tempmail.com/api/email/domains \ -H "X-API-Key: TUA_CHIAVE_API" [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- domains | array | Lista dei domini email disponibili ### Esempio di Risposta [Code (json)] { "domains": [ "chat-tempmail.com", "example.com", "other-domain.com" ] } [/Code] ## Crea Email Crea un nuovo indirizzo email temporaneo. ### Richiesta [Code (bash)] POST /api/emails/generate [/Code] ### Parametri di Richiesta Parametro | Tipo | Richiesto | Descrizione ----------- | ------ | ---------- | ------------- name | string | Sì | Prefisso email expiryTime | number | Sì | Tempo di scadenza (millisecondi)
Valori disponibili:
- 3600000 (1 ora)
- 86400000 (1 giorno)
- 259200000 (3 giorni)
- 0 (permanente) domain | string | Sì | Dominio email ### Esempio di Richiesta [Code (bash)] curl -X POST https://chat-tempmail.com/api/emails/generate \ -H "X-API-Key: TUA_CHIAVE_API" \ -H "Content-Type: application/json" \ -d '{ "name": "test", "expiryTime": 3600000, "domain": "chat-tempmail.com" }' [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- id | string | Identificatore unico dell'email (formato UUID) email | string | Indirizzo email creato (indirizzo email completo) ### Esempio di Risposta [Code (json)] { "id": "c2c4f894-c672-4d5b-a918-abca95aff1f7", "email": "test@chat-tempmail.com" } [/Code] ## Ottieni Lista Email Ottieni tutti gli indirizzi email del tuo account. ### Richiesta [Code (bash)] GET /api/emails [/Code] ### Parametri di Richiesta Parametro | Tipo | Richiesto | Descrizione ----------- | ------ | ---------- | ------------- cursor | string | No | Cursore di paginazione, ottieni nextCursor dalla risposta precedente ### Esempio di Richiesta [Code (bash)] curl https://chat-tempmail.com/api/emails \ -H "X-API-Key: TUA_CHIAVE_API" [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- emails | array | Lista email (massimo 20 elementi per richiesta) nextCursor | string | Cursore pagina successiva per ottenere più dati total | number | Numero totale di email ### Oggetti Email nell'Array emails Parametro | Tipo | Descrizione ----------- | ------ | ------------- id | string | Identificatore unico dell'email (formato UUID) address | string | Indirizzo email (indirizzo email completo) userId | string | ID utente proprietario dell'email (formato UUID) createdAt | string | Ora di creazione email (formato ISO 8601) expiresAt | string | Ora di scadenza email (formato ISO 8601) ### Esempio di Risposta [Code (json)] { "emails": [ { "id": "e4ff5c14-8a72-48c5-bd13-b5347fb944da", "address": "6Tg3VT@chat-tempmail.com", "userId": "bd08008d-e944-44b2-a0d0-67f2b528ee6d", "createdAt": "2025-04-21T08:30:45.084Z", "expiresAt": "2025-04-22T08:30:45.084Z" } ], "nextCursor": "fd13a8df-1465-4fbc-a612-ca7311c31ff2", "total": 20 } [/Code] ## Elimina Email Elimina l'indirizzo email specificato. ### Richiesta [Code (bash)] DELETE /api/emails/{emailId} [/Code] ### Parametri di Richiesta Parametro | Tipo | Richiesto | Descrizione ----------- | ------ | ---------- | ------------- emailId | string | Sì | ID Email (parametro percorso) ### Esempio di Richiesta [Code (bash)] curl -X DELETE "https://chat-tempmail.com/api/emails/99fadf12-6826-490a-9c6c-b0b528d4a8e0" \ -H "X-API-Key: TUA_CHIAVE_API" [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- success | boolean | Se l'eliminazione è riuscita ### Esempio di Risposta [Code (json)] { "success": true } [/Code] --- ## API Messaggi Gestisci messaggi ## Ottieni Lista Messaggi Ottieni tutti i messaggi nell'indirizzo email specificato. ### Richiesta [Code (bash)] GET /api/emails/{emailId} [/Code] ### Parametri di Richiesta Parametro | Tipo | Richiesto | Descrizione ----------- | ------ | ---------- | ------------- emailId | string | Sì | ID Email (parametro percorso) cursor | string | No | Cursore di paginazione (parametro query), ottieni nextCursor dalla risposta precedente ### Esempio di Richiesta [Code (bash)] curl "https://chat-tempmail.com/api/emails/c2c4f894-c672-4d5b-a918-abca95aff1f7" \ -H "X-API-Key: TUA_CHIAVE_API" [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- messages | array | Lista messaggi (massimo 20 elementi per richiesta) nextCursor | string | Cursore pagina successiva per ottenere più dati total | number | Numero totale di messaggi ### Oggetti Messaggio nell'Array messages Parametro | Tipo | Descrizione ----------- | ------ | ------------- id | string | Identificatore unico del messaggio (formato UUID) from_address | string | Indirizzo mittente subject | string | Oggetto del messaggio received_at | number | Ora di ricezione (timestamp Unix in millisecondi) ### Esempio di Risposta [Code (json)] { "messages": [ { "id": "fd13a8df-1465-4fbc-a612-ca7311c31ff2", "from_address": "sender1@example.com", "subject": "Test Message 1 - xJOK2h", "received_at": 1745224245084 } ], "nextCursor": "eyJ0aW1lc3RhbXAiOjE3NDUxNTU4NDUwODQsImlkIjoiNjNmNzFlODYtOGE1NC00ZDQ0LTk5ZWYtN2QzNTBhMTQ4M2JiIn0=", "total": 50 } [/Code] ## Ottieni Dettagli Messaggio Ottieni il contenuto dettagliato del messaggio specificato. ### Richiesta [Code (bash)] GET /api/emails/{emailId}/{messageId} [/Code] ### Parametri di Richiesta Parametro | Tipo | Richiesto | Descrizione ----------- | ------ | ---------- | ------------- emailId | string | Sì | ID Email (parametro percorso) messageId | string | Sì | ID Messaggio (parametro percorso) ### Esempio di Richiesta [Code (bash)] curl "https://chat-tempmail.com/api/emails/99fadf12-6826-490a-9c6c-b0b528d4a8e0/fd13a8df-1465-4fbc-a612-ca7311c31ff2" \ -H "X-API-Key: TUA_CHIAVE_API" [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- message | object | Dettagli del messaggio ### Campi dell'Oggetto message Parametro | Tipo | Descrizione ----------- | ------ | ------------- id | string | Identificatore unico del messaggio (formato UUID) from_address | string | Indirizzo mittente subject | string | Oggetto del messaggio content | string | Contenuto testuale del messaggio html | string | Contenuto HTML del messaggio (può essere vuoto) received_at | number | Ora di ricezione (timestamp Unix in millisecondi) ### Esempio di Risposta [Code (json)] { "message": { "id": "fd13a8df-1465-4fbc-a612-ca7311c31ff2", "from_address": "sender1@example.com", "subject": "Test Message 1 - xJOK2h", "content": "Test Message 1\n\nThis is test message 1 content.\n\nBest regards,\nSender 1", "html": "
\n

Test Message 1

\n
", "received_at": 1745224245084 } } [/Code] ## Elimina Messaggio Elimina il messaggio specificato. ### Richiesta [Code (bash)] DELETE /api/emails/{emailId}/{messageId} [/Code] ### Parametri di Richiesta Parametro | Tipo | Richiesto | Descrizione ----------- | ------ | ---------- | ------------- emailId | string | Sì | ID Email (parametro percorso) messageId | string | Sì | ID Messaggio (parametro percorso) ### Esempio di Richiesta [Code (bash)] curl -X DELETE "https://chat-tempmail.com/api/emails/76d91ae5-822a-4fdd-8701-9de038ec86d7/20e77445-b0c3-4e8b-aa29-762ea423ac15" \ -H "X-API-Key: TUA_CHIAVE_API" [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- success | boolean | Se l'eliminazione è riuscita ### Esempio di Risposta [Code (json)] { "success": true } [/Code] --- ## Push Webhook Configura webhook per ricevere notifiche push dei messaggi ## Ottieni Configurazione Webhook Ottieni le informazioni sulla configurazione webhook attuale. ### Richiesta [Code (bash)] GET /api/webhook [/Code] ### Esempio di Richiesta [Code (bash)] curl https://chat-tempmail.com/api/webhook \ -H "X-API-Key: TUA_CHIAVE_API" [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- url | string | Indirizzo URL webhook (può essere stringa vuota) enabled | boolean | Se il webhook è abilitato ### Esempio di Risposta [Code (json)] { "url": "https://your-server.com/webhook", "enabled": true } [/Code] ## Configura Webhook Imposta o aggiorna la configurazione webhook. ### Richiesta [Code (bash)] POST /api/webhook [/Code] ### Parametri di Richiesta Parametro | Tipo | Richiesto | Descrizione ----------- | ------ | ---------- | ------------- url | string | Sì | Indirizzo URL webhook (deve essere URL HTTP/HTTPS valido) enabled | boolean | Sì | Se abilitare il webhook ### Esempio di Richiesta [Code (bash)] curl -X POST https://chat-tempmail.com/api/webhook \ -H "X-API-Key: TUA_CHIAVE_API" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-server.com/webhook", "enabled": true }' [/Code] ### Parametri di Risposta Parametro | Tipo | Descrizione ----------- | ------ | ------------- success | boolean | Se la configurazione è riuscita ### Esempio di Risposta [Code (json)] { "success": true } [/Code] ## Eventi Webhook Quando arriva un nuovo messaggio, il sistema invierà una richiesta POST al tuo URL configurato. ### Formato Dati Ricevuti Header Richiesta: - Content-Type: application/json - X-Webhook-Event: new_message ### Dati Push Webhook Parametro | Tipo | Descrizione ----------- | ------ | ------------- emailId | string | ID email che ha ricevuto il messaggio (formato UUID) messageId | string | ID nuovo messaggio (formato UUID) fromAddress | string | Indirizzo mittente subject | string | Oggetto del messaggio content | string | Contenuto testuale del messaggio html | string | Contenuto HTML del messaggio (può essere vuoto) receivedAt | string | Ora di ricezione del messaggio (formato ISO 8601) toAddress | string | Indirizzo email che ha ricevuto il messaggio ### Esempio Dati Push [Code (json)] { "emailId": "c2c4f894-c672-4d5b-a918-abca95aff1f7", "messageId": "fd13a8df-1465-4fbc-a612-ca7311c31ff2", "fromAddress": "sender@example.com", "subject": "Test Message", "content": "Contenuto testuale del messaggio", "html": "
Contenuto HTML del messaggio
", "receivedAt": "2025-01-21T08:30:45.084Z", "toAddress": "test@chat-tempmail.com" } [/Code] ### Requisiti di Risposta Il tuo server dovrebbe restituire un codice di stato 2xx per indicare la ricezione riuscita. Se viene restituito un codice di stato non-2xx, il sistema potrebbe ritentare l'invio. Risposta Raccomandata: [Code (json)] HTTP/1.1 200 OK Content-Type: application/json { "received": true } [/Code] ### Note Importanti - Assicurati che il tuo URL webhook sia accessibile - È raccomandato verificare l'integrità dei dati push sul lato server - Il sistema invierà push webhook immediatamente quando arrivano i messaggi - Se i push falliscono, il sistema potrebbe ritentare, quindi assicurati che la tua interfaccia sia idempotente ---