Conversation API

The Conversation API puts two things in your team inbox. A form submission becomes a conversation in Todo. An email your app sends, such as a signup welcome, goes out from a shared address, and the reply lands with the team.

Call it from your server. It has no browser CORS, so a request from a web page fails.

Guides

This page is the reference. If you are trying to get a specific job done, start with the guide for it.

Private pilot

Forms and reads work as soon as you have a key. Sending email is turned on per workspace during the pilot. Ask us to enable it. Until then can_send is false and the reason is in sending_reason.

Get a key

Open Settings, then Developers, as a workspace owner. Choose a name, a primary use, the addresses the key may use, and the fewest permissions that work. Intray shows the key once. Store it in your server's secret store.

The same page shows the API base URL for your workspace. The examples use INTRAY_API_URL for that URL, including /v1, and INTRAY_API_KEY for the key. A key starts with intray_.

PermissionGrants
conversations:createCreate a conversation from a form submission
conversations:readRead conversations, entries, and email content on the allowed addresses
conversations:writeChange status, snooze, and assignee on the allowed addresses
messages:sendSend new emails and replies from the allowed addresses

A contact form needs conversations:create only. GET /addresses works with any valid key.

A permission covers every conversation on the allowed addresses. That includes conversations started by people and by other keys. The primary use is a label. It grants nothing.

An allowed address covers mail sent to that address. If the address is also a catch-all address, the mail it receives for other addresses is covered only when you tick Include catch-all mail on the key. Without it:

  • A conversation that holds only catch-all mail returns 404 everywhere and is not listed.
  • A conversation that also holds mail sent to the address itself is readable. Its catch-all emails are left out of entries and return 404 by ID, and its other addresses are left out of recipients.

Making an address the catch-all does not change what an existing key can read.

Rotate retires the old key for new requests at once and keeps retries working under the new key. Revoke stops new requests and blocks that key's queued email before it is sent. An email already handed to the mail provider cannot be recalled. To change permissions or addresses, create a new key.

Keys stay on the server

Never put a key in browser JavaScript, HTML, or a mobile app bundle. Add spam protection, validation, and rate limits to your own form endpoint.

Conventions

AuthorizationheaderRequired

Bearer followed by the key. A missing, malformed, retired, or revoked key returns 401.

Content-TypeheaderRequired

application/json on every POST and PATCH. Anything else returns 415 unsupported_media_type.

Idempotency-KeyheaderRequired

Required on every POST and PATCH. 1 to 128 printable ASCII characters, no spaces. Missing or invalid returns 400 idempotency_key_required. See Retries.

expected_versionstringOptional

Required on reply and triage. Copy version from the conversation you read. If the conversation changed since, the write returns 409 version_conflict.

Body size256 KBOptional

A larger request returns 413 body_too_large. text and html are each limited to 200,000 characters, and the final email body, including the opt-out footer, to 200,000 bytes.

Unknown fieldsrejectedOptional

Any field this page does not list returns 422 invalid_request. The message names the field.

Request limit60 per minuteOptional

Per key. 600 per minute per workspace. Reads, rejected requests, and replays all count.

Every error has the same shape. The request ID is also in the X-Request-Id header. Send it to us when you report a problem.

Error
{
  "error": {
    "code": "version_conflict",
    "message": "Conversation changed; read it again before retrying with a new idempotency key",
    "request_id": "5b0c1c9e-6f0e-4a57-9d0e-2f1b7c3a9e11"
  }
}
StatusCodeMeaning
400idempotency_key_requiredInvalid JSON, or a missing or invalid Idempotency-Key
401Missing, malformed, retired, or revoked key
403forbiddenThe key lacks the permission for this request
403sending_pausedSending is paused for the workspace
404not_foundUnknown endpoint, or a resource the key cannot access
409version_conflictThe conversation changed since the version you sent
409idempotency_conflict, idempotency_expiredThe Idempotency-Key was used with a different payload, or more than seven days ago
409address_disabledThe address is turned off
409conversation_spamThe conversation is in Spam. Move it out before you send
409conversation_trashThe conversation is in Trash. Restore it before you send
413body_too_largeBody over 256 KB
415unsupported_media_typeContent-Type is not application/json
422invalid_requestInvalid or unknown field
422INVALID_ARGUMENTThe recipient is suppressed, or assignee_id is not a member of the workspace
429send_limit, integration_limit, recipient_limitSending capacity is used up for the workspace, this key, or this recipient. Retry-After: 60
503sending_not_configuredSending through the API is not turned on for this workspace yet
503not_readyGET /conversations right after an upgrade, while old mail is indexed. Retry-After: 60

