Emails
Endpoints pour gérer les emails reçus
Liste des emails
Récupère la liste des emails pour une adresse.
GET /api/v1/emails
Scope requis : emails:read
Paramètres de requête
| Paramètre | Type | Description |
|---|---|---|
addressId | string | Filtrer par adresse (optionnel) |
limit | number | Nombre de résultats (défaut: 20, max: 100) |
offset | number | Décalage pour la pagination |
Exemple
curl -X GET "https://api.junkmail.dev/api/v1/emails?addressId=addr_123abc&limit=10" \
-H "Authorization: Bearer jm_live_xxxx"
Réponse
{
"success": true,
"data": {
"emails": [
{
"id": "email_789ghi",
"addressId": "addr_123abc",
"from": "noreply@example.com",
"subject": "Confirmation de votre inscription",
"preview": "Merci de confirmer votre adresse email...",
"receivedAt": "2024-01-16T14:30:00Z",
"hasAttachments": false,
"isRead": true
}
],
"total": 1,
"hasMore": false
}
}
Récupérer un email
Récupère le contenu complet d'un email.
GET /api/v1/emails/:id
Scope requis : emails:read
Exemple
curl -X GET https://api.junkmail.dev/api/v1/emails/email_789ghi \
-H "Authorization: Bearer jm_live_xxxx"
Réponse
{
"success": true,
"data": {
"id": "email_789ghi",
"addressId": "addr_123abc",
"from": "noreply@example.com",
"to": "test@junkmail.dev",
"subject": "Confirmation de votre inscription",
"bodyText": "Merci de confirmer votre adresse email en cliquant sur le lien suivant...",
"bodyHtml": "<html><body><p>Merci de confirmer votre adresse email...</p></body></html>",
"receivedAt": "2024-01-16T14:30:00Z",
"headers": {
"Message-ID": "<abc123@example.com>",
"Date": "Tue, 16 Jan 2024 14:30:00 +0000"
},
"attachments": []
}
}
Supprimer un email
Supprime un email spécifique.
DELETE /api/v1/emails/:id
Scope requis : emails:write
Exemple
curl -X DELETE https://api.junkmail.dev/api/v1/emails/email_789ghi \
-H "Authorization: Bearer jm_live_xxxx"
Réponse
{
"success": true,
"data": {
"deleted": true,
"id": "email_789ghi"
}
}
Pièces jointes
Télécharger une pièce jointe
GET /api/v1/emails/:emailId/attachments/:attachmentId
Scope requis : emails:read
Exemple
curl -X GET https://api.junkmail.dev/api/v1/emails/email_789ghi/attachments/att_123 \
-H "Authorization: Bearer jm_live_xxxx" \
-o fichier.pdf
La réponse est le fichier binaire avec les headers appropriés :
Content-Type: application/pdf
Content-Disposition: attachment; filename="document.pdf"