---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://docs.sendcorex.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.sendcorex.com/llms.txt"
---

Source: https://docs.sendcorex.com/api-reference/receive-emails

Receive Emails

# Read emails with the API

Read the emails that arrive on your domain from your own code. List conversations, open messages, search, label, organize, send and reply, all through one endpoint.

- REST
- JSON
- Threads and search
- Labels and folders
- Send and reply

Set up your mailbox Browse the commands

Host `https://g.sendcorex.com`

## How it works

One token, one mailbox

Your token belongs to a sender, and a sender is a mailbox. No argument picks whose emails you read: the token decides.

One endpoint for everything

List, read, search, flag, move, send and reply are commands sent to POST /v1. Send up to 20 per request.

Short-lived tokens

The access token lasts 1 hour and the refresh token 15 days. The refresh token rotates every time you use it.

## Set up your mailbox

Do these once. After that, every request only needs your token.

1. 1
Add a domain, or use a shared one
Verify your own domain, or skip the DNS work and use a shared domain.
[Open Domains](https://app.sendcorex.com/dashboard/domains)
2. 2
Create a sender
A sender is a mailbox. Create one on your verified domain or on a shared domain: on a shared domain, creating the sender creates the mailbox.
If you registered your own domain and already sent an email, the sender was created for you automatically.
[Open Senders](https://app.sendcorex.com/dashboard/senders)
3. 3
Point your MX record
Only needed if you want to receive email on your own domain. Point the MX record to the Sendcorex inbound host.
See the MX record
4. 4
Generate your tokens
Open the webmail, go to Settings and generate an access token and a refresh token for the sender.
[Open Webmail](https://webmail.sendcorex.com/)
5. 5
Call the API
Send your token in the Authorization header and your first command to POST /v1.
[Run Commands](https://docs.sendcorex.com/api-reference/receive-emails/routes/run-commands) [Refresh Token](https://docs.sendcorex.com/api-reference/receive-emails/routes/refresh-token)

## MX record

To receive email on your own domain, its MX record must point to the Sendcorex inbound host. Add this record at your DNS provider.

- Type`MX`
- Points to`bounce.emailsbit.com`

The MX record is only for receiving on your own domain. Without it, you can still send, and read the bounces and complaints that return to your mailbox.

## What reaches the mailbox

Regular emails

Everything sent to your sender address, as in any mailbox.

Return-path messages

Bounces and other messages that come back to the return path are saved in the mailbox too, so you can read them through the API.

Complaints

Spam complaints are saved in the mailbox as well. They only come from Microsoft 365 and Microsoft services in general.

## Your first request

List the unread conversations in your INBOX. Replace `SENDCOREX_TOKEN` with the access token from the webmail settings.

```
curl -X POST 'https://g.sendcorex.com/v1' \
  -H "Authorization: $SENDCOREX_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "commands": [
    { "command": "list_threads", "args": { "folder": "INBOX", "is_read": false, "limit": 10 } }
  ]
}'
```

Each thread has a `last_message_uid`. Pass it to [Get Messages](https://docs.sendcorex.com/api-reference/receive-emails/reading/get-messages) to read the email, or to [Reply](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/reply) to answer it.

## Full reference

Everything marked CMD is a command sent through POST /v1, up to 20 per request. Routes use their own paths.

### Routes

4

- [POST Refresh TokenRotate the token pair, no auth needed](https://docs.sendcorex.com/api-reference/receive-emails/routes/refresh-token)
- [POST Run Commands1 to 20 commands per request](https://docs.sendcorex.com/api-reference/receive-emails/routes/run-commands)
- [GET Raw MessageOriginal .eml or an attachment](https://docs.sendcorex.com/api-reference/receive-emails/routes/raw-message)
- [GET HealthService check](https://docs.sendcorex.com/api-reference/receive-emails/routes/health)

### Identity

1

- [CMD WhoamiWhich mailbox and credential you are using](https://docs.sendcorex.com/api-reference/receive-emails/identity/whoami)

### Folders & counters

5

- [CMD List FoldersSystem and custom folders with counts](https://docs.sendcorex.com/api-reference/receive-emails/folders/list-folders)
- [CMD Get CountersTotal, unread and size per folder](https://docs.sendcorex.com/api-reference/receive-emails/folders/get-counters)
- [CMD Create FolderNew custom folder](https://docs.sendcorex.com/api-reference/receive-emails/folders/create-folder)
- [CMD Rename FolderName changes, slug stays](https://docs.sendcorex.com/api-reference/receive-emails/folders/rename-folder)
- [CMD Delete FolderMessages stay where they are](https://docs.sendcorex.com/api-reference/receive-emails/folders/delete-folder)

### Reading

5

- [CMD List ThreadsGmail-style conversations](https://docs.sendcorex.com/api-reference/receive-emails/reading/list-threads)
- [CMD List MessagesPer message, no grouping](https://docs.sendcorex.com/api-reference/receive-emails/reading/list-messages)
- [CMD Get ThreadFull conversation, optional bodies](https://docs.sendcorex.com/api-reference/receive-emails/reading/get-thread)
- [CMD Get MessagesBody, headers and attachments](https://docs.sendcorex.com/api-reference/receive-emails/reading/get-messages)
- [CMD SearchBy sender, domain, subject or body](https://docs.sendcorex.com/api-reference/receive-emails/reading/search)

### Flags & labels

8

- [CMD Set FlagsRead, starred, important](https://docs.sendcorex.com/api-reference/receive-emails/flags-labels/set-flags)
- [CMD Add LabelsCase-insensitive labels](https://docs.sendcorex.com/api-reference/receive-emails/flags-labels/add-labels)
- [CMD Remove LabelsCase-insensitive labels](https://docs.sendcorex.com/api-reference/receive-emails/flags-labels/remove-labels)
- [CMD Mark Images LoadedClear the external images flag](https://docs.sendcorex.com/api-reference/receive-emails/flags-labels/mark-images-loaded)
- [CMD List LabelsNames and colors](https://docs.sendcorex.com/api-reference/receive-emails/flags-labels/list-labels)
- [CMD Create LabelNew label](https://docs.sendcorex.com/api-reference/receive-emails/flags-labels/create-label)
- [CMD Set Label ColorChange the color](https://docs.sendcorex.com/api-reference/receive-emails/flags-labels/set-label-color)
- [CMD Delete LabelFrom every message](https://docs.sendcorex.com/api-reference/receive-emails/flags-labels/delete-label)

### Organize

4

- [CMD MoveBetween folders, thread or message](https://docs.sendcorex.com/api-reference/receive-emails/organize/move)
- [CMD DeletePermanent, Trash or Spam only](https://docs.sendcorex.com/api-reference/receive-emails/organize/delete)
- [CMD SnoozeHide until a future date](https://docs.sendcorex.com/api-reference/receive-emails/organize/snooze)
- [CMD UnsnoozeBack to INBOX as unread](https://docs.sendcorex.com/api-reference/receive-emails/organize/unsnooze)

### Send & trust

9

- [CMD Send EmailNew message, saved to Sent](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/send-email)
- [CMD ReplySame conversation, keeps labels](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/reply)
- [CMD Get TrustTrust status of a sender](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/get-trust)
- [CMD Set TrustDefault, trusted or untrusted](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/set-trust)
- [CMD List TrustSenders with a decision](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/list-trust)
- [CMD ForwardOriginal attachments included](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/forward)
- [CMD Get TrackingOpens and clicks of sent emails](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/get-tracking)
- [CMD List ActivityWho opened, clicked or unsubscribed](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/list-activity)
- [CMD Activity CountsBadges of the Activity folders](https://docs.sendcorex.com/api-reference/receive-emails/send-trust/activity-counts)

### Attachments

4

- [CMD Upload AttachmentFile first, send later](https://docs.sendcorex.com/api-reference/receive-emails/attachments/upload-attachment)
- [POST Upload Large FileBinary, up to 25 MB](https://docs.sendcorex.com/api-reference/receive-emails/attachments/upload-large-file)
- [CMD Delete AttachmentBefore it is sent](https://docs.sendcorex.com/api-reference/receive-emails/attachments/delete-attachment)
- [CMD Get AttachmentFile as base64](https://docs.sendcorex.com/api-reference/receive-emails/attachments/get-attachment)

### Schedule

3

- [CMD Schedule SendSends at the time you pick](https://docs.sendcorex.com/api-reference/receive-emails/schedule/schedule-send)
- [CMD Cancel ScheduleBack to Drafts](https://docs.sendcorex.com/api-reference/receive-emails/schedule/cancel-schedule)
- [CMD Send Scheduled NowSkip the wait](https://docs.sendcorex.com/api-reference/receive-emails/schedule/send-scheduled-now)

### Drafts

5

- [CMD Save DraftWrite now, send later by hand](https://docs.sendcorex.com/api-reference/receive-emails/drafts/save-draft)
- [CMD List DraftsNewest first](https://docs.sendcorex.com/api-reference/receive-emails/drafts/list-drafts)
- [CMD Get DraftReady to edit](https://docs.sendcorex.com/api-reference/receive-emails/drafts/get-draft)
- [CMD Delete DraftGone for good](https://docs.sendcorex.com/api-reference/receive-emails/drafts/delete-draft)
- [CMD Send DraftKept if refused](https://docs.sendcorex.com/api-reference/receive-emails/drafts/send-draft)

### Rules

10

- [CMD List RulesIn execution order, with hits](https://docs.sendcorex.com/api-reference/receive-emails/rules/list-rules)
- [CMD Get RuleOne rule](https://docs.sendcorex.com/api-reference/receive-emails/rules/get-rule)
- [CMD Create RuleFilters for every new email](https://docs.sendcorex.com/api-reference/receive-emails/rules/create-rule)
- [CMD Update RuleReplace the rule](https://docs.sendcorex.com/api-reference/receive-emails/rules/update-rule)
- [CMD Delete RuleRemove a rule](https://docs.sendcorex.com/api-reference/receive-emails/rules/delete-rule)
- [CMD Set Rule EnabledOn or off](https://docs.sendcorex.com/api-reference/receive-emails/rules/set-rule-enabled)
- [CMD Reorder RulesExecution order](https://docs.sendcorex.com/api-reference/receive-emails/rules/reorder-rules)
- [CMD Rule OptionsFields, operators, actions](https://docs.sendcorex.com/api-reference/receive-emails/rules/rule-options)
- [CMD Test RuleDry run on recent emails](https://docs.sendcorex.com/api-reference/receive-emails/rules/test-rule)
- [CMD Apply RuleRun on emails already there](https://docs.sendcorex.com/api-reference/receive-emails/rules/apply-rule)

### Templates

6

- [CMD List TemplatesMost used first](https://docs.sendcorex.com/api-reference/receive-emails/templates/list-templates)
- [CMD Get TemplateWith the body](https://docs.sendcorex.com/api-reference/receive-emails/templates/get-template)
- [CMD Create TemplateSaved reply with placeholders](https://docs.sendcorex.com/api-reference/receive-emails/templates/create-template)
- [CMD Update TemplateChange the text](https://docs.sendcorex.com/api-reference/receive-emails/templates/update-template)
- [CMD Delete TemplateRemove it](https://docs.sendcorex.com/api-reference/receive-emails/templates/delete-template)
- [CMD Use TemplateFilled and ready to send](https://docs.sendcorex.com/api-reference/receive-emails/templates/use-template)

### Contact & follow-up

5

- [CMD Get ContactWho this person is](https://docs.sendcorex.com/api-reference/receive-emails/contact/get-contact)
- [CMD Save Contact NoteYour private note](https://docs.sendcorex.com/api-reference/receive-emails/contact/save-contact-note)
- [CMD List FollowupsWaiting for a reply](https://docs.sendcorex.com/api-reference/receive-emails/contact/list-followups)
- [CMD Set FollowupRemind me if no reply](https://docs.sendcorex.com/api-reference/receive-emails/contact/set-followup)
- [CMD Cancel FollowupRemove the reminder](https://docs.sendcorex.com/api-reference/receive-emails/contact/cancel-followup)

### Contacts & audience

12

- [CMD List ContactsPeople who talk to this mailbox](https://docs.sendcorex.com/api-reference/receive-emails/audience/list-contacts)
- [CMD Count ContactsHow many people match a filter](https://docs.sendcorex.com/api-reference/receive-emails/audience/count-contacts)
- [CMD Get Mailbox ContactOne contact with counts and trust](https://docs.sendcorex.com/api-reference/receive-emails/audience/get-mailbox-contact)
- [CMD Update Contact NameChange a contact’s name](https://docs.sendcorex.com/api-reference/receive-emails/audience/update-contact-name)
- [CMD Tag ContactAdd or remove tags](https://docs.sendcorex.com/api-reference/receive-emails/audience/tag-contact)
- [CMD Get Contact EventsOpens, clicks and emails of a contact](https://docs.sendcorex.com/api-reference/receive-emails/audience/get-contact-events)
- [CMD List SegmentsSaved segments of the mailbox](https://docs.sendcorex.com/api-reference/receive-emails/audience/list-segments)
- [CMD Save SegmentCreate or edit a segment](https://docs.sendcorex.com/api-reference/receive-emails/audience/save-segment)
- [CMD Delete SegmentDelete a segment](https://docs.sendcorex.com/api-reference/receive-emails/audience/delete-segment)
- [CMD Get AudienceSize of an audience before sending](https://docs.sendcorex.com/api-reference/receive-emails/audience/get-audience)
- [CMD Check RecipientsWho unsubscribed, before sending](https://docs.sendcorex.com/api-reference/receive-emails/audience/check-recipients)
- [CMD Get Delivery StatusDelivery per recipient of a sent email](https://docs.sendcorex.com/api-reference/receive-emails/audience/get-delivery-status)

### Newsletters

4

- [CMD Get Unsubscribe OptionsHow to leave a list](https://docs.sendcorex.com/api-reference/receive-emails/newsletters/get-unsubscribe-options)
- [CMD UnsubscribeOne-click, server side](https://docs.sendcorex.com/api-reference/receive-emails/newsletters/unsubscribe)
- [CMD List UnsubscribedLists you left](https://docs.sendcorex.com/api-reference/receive-emails/newsletters/list-unsubscribed)
- [CMD Remove UnsubscribeStop sending to Spam](https://docs.sendcorex.com/api-reference/receive-emails/newsletters/remove-unsubscribe)