A 500 never includes internal detail. Its code is internal_error.

Endpoints

All paths are under /v1.

MethodPathPermissionResult
GET/addressesAny keyAddresses the key may use, and whether each can send
POST/conversationsconversations:create201. New conversation from a submission. Sends no email
POST/messagesmessages:send202. New email, queued
POST/conversations/{id}/messagesmessages:send202. Reply on that conversation, queued
PATCH/conversations/{id}conversations:write200. Status, snooze, and assignee
GET/conversationsconversations:readConversations on the allowed addresses, newest first
GET/conversations/{id}conversations:readThe conversation
GET/conversations/{id}/entriesconversations:readEmails and submissions, newest first
GET/messages/{id}conversations:readOne email with its delivery status
POST/embedsconversations:read201. A one-time link to show a conversation in your app

A write returns the id of its conversation. Store it. To find conversations your app did not create, such as email a customer sent first, list them.

Find your address ID

Every write names the address it uses by ID.

curl "$INTRAY_API_URL/addresses" \
  -H "Authorization: Bearer $INTRAY_API_KEY"
200 OK
{
  "data": [
    {
      "id": "<address ID>",
      "address": "support@example.com",
      "name": "Example support",
      "status": "active",
      "domain_status": "active",
      "can_send": false,
      "sending_reason": "This key does not have messages:send"
    }
  ]
}

can_send checks the key's permission, whether the address is ready to send, sending health, and remaining capacity. It does not reserve a place in the queue, and it says nothing about a particular recipient. sending_reason is null when can_send is true.

Create a conversation from a form

Save the form in your own database first. Then send it to Intray with an Idempotency-Key built from your saved record's ID, so a retry cannot create a second conversation.

curl "$INTRAY_API_URL/conversations" \
  -H "Authorization: Bearer $INTRAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: form-8841" \
  -d '{
    "address_id": "<address ID>",
    "customer": { "email": "ada@example.com", "name": "Ada" },
    "subject": "Demo request",
    "initial_entry": {
      "type": "submission",
      "text": "Can we arrange a demo next week?",
      "fields": { "company": "Example company", "team size": "8" }
    },
    "external_id": "lead-8841"
  }'
201 Created
{
  "conversation": {
    "id": "<conversation ID>",
    "address_id": "<address ID>",
    "subject": "Demo request",
    "customer": { "...": "..." },
    "triage": { "status": "todo", "snooze_until": null },
    "group": "inbox",
    "assignee_id": null,
    "version": "<version>",
    "origin": "<origin>",
    "external_id": "lead-8841",
    "created_at": 1790000000000,
    "updated_at": 1790000000000,
    "app_url": "<link to the conversation in Intray>"
  },
  "entry": { "id": "<entry ID>", "type": "submission" }
}
address_idstringRequired

From GET /addresses. A disabled address returns 409 address_disabled.

customerobjectRequired

email, and optionally name. A submitted name never overwrites an existing customer's name.

subjectstringRequired

Up to 500 characters, no line breaks.

initial_entry.type"submission"Required
initial_entry.textstringRequired

1 to 32,000 characters.

initial_entry.fieldsobjectOptional

Up to 30 fields. A field name starts with a letter and has up to 64 letters, digits, spaces, or hyphens. A value is a string of up to 2,000 characters.

external_idstringOptional

Your own reference, up to 200 characters. It does not deduplicate. Two accepted submissions make two conversations even when everything else matches.

initial_triage"todo" | "done"Optional

Defaults to todo.

A submission sends no email. Someone on the team replies from the inbox, and that first reply is a normal email with the original subject. Submissions do not run the rules that fire when email arrives.

