Authentication
A mailbox belongs to one person, so these endpoints need a credential that acts for you:
- CLI login.
omni auth logincreates a key bound to your user. Logins made before these scopes existed must runomni auth loginagain. - Your own chat sandbox. Code you run in an assistant chat receives a read-only
OMNI_API_KEYfor your mailboxes during that run. Saving a draft through the API requires a signed-in session or CLI login. - A signed-in session, with
organizationIdin the query or JSON body.
403, as do Applications and Computer previews, which serve other viewers. You also need the integration permission the assistant’s email tools require in your organization role.
Choose an account
connectionId, emailAddress, provider (gmail or outlook), isDefault and status. Pass connectionId to the other endpoints to use an account other than your default. A connectionId that is not one of your own accounts is refused.
Search and page through a mailbox
Keep
query, readState, maxResults and connectionId the same while you pass each nextPageToken back as pageToken, until it is null. A page can be empty while more pages remain. A token used with different search arguments is refused.
Read a message
id from search results, encoded as one path segment; the SDKs encode it for you. Outlook ids can contain /.
Read a conversation
Use athreadId from Search Emails and the same connectionId. Call client.email.getThread({ threadId, connectionId }) in TypeScript or client.email.get_thread(thread_id=thread_id, connection_id=connection_id) in Python. The conversation includes each message’s headers, plain-text body and read and draft state.
Save a draft
replyToMessageId (and threadId for Gmail) to draft the reply in its conversation. When the provider saved a draft whose threading could not be verified, the request fails and data.unverifiedDraftId names the draft so you can find or discard it.
Inspect saved drafts
Callclient.email.getDrafts({ connectionId, draftIds }) in TypeScript or client.email.get_drafts(connection_id=connection_id, draft_ids=draft_ids) in Python. Supply the original mailbox connection ID and up to 20 exact draft IDs. Inspect data.results for each distinct draft, including drafts that were already sent, moved or discarded.