JunkMail

Emails

Endpoints for managing received emails

List Emails

Retrieves the list of emails for your addresses.

GET /api/v1/emails

Required scope: emails:read

Query Parameters

ParameterTypeDescription
address_idstringFilter by address (UUID, optional)
typestringFilter by type: received, sent
is_deletedstringtrue to show deleted emails
limitnumberNumber of results (default: 50)
offsetnumberOffset for pagination

Example

curl -X GET "https://api.junkmail.dev/api/v1/emails?address_id=550e8400-e29b-41d4-a716-446655440000&type=received&limit=10" \
  -H "Authorization: Bearer jm_live_xxxx"

Response

{
  "data": [
    {
      "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
      "addressId": "550e8400-e29b-41d4-a716-446655440000",
      "type": "received",
      "from": "noreply@example.com",
      "fromName": "Service Client",
      "to": "test@junkmail.site",
      "subject": "Confirmation de votre inscription",
      "bodyText": "Merci de confirmer...",
      "bodyHtml": "<p>Merci de confirmer...</p>",
      "isRead": true,
      "isStarred": false,
      "receivedAt": "2024-01-16T14:30:00Z",
      "hasAttachments": false
    }
  ],
  "total": 1,
  "limit": 10,
  "offset": 0
}

Retrieve an Email

Retrieves the full content of an email.

GET /api/v1/emails/:id

Required scope: emails:read

Example

curl -X GET https://api.junkmail.dev/api/v1/emails/6ba7b810-9dad-11d1-80b4-00c04fd430c8 \
  -H "Authorization: Bearer jm_live_xxxx"

Response

{
  "data": {
    "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
    "addressId": "550e8400-e29b-41d4-a716-446655440000",
    "type": "received",
    "from": "noreply@example.com",
    "fromName": "Service Client",
    "to": "test@junkmail.site",
    "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>",
    "isRead": true,
    "isStarred": false,
    "receivedAt": "2024-01-16T14:30:00Z",
    "attachments": []
  }
}

If the email does not exist:

{
  "error": "Email not found"
}

Delete an Email

Deletes an email (soft delete). The email can be retrieved via is_deleted=true.

DELETE /api/v1/emails/:id

Required scope: emails:write

Example

curl -X DELETE https://api.junkmail.dev/api/v1/emails/6ba7b810-9dad-11d1-80b4-00c04fd430c8 \
  -H "Authorization: Bearer jm_live_xxxx"

Response

{
  "data": {
    "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
  },
  "message": "Email deleted successfully"
}

If the email does not exist:

{
  "error": "Email not found"
}