app_url opens the conversation for a signed-in team member. It is not a public link.

Send an email

curl "$INTRAY_API_URL/messages" \
  -H "Authorization: Bearer $INTRAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-event-123" \
  -d '{
    "address_id": "<address ID>",
    "to": [{ "address": "ada@example.com", "name": "Ada" }],
    "subject": "Welcome",
    "text": "Thanks for signing up. Reply here if you need a hand.",
    "external_id": "signup-event-123"
  }'
202 Accepted
{
  "message_id": "<message ID>",
  "conversation": { "id": "<conversation ID>", "...": "..." },
  "delivery": { "status": "queued" },
  "suppressed": []
}

202 means Intray queued the email. It does not mean delivered. Read delivery status to find out.

Supply text, html, or both. A new email starts in Done by default, so signup mail does not fill the team's Todo list. Send "initial_triage": "todo" when the team should see it.

Every email sent through the API carries an opt-out link for your workspace, and the headers support one-click unsubscribe. A recipient who opts out gets no further email from the workspace, from any key or address, including email already queued.

Pilot limits

  • One to recipient per email.
  • No Cc and no Bcc. A non-empty cc or bcc is rejected.
  • No attachments.
  • No custom From or Reply-To. The email goes out as the address in address_id.
  • No batches, campaigns, or scheduled sends.

Composing from the inbox is not affected by these limits.

Reply to a conversation

Read the conversation first to get its version.

curl "$INTRAY_API_URL/conversations/$CONVERSATION_ID/messages" \
  -H "Authorization: Bearer $INTRAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: reply-5521" \
  -d '{
    "expected_version": "<version from GET>",
    "to": [{ "address": "ada@example.com" }],
    "text": "Here are the details you asked for.",
    "triage_after_send": "preserve"
  }'

The response is the same 202 as Send an email.

triage_after_send is preserve by default. todo and done also need conversations:write. subject is optional on a reply. A reply to a conversation in Spam fails until someone changes its status.

Change status and assignee

curl -X PATCH "$INTRAY_API_URL/conversations/$CONVERSATION_ID" \
  -H "Authorization: Bearer $INTRAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: triage-5521" \
  -d '{
    "expected_version": "<version from GET>",
    "triage": { "status": "snoozed", "snooze_until": 1790086400000 },
    "assignee_id": null
  }'

Send triage, assignee_id, or both. Sending neither returns 422.

StatusMeaning
todoNeeds the team's attention
doneArchived. A new inbound email moves it back to Todo
snoozedHidden until snooze_until, a future time in Unix milliseconds
spamQuarantined. A new inbound email leaves it in Spam
trashDeleted. Any other status restores it, and a new inbound email moves it back to Todo. Deleted for good 30 days later

snooze_until is accepted only with snoozed. assignee_id is the user ID of a current workspace member, or null to unassign. A status change made through the API does not run the rules that fire when a person changes status.

version changes when an email or submission arrives, and when status, snooze, or assignee change, from the API or the inbox. Delivery updates and reads do not change it. After 409 version_conflict, read the conversation again, decide whether your change still makes sense, and send it with the new version and a new Idempotency-Key.

List conversations

GET /conversations returns the conversations on the addresses the key may use, newest first. It needs conversations:read and counts toward the same request limit as every other call.

ParameterMeaning
address_idOnly conversations on this address. An address the key may not use returns 404.
toOnly conversations with email delivered to this exact address. Case does not matter.
customerOnly conversations with the customer who has this email address. Case does not matter. Not with to.
sinceOnly conversations active at or after this time. ISO 8601 (2026-10-01T00:00:00Z) or milliseconds since 1970.
triageOnly conversations with this status: todo, done, snoozed, spam, or trash. Without it, the list leaves out trash.
groupinbox for conversations with people, other for Other mail. See Other mail.
qSearch words, 2 to 200 characters. See Search. Not with to, customer, or since.
last_messageoutbound: only conversations where the team sent the newest email. See Sent. Not with to, customer, or q.
limit1 to 50. The default is 25.
cursornext_cursor from the page before. Send it with the same filters. With different filters it returns 422.
curl "$INTRAY_API_URL/conversations?to=billing@example.com&since=2026-10-01T00:00:00Z" \
  -H "Authorization: Bearer $INTRAY_API_KEY"
