Skip to content
AI Inbx
Esc
↑↓navigate↵open⌘Jpreview

List threads

Lists conversations, most recently active first. Every word of query must appear in the subject, the mailbox or a participant’s address, literally and in any order; mailbox narrows to one address.

GET/threads
Authorization
AuthorizationBearer token (API key) · headerrequired

Pass an AI Inbx API key as a Bearer token.

Query parameters
limitinteger

Maximum number of resources to return.

min 1 · max 100 · default: 40
cursorstring

Opaque cursor from the previous page.

min length 1
spacestring

Only resources in this space. Pass none for resources that belong to the workspace itself (space_id: null), or omit for the workspace and all its spaces.

matches ^(?:none|spc_[0-9a-f]{32})$
querystring

Words to find in the subject, mailbox or participants. Every word must match.

max length 320
mailboxstring<email>

Filter by mailbox address.

Header parameters
AIInbx-Workspacestring

Workspace id from GET /workspaces, for an OAuth token that reaches several.

min length 1
Responses
200

Success.

dataobject[]required
Show properties
Array of object
idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
space_idstring | nullrequired

Which space a resource is in. Null is the workspace itself — what every resource of a workspace that has no spaces says.

Show properties
Any of:
string
string
null
null
subjectstringrequired
mailboxstring<email>required
matches ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
participantsstring<email>[]required
message_countintegerrequired
min 0 · max 9007199254740991
last_message_atstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
forward_ofstring | nullrequired

The thread this one was forwarded from, when a forward opened it.

Show properties
Any of:
string
string
null
null
messagesobject[]
Show properties
Array of object
idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
thread_idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
space_idstring | nullrequired

Which space a resource is in. Null is the workspace itself — what every resource of a workspace that has no spaces says.

Show properties
Any of:
string
string
null
null
directionstringrequired
Allowed:inboundoutbound
statusstringrequired
Allowed:draftscheduledcanceleddiscardedqueuedsendingsentdeliveredbouncedcomplainedfailedreceived
fromobjectrequired
Show properties
namestring | null
Show properties
Any of:
string
string
null
null
addressstring<email>required
matches ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
tostring<email>[]required
ccstring<email>[]required
bccstring<email>[]required
reply_tostring<email>[]required
subjectstringrequired
snippetstringrequired
htmlstring | nullrequired
Show properties
Any of:
string
string
null
null
textstring | nullrequired
Show properties
Any of:
string
string
null
null
categorystring | nullrequired
Show properties
Any of:
string
string
null
null
verdictsobject | nullrequired
Show properties
Any of:
object
spamstring | nullrequired

PASS, FAIL, GRAY or PROCESSING_FAILED. Null when this check was not reported.

Show properties
Any of:
string
string
null
null
spfstring | nullrequired

PASS, FAIL, GRAY or PROCESSING_FAILED. Null when this check was not reported.

Show properties
Any of:
string
string
null
null
dkimstring | nullrequired

PASS, FAIL, GRAY or PROCESSING_FAILED. Null when this check was not reported.

Show properties
Any of:
string
string
null
null
dmarcstring | nullrequired

PASS, FAIL, GRAY or PROCESSING_FAILED. Null when this check was not reported.

Show properties
Any of:
string
string
null
null
null
null
suppression_keystring | nullrequired
Show properties
Any of:
string
string
null
null
message_idstringrequired

The RFC Message-ID, without angle brackets.

in_reply_tostring | nullrequired

The Message-ID of the message this one answers, without angle brackets. Null when it answers none.

Show properties
Any of:
string
string
null
null
idempotency_keystring | nullrequired
Show properties
Any of:
string
string
null
null
created_atstring<date-time>required

When it took its place in its thread. A draft's moves to when it is sent — draft.drafted_at keeps when it was written.

matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
scheduled_atstring<date-time> | nullrequired
Show properties
Any of:
string<date-time>
string<date-time>
null
null
sent_atstring<date-time> | nullrequired
Show properties
Any of:
string<date-time>
string<date-time>
null
null
draftobject | nullrequired
Show properties
Any of:
object
drafted_atstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
edited_atstring<date-time> | nullrequired

When its content last changed before it was sent. Null when it went as written.

Show properties
Any of:
string<date-time>
string<date-time>
null
null
review_urlstring<uri> | nullrequired

Where a person reviews, edits and sends it in the console.

Show properties
Any of:
string<uri>
string<uri>
null
null
null
null
attachmentsobject[]required
Show properties
Array of object
idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
filenamestringrequired
content_typestringrequired
sizeintegerrequired
min 0 · max 9007199254740991
cidstring | nullrequired
Show properties
Any of:
string
string
null
null
download_urlstring<uri> | nullrequired

Signed URL for the original bytes, good until expires_at. Opens without the API key, so treat it as a secret — and do not send the key to it: storage answers a request that carries an Authorization header with 400. To keep a reference, store the attachment id and call GET /attachments/{id}. Null when the bytes are gone.

Show properties
Any of:
string<uri>
string<uri>
null
null
expires_atstring<date-time> | nullrequired

When download_url and preparation.content_url stop working — an hour after the response. Read the email again, or call the download endpoint with the attachment ID, for fresh ones.

Show properties
Any of:
string<date-time>
string<date-time>
null
null
preparationobject | nullrequired
Show properties
Any of:
object
statusstringrequired
Allowed:readypartialunsupportedfailed
formatstring | nullrequired
Show properties
Any of:
string
string
null
null
pagesinteger | nullrequired
Show properties
Any of:
integer
integer
null
null
warningsstring[]required
content_urlstring<uri> | nullrequired

Signed URL for the prepared text, good until the attachment's expires_at. Opens without the API key — and only without it: storage answers a request that carries an Authorization header with 400. Null when there is no prepared text.

Show properties
Any of:
string<uri>
string<uri>
null
null
textstring | null
Show properties
Any of:
string
string
null
null
null
null
stripped_textstring | nullrequired

What this message says: typed text only, quoted conversation and signature removed. A signature the thread has not seen from this sender stays — it is where the name and role are.

Show properties
Any of:
string
string
null
null
stripped_htmlstring | nullrequired

The HTML part with the same cut as stripped_text: quoted conversation and repeated signature removed, an answer typed into the quote kept under the line it answers. Null when the message has no HTML part or its markup could not be matched to the cut.

Show properties
Any of:
string
string
null
null
segmentsobject[]required
Show properties
Array of object
kindstringrequired
Allowed:writtenquotedsignature
textstringrequired
referencesstring[]required

The Message-IDs of the conversation so far, oldest first, without angle brackets.

headersobject[]required
Show properties
Array of object
namestringrequired
valuestringrequired
eventsobject[]required
Show properties
Array of object
idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
typestringrequired
Allowed:draftededitedscheduledcanceleddiscardedqueuedreplayedsentdelivereddeferredbouncedcomplainedfailed
atstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
recipientstring<email> | nullrequired
Show properties
Any of:
string<email>
string<email>
null
null
detailstring | nullrequired
Show properties
Any of:
string
string
null
null
engagementsobject[]required
Show properties
Array of object
kindstringrequired
Allowed:openclick
atstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
urlstring<uri> | nullrequired
Show properties
Any of:
string<uri>
string<uri>
null
null
user_agentstring | nullrequired
Show properties
Any of:
string
string
null
null
botbooleanrequired

True when a proxy, security scanner or script made the hit rather than the recipient.

bot_reasonstring | nullrequired

Why: privacy_proxy is Apple Mail Privacy Protection fetching on arrival, script an HTTP library, known_bot a scanner or link expander that names itself, stale_browser a browser build nobody runs any more, too_fast within seconds of delivery, sooner than a person could act. Null when bot is false. More reasons may be added; treat one you do not know as a bot.

