Reading synced emails
Once a broker has connected a mailbox, Korint keeps a copy of its emails and groups them into conversations. This page shows how your front end lists those conversations as an inbox, opens them, reads each email and its attachments, and shows the exchanges about one policy. As on the connection page, every call needs the user access token of a broker; there is nothing to read with a client-credentials token.
What Korint synchronizes
Korint ingests the emails a connected mailbox receives or sends after it was connected; it does not import the mail already there in bulk. An older email can still appear later: when the mailbox reports a change to an email Korint does not have yet, such as an Outlook email moved out of the junk folder, Korint stores it whatever its date. Drafts are skipped, and so are Outlook messages filed in the junk or trash folders.
An email arrives in two stages. Korint first stores its metadata (addresses, subject, date, the
list of attachments), so it appears in the lists right away, then retrieves its body and each
attachment in the background, up to five attempts each. Until then the email reads with
bodyStatus: "pending" and its attachments with status: "pending".
The read state mirrors the mailbox: marking an email read or unread in Gmail or Outlook is reflected in Korint. Opening an email through Korint marks it read in Korint and in the mailbox; there is no call to mark it unread. An email deleted from the mailbox stays in Korint, and so do the emails of an account the broker disconnected.
Who sees what
A broker never sees a colleague's personal mailbox. Shared mailboxes are visible differently depending on the view:
| Call | Personal mailboxes | The firm's shared mailboxes |
|---|---|---|
GET /email-threads (inbox) | The broker's own | Shared-account admins only |
GET /general-inbox/summary | The broker's own, except disconnected ones | Shared-account admins only, except disconnected ones |
GET /email-threads?policyId=… | The broker's own | Every broker with access to the policy |
GET /email-threads/{threadId}, GET /emails/{emailId} and attachment downloads | The broker's own | Every broker of the firm |
canManageSharedAccounts in GET /email-accounts/@me tells you which inbox the signed-in broker
gets. An id the broker may not see answers 400 INVALID_INPUT_ID, exactly like an unknown one, so
the response never reveals whether an email exists.
Threads and their processing state
The inbox lists threads, not individual emails. A thread is the set of emails of one mailbox
that the provider files in the same conversation, or a single email when the provider gives none.
The same conversation received by two connected mailboxes makes two threads. A thread's id is
opaque and never changes; pass it back as is.
The inbox is a work queue. An email is to process while it is neither archived nor linked to a policy:
- Korint links emails to policies automatically. Within a mailbox's conversation, it reuses the
policies of earlier emails; otherwise it looks for a policy number in the subject and visible
body, and failing that for a customer's email address among the senders (or, for an email the
broker sent, the recipients).
analysisPendingistruewhile this analysis is still to run. - Archiving an email and correcting its links are broker decisions, taken outside the public API.
mode=to_process, the default, lists the threads with at least one email to process;
mode=processed lists the others. In processed mode only, processedFilter=linked keeps the
threads with a linked email and processedFilter=archived those with an archived one. Each thread
reports toProcessCount, isArchived and the linkedPolicies of its emails.
Build an inbox
- Show the unread badge
GET /general-inbox/summaryreturnsunreadThreadCount, the threads to process with at least one unread email, and the same count per mailbox inunreadThreadCountByAccount, which leaves out the mailboxes at zero. - List the threads
GET /email-threadsreturns threads newest first, ordered by their latest email, with that email's sender, subject, preview and date. Filter withmode,processedFilter,unread=trueandaccountIds(repeat the parameter for several mailboxes). Page withlimit, up to 100, and thenextCursorof the previous page, until it isnull. Listing never marks an email read. - Open a thread
GET /email-threads/{threadId}returns every email of the thread, oldest first, with its processing state and linked policies, but without bodies. Opening it marks each unread email read, in Korint and in the mailbox. - Read each email
GET /emails/{emailId}returns the email with its addresses,bodyHtmland attachments, and marks it read if it was not.
Bodies
bodyStatus | bodyHtml |
|---|---|
pending | null: the body is still being retrieved. Read the email again later. |
stored | The body, as web-safe HTML. An empty string is a genuinely empty email. |
unavailable | null: the message no longer exists at the provider. |
failed | null: retrieval failed on its last attempt; bodyError gives the reason. |
Attachments
An image shown inside the body is an inline attachment: once stored, it carries an inlineUrl,
valid for five minutes, to put in place of the matching cid: reference in bodyHtml. For any
other attachment, GET /emails/{emailId}/attachments/{emailAttachmentId}/download-url returns a
url serving the file under its original name, valid until expiresAt, five minutes later. Ask
for a new one each time the broker downloads. While an attachment is not stored (its status is
pending, skipped or failed), the call answers 409 EMAIL_ATTACHMENT_NOT_STORED, with the
status and failureReason in details.
Show a policy's exchanges
To show the correspondence about one policy, as a tab on its page for instance, call
GET /email-threads?policyId=…. It returns every thread in which at least one email is linked to
that policy, with all their emails embedded, oldest first, archived ones included, and changes no
read state. The broker needs access to the policy (403 FORBIDDEN otherwise), and sees the firm's
shared mailboxes here even without the shared-account admin permission. search narrows the
threads to those with an email whose subject, sender or recipient, or body contains the text,
ignoring case but not accents; it is accepted only with policyId, and mode and
processedFilter are not.
Errors
| Code | Status | Raised when |
|---|---|---|
MUST_BE_AUTHENTICATED | 401 | The request carries no bearer token. |
REQUEST_VALIDATION_FAILED | 400 | A query parameter is malformed or used outside its mode, such as processedFilter without mode=processed, or search without policyId. |
INVALID_INPUT_ID | 400 | The cursor is malformed, or the thread, email or attachment is unknown or not visible to the broker. |
FORBIDDEN | 403 | The broker has no access to the policy given as policyId. |
EMAIL_ATTACHMENT_NOT_STORED | 409 | The attachment asked for is not stored. |