200 OK
{
  "data": [
    {
      "id": "<conversation ID>",
      "address_id": "<address ID>",
      "subject": "Invoice 1042",
      "customer": { "name": "Ada", "email": "ada@example.com" },
      "triage": { "status": "todo", "snooze_until": null },
      "group": "inbox",
      "assignee_id": null,
      "version": "1",
      "origin": "email",
      "external_id": null,
      "created_at": 1790000000000,
      "updated_at": 1790000000000,
      "last_inbound_at": 1790000000000,
      "last_outbound_at": null,
      "app_url": "https://<your Intray URL>/w/<workspace>/inbox/<conversation ID>",
      "recipients": [
        {
          "address": "billing@example.com",
          "latest_message_id": "<message ID>",
          "latest_message_at": 1790000000000
        }
      ],
      "latest_message_id": "<message ID>"
    }
  ],
  "next_cursor": null
}

Each row has the fields of GET /conversations/{id} and two more. A conversation's last_inbound_at and last_outbound_at are the times of its newest inbound and newest outbound email, in milliseconds since 1970, or null when it has none. An email you send counts from the moment Intray accepts it, before it is delivered. A form submission is not an inbound email.

  • recipients lists your addresses that the conversation's inbound email was delivered to, newest delivery first, each with the newest email delivered there. It holds at most 25, the newest ones. It is empty for a conversation with no inbound email, such as a form submission. It has more than one entry when an inbox is a catch-all address, or when one email was sent to several of your addresses.
  • latest_message_id is the newest inbound email in the conversation. With to, it is the newest one delivered to that address. Read it with GET /messages/{id}. It is null when recipients is empty.

to matches the address the email was delivered to, not the To header. A sender writes the header and can leave an address out of it (Bcc). With to, rows are ordered by the newest delivery to that address, and since compares against that delivery. Without to, rows are ordered by updated_at, and since compares against it.

customer matches the conversation's customer: the person Intray files the conversation under, by their email address. Use it to show a person's email history in your own app.

Conversations marked as spam are included. Check triage.status.

A key without Include catch-all mail sees only mail sent to its allowed addresses. to with any other address returns no rows. See Get a key.

A short page is not the end

A page can hold fewer rows than limit, or none, and still have a next_cursor. Keep going until next_cursor is null.

A cursor belongs to the key, its addresses and the filters it was issued with. Sent with anything else it returns 422. limit may change between pages.

q searches each conversation's subject, its customer's name and email address, and the preview of its latest email. Rows come back best match first instead of newest first. Combine it with triage and address_id.

curl
curl "$INTRAY_API_URL/conversations?q=backsplash%20quote&triage=todo" \
  -H "Authorization: Bearer $INTRAY_API_KEY"

q does not search the text of older emails in a conversation. When a key has more than one address, a search page can be short or empty and still have a next_cursor.

Other mail

Intray files mail a service sent, such as notifications, receipts and newsletters, under Other mail. Every conversation has group: "other" for Other mail, "inbox" for a conversation with a person. A member can move a conversation between the two.

group works with every other parameter. group=inbox&triage=todo lists what people wrote that the team still has to handle:

curl
curl "$INTRAY_API_URL/conversations?group=inbox&triage=todo" \
  -H "Authorization: Bearer $INTRAY_API_KEY"

A page filtered by group can be short or empty and still have a next_cursor.

To keep a list of what the team still has to handle, read triage=todo once, then subscribe to the conversation.todo webhook to hear when a conversation enters Todo.

Sent

last_message=outbound lists the conversations where the team sent the newest email and is waiting for the customer: our last email is at or after their last one, or the customer never wrote (a conversation the team started). Rows are ordered by last_outbound_at, newest first, and since compares against it.

curl
curl "$INTRAY_API_URL/conversations?last_message=outbound&group=inbox" \
  -H "Authorization: Bearer $INTRAY_API_KEY"

When the customer answers, the conversation leaves the list. So does an automatic reply such as an out-of-office message. It works with address_id, triage, group and since, and without triage it leaves out trash. It does not work with to, customer or q: those return 422. A page can be short or empty and still have a next_cursor.