Show properties
Any of:
string
string
null
null
messages_next_cursorstring | null
Show properties
Any of:
string
string
null
null
next_cursorstring | nullrequired
Show properties
Any of:
string
string
null
null
400

The request is invalid.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
401

The API key is missing or invalid.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
402

The workspace has no plan (plan_required), or its plan's allowance is used up (allowance_reached).

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
403

The API key or token does not have the required scope, or the token is connected as an inbox and the operation is not one an inbox may use.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
404

The requested resource does not exist.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
409

The request conflicts with the resource's current state.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
413

The request body or attachments are too large.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
415

The request body is not JSON.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
422

The request body failed validation.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
429

The organisation's request budget is spent (too_many_requests), or an upstream mail provider is throttling (rate_limited).

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
500

An internal error occurred.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
502

An upstream mail provider failed.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
503

The service is temporarily unavailable.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
Request
import AIInbx from "aiinbx"

const aiinbx = new AIInbx()

for await (const thread of aiinbx.threads.list()) {
  console.log(thread)
}
Response
{
  "data": [
    {
      "id": "string",
      "space_id": "string",
      "subject": "string",
      "mailbox": "user@example.com",
      "participants": [
        "user@example.com"
      ],
      "message_count": 0,
      "last_message_at": "2019-08-24T14:15:22Z",
      "forward_of": "string",
      "messages": [
        {
          "id": "string",
          "thread_id": "string",
          "space_id": "string",
          "direction": "inbound",
          "status": "draft",
          "from": {
            "name": "string",
            "address": "user@example.com"
          },
          "to": [
            "user@example.com"
          ],
          "cc": [
            "user@example.com"
          ],
          "bcc": [
            "user@example.com"
          ],
          "reply_to": [
            "user@example.com"
          ],
          "subject": "string",
          "snippet": "string",
          "html": "string",
          "text": "string",
          "category": "human",
          "verdicts": {
            "spam": "string",
            "spf": "string",
            "dkim": "string",
            "dmarc": "string"
          },
          "suppression_key": "string",
          "message_id": "string",
          "in_reply_to": "string",
          "idempotency_key": "string",
          "created_at": "2019-08-24T14:15:22Z",
          "scheduled_at": "2019-08-24T14:15:22Z",
          "sent_at": "2019-08-24T14:15:22Z",
          "draft": {
            "drafted_at": "2019-08-24T14:15:22Z",
            "edited_at": "2019-08-24T14:15:22Z",
            "review_url": "http://example.com"
          },
          "attachments": [
            {
              "id": "string",
              "filename": "string",
              "content_type": "string",
              "size": 0,
              "cid": "string",
              "download_url": "http://example.com",
              "expires_at": "2019-08-24T14:15:22Z",
              "preparation": {
                "status": "ready",
                "format": "markdown",
                "pages": -9007199254740991,
                "warnings": [
                  "string"
                ],
                "content_url": "http://example.com",
                "text": "string"
              }
            }
          ],
          "stripped_text": "string",
          "stripped_html": "string",
          "segments": [
            {
              "kind": "written",
              "text": "string"
            }
          ],
          "references": [
            "string"
          ],
          "headers": [
            {
              "name": "string",
              "value": "string"
            }
          ],
          "events": [
            {
              "id": "string",
              "type": "drafted",
              "at": "2019-08-24T14:15:22Z",
              "recipient": "user@example.com",
              "detail": "string"
            }
          ],
          "engagements": [
            {
              "kind": "open",
              "at": "2019-08-24T14:15:22Z",
              "url": "http://example.com",
              "user_agent": "string",
              "bot": true,
              "bot_reason": "privacy_proxy"
            }
          ]
        }
      ],
      "messages_next_cursor": "string"
    }
  ],
  "next_cursor": "string"
}