Skip to main content

Setup

To receive inbound emails, you need to:
  1. Add and verify your domain in the Unosend dashboard
  2. Enable “Receive Inbound Emails” on the domain settings
  3. Update your domain’s MX records to point to our inbound servers
  4. (Optional) Configure a webhook URL to receive real-time notifications

MX Records

Add these MX records to your domain:
Priority: 10
Host: @
Value: inbound.unosend.co

List Inbound Emails

GET/v1/inbound
Retrieve a list of inbound emails received at your domains.

Query Parameters

ParameterTypeDescription
limitintegerNumber of emails to return (default: 50, max: 100)
offsetintegerNumber of emails to skip for pagination
statusstringFilter by status: received, processed, failed
cURL
curl https://www.unosend.co/api/v1/inbound \
  -H "Authorization: Bearer un_your_api_key"

Response

Response
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "from": "sender@example.com",
      "from_name": "John Doe",
      "to": ["hello@yourdomain.com"],
      "cc": null,
      "subject": "Hello from the API",
      "has_html": true,
      "has_text": true,
      "attachment_count": 2,
      "received_at": "2024-01-15T10:30:00.000Z"
    }
  ]
}

Get Inbound Email

GET/v1/inbound/:id
Retrieve the full content of an inbound email including HTML, text, and attachments.
cURL
curl https://www.unosend.co/api/v1/inbound/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer un_your_api_key"

Response

Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "from": "sender@example.com",
  "from_name": "John Doe",
  "to": ["hello@yourdomain.com"],
  "cc": null,
  "subject": "Hello from the API",
  "html": "<html><body><h1>Hello!</h1></body></html>",
  "text": "Hello!",
  "attachments": [
    {
      "id": "att_123",
      "filename": "document.pdf",
      "contentType": "application/pdf",
      "size": 102400
    }
  ],
  "received_at": "2024-01-15T10:30:00.000Z"
}

Webhooks

Configure a webhook to receive real-time notifications when emails arrive. Create a webhook endpoint that subscribes to the email.received event.

Webhook Payload

email.received
{
  "type": "email.received",
  "data": {
    "inbound_email_id": "550e8400-e29b-41d4-a716-446655440000",
    "from": "sender@example.com",
    "from_name": "John Doe",
    "to": ["hello@yourdomain.com"],
    "cc": null,
    "subject": "Hello from the API",
    "has_html": true,
    "has_text": true,
    "attachment_count": 2
  },
  "created_at": "2024-01-15T10:30:00.000Z"
}
The webhook only contains metadata. Use the inbound_email_id to fetch the full email content via the API if needed.

List Attachments

GET/v1/inbound/:id/attachments
Retrieve a list of attachments for an inbound email with signed download URLs that expire in 1 hour.
cURL
curl https://www.unosend.co/api/v1/inbound/550e8400-e29b-41d4-a716-446655440000/attachments \
  -H "Authorization: Bearer un_your_api_key"

Response

Response
{
  "data": [
    {
      "id": "att_550e8400-e29b-41d4-a716",
      "filename": "document.pdf",
      "content_type": "application/pdf",
      "content_disposition": "attachment",
      "content_id": null,
      "size": 102400,
      "download_url": "https://supabase.co/storage/...",
      "expires_at": "2024-01-15T11:30:00.000Z"
    },
    {
      "id": "att_660e8400-e29b-41d4-a717",
      "filename": "logo.png",
      "content_type": "image/png",
      "content_disposition": "inline",
      "content_id": "img001",
      "size": 24567,
      "download_url": "https://supabase.co/storage/...",
      "expires_at": "2024-01-15T11:30:00.000Z"
    }
  ]
}
Download URLs expire after 1 hour. Request new URLs if needed.

Reply to Email

POST/v1/inbound/:id/reply
Send a reply to an inbound email. The reply is automatically threaded with proper In-Reply-To and References headers.

Request Body

FieldTypeDescription
htmlstringHTML content of the reply (optional if text provided)
textstringPlain text content of the reply (optional if html provided)
cURL
curl -X POST https://www.unosend.co/api/v1/inbound/550e8400-e29b-41d4-a716-446655440000/reply \
  -H "Authorization: Bearer un_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<p>Thank you for your email!</p>",
    "text": "Thank you for your email!"
  }'

Response

Response
{
  "success": true,
  "messageId": "msg_abc123...",
  "emailId": "email_xyz789..."
}

Delete Inbound Email

DELETE/v1/inbound/:id
Permanently delete an inbound email and its attachments. This action cannot be undone.
cURL
curl -X DELETE https://www.unosend.co/api/v1/inbound/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer un_your_api_key"

Response

Response
{
  "deleted": true,
  "id": "550e8400-e29b-41d4-a716-446655440000"
}

Spam Filtering

All inbound emails are automatically scanned for spam. The response includes:
FieldDescription
spam_statusclean, spam, or suspicious
spam_scoreNumeric score (higher = more likely spam)
spf_resultSPF verification result (pass, fail, neutral)
dkim_resultDKIM verification result
dmarc_resultDMARC verification result