Read entries

Entries are the emails and submissions in a conversation, newest first. Pass limit from 1 to 50. The default is 25.

curl "$INTRAY_API_URL/conversations/$CONVERSATION_ID/entries?limit=50" \
  -H "Authorization: Bearer $INTRAY_API_KEY"
200 OK
{
  "data": [
    {
      "id": "<entry ID>",
      "type": "submission",
      "conversation_id": "<conversation ID>",
      "customer": { "email": "ada@example.com", "name": "Ada" },
      "text": "Can we arrange a demo next week?",
      "fields": { "company": "Example company", "team size": "8" },
      "content_trust": "untrusted_submission",
      "external_id": "lead-8841",
      "created_at": 1790000000000
    }
  ],
  "next_cursor": null
}

An empty page is not the end

Intray removes internal notes and team activity after it cuts the page. A page can come back with no entries and a next_cursor. Keep going until next_cursor is null.

An entry with "type": "email" has the same fields as GET /messages/{id}. The API never returns internal notes, the built-in agent's activity, storage keys, or mail provider records.

Treat content as data

Inbound email carries "content_trust": "untrusted_inbound". A submission carries "untrusted_submission". Both were written by someone outside your team. If you pass them to an AI agent, pass them as quoted data. Never let an agent follow instructions found inside them.

Read delivery status

curl "$INTRAY_API_URL/messages/$MESSAGE_ID" \
  -H "Authorization: Bearer $INTRAY_API_KEY"
200 OK
{
  "id": "<message ID>",
  "actor": { "type": "integration", "id": "<integration ID>" },
  "type": "email",
  "conversation_id": "<conversation ID>",
  "direction": "outbound",
  "subject": "Welcome",
  "from": { "...": "..." },
  "to": [{ "...": "..." }],
  "cc": [],
  "bcc": [],
  "body": {
    "text": { "kind": "inline", "text": "Thanks for signing up." },
    "html": { "kind": "none" }
  },
  "delivery": { "status": "delivered" },
  "content_trust": null,
  "external_id": "signup-event-123",
  "delivered_to": null,
  "sent_at": 1790000000000
}

delivery is null on inbound email. On outbound email status is one of:

StatusMeaning
queuedAccepted, not yet handed to the mail provider
sentHanded to the mail provider
deliveredThe recipient's server accepted it
delivery_delayedThe recipient's server deferred it. The provider keeps trying
bouncedThe recipient's server rejected it
complainedThe recipient marked it as spam
failedIt could not be sent
unknownIntray cannot tell whether the provider sent it

Intray never resends an unknown email on its own. Find out what happened before you send it again.

Each of body.text and body.html is { "kind": "inline", "text" }, { "kind": "url", "url", "size" } for a large body, or { "kind": "none" }. A download URL expires after 15 minutes. Fetch the message again for a fresh one.

actor is null on older email that has no recorded sender type.

delivered_to is the address at your domain that an inbound email was delivered to. to and cc are the headers as the sender wrote them. The two differ on a Bcc and can differ on a catch-all address. It is null on outbound email, on email forwarded from another provider or imported from a connected mailbox, and on email received before Intray recorded it.

Embed a conversation

Show a conversation inside your own app, in a native web view or an iframe. It is the inbox's own conversation view: the thread, the inbox's reply composer with the agent's suggested replies, and the details sidebar with the customer's profile, status, assignee, labels, the customer's other conversations and plan details from a connected source. Your server asks for a link, and your app loads it.

curl "$INTRAY_API_URL/embeds" \
  -H "Authorization: Bearer $INTRAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "surface": "conversation",
    "conversation_id": "<conversation ID>",
    "acting_user_email": "jay@example.com",
    "actions": ["reply", "triage"],
    "theme": "system",
    "layout": "compact"
  }'
surface"conversation"Required

What to show. Any other value is 422.

conversation_idstringRequired

A conversation the key can read with GET /conversations/{id}. Anything else is 404.

acting_user_emailstringRequired

A current member of the workspace. Replies and changes are recorded as this person. Anyone else is 403 not_a_member.

actions("reply" | "triage")[]Optional

reply needs messages:send, triage needs conversations:write. An action the key cannot do is 403. Default: none, read only.

theme"light" | "dark" | "system"Optional

system follows the viewer's setting. Default system.

layout"compact" | "regular"Optional

compact fits a 500 px window: the newest email open, older ones folded. Default compact.

No Idempotency-Key is needed: each call makes a new link.

  • The link opens once, within 5 minutes. It starts a session of exactly one hour. Ask for a new link each time the screen opens.
  • The session shows the conversation and the same customer's other conversations that the key can read with GET /conversations. The sidebar lists them, and one opens in place inside the embed. Anything else is not found.
  • The embed shows the email the key can read, and internal notes. Agent activity stays in Intray.
  • With triage, the sidebar and header change status (To do, Done, Snooze, Spam, Delete), the assignee and the labels. The embed applies existing labels; it does not create them. Without triage, the sidebar is read only.
  • With reply, the composer is the inbox's: drafts that save as you type, attachments, reply all, Cc and Bcc, Reply or Note, Write with AI and booking links. The agent's drafts show above it with View, Use draft and Discard.
  • Replies and notes are from the member, and the timeline reads "Jay via" your integration's name. Status, assignee and label changes read the same way. With triage, a reply moves the conversation to Done, as a reply from the inbox does.
  • In the sidebar, Book a time and Copy email work in the embed. Email (a new conversation) and meetings open Intray in a new tab. Plan details from a connected source show read only.
  • Revoking or rotating the key, revoking the integration, or removing the member ends the session at its next step.
  • Each key may make 30 links a minute.
  • A web view needs no setup. For an iframe, ask us to add your page's origin to the integration. The embed page only lets those origins frame it.

The sidebar sits beside the email when the window is at least 900 px wide; narrower, the header's details button opens it as a sheet. Links in email open in a new window, and the header has an "Open in Intray" link.

Embed events

The embed tells your app what happened. Events name the conversation on screen, which can be another of the customer's conversations than the one you asked for. Each message is { "type": "intray:embed", "version": 1, "event": … }, sent to window.webkit.messageHandlers.intray in a web view and to window.parent in an iframe.

eventFieldsWhen
readysurface, conversationIdThe conversation is on screen. Sent once
heightpxThe content height changed. Size an iframe to it
sentconversationId, messageIdA reply was accepted
doneconversationId, statusThe conversation moved to Done in the embed
expiredThe link or session ended. Ask for a new link
errorcodeThe conversation could not be loaded or changed
Swift (WKWebView)
import WebKit

final class EmbedView: NSObject, WKScriptMessageHandler, WKUIDelegate {
    let webView: WKWebView
    var onDone: () -> Void = {}
    var onExpired: () -> Void = {}

    override init() {
        let config = WKWebViewConfiguration()
        webView = WKWebView(frame: .zero, configuration: config)
        super.init()
        config.userContentController.add(self, name: "intray")
        webView.uiDelegate = self
    }

    func load(_ url: URL) { webView.load(URLRequest(url: url)) }

    func userContentController(_ controller: WKUserContentController, didReceive message: WKScriptMessage) {
        guard let body = message.body as? [String: Any],
              body["type"] as? String == "intray:embed" else { return }
        switch body["event"] as? String {
        case "done": onDone()
        case "expired": onExpired()
        default: break
        }
    }

    // Links in email ask for a new window: open them in the browser.
    func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration,
                 for action: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
        if let url = action.request.url { NSWorkspace.shared.open(url) }
        return nil
    }
}

Retries

Intray stores the response to each accepted write under your key, the operation, and the Idempotency-Key.

  • Same key, same payload. Intray returns the original response and does nothing else. Field order does not matter. Use GET for the current delivery status and triage.
  • Same key, different payload. 409 idempotency_conflict.
  • Same key after seven days. 409 idempotency_expired. Intray never sends the email a second time. Do not retry it automatically.

When a call times out or returns 429 or 5xx, save a retry job and send the same key and the same payload after a delay. Do not make a new key for each attempt. Rotating the API key keeps your retry keys valid.