Threads, messages, raw and HTML bodies, attachments and their extracted text.
List threads
GET/v1/inboxes/{inboxId}/threads
Access any: any API key, or a console session.
The inbox's threads, newest activity first. Filter by read state, or search the subject and participants. Trashed threads are left out.
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.inboxes.threads.list in TypeScript, client.inboxes.threads.list in Python, the inboxes_threads_list tool and doorman inboxes threads list on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
inboxIdstring, in pathrequiredThe inbox. Example:
inb_01jc4q7w9k2m5n8p3r6t1v4x7z.isRead"true" | "false", in queryoptionalOnly read or only unread threads.
qstring, in queryoptionalKeep the threads whose subject or a participant address contains this text, case-insensitively.
labelstring, in queryoptionalOnly threads containing this exact, case-sensitive label. Example:
needs-review.limitinteger, in queryoptionalPage size, 1 to 100. Defaults to 50.
offsetinteger, in queryoptionalRows to skip. Defaults to 0.
Answers 200: A page of threads.
Response 200: ThreadPage
A page of an inbox's threads, newest activity first. Trashed threads are left out.
dataThread[]requiredlimitintegerrequiredThe page size that was applied.
offsetintegerrequiredThe offset that was applied.
totalintegerrequiredHow many threads match, across every page.
Errors
| Status | Error | Meaning |
|---|---|---|
| 400 | validation_error | A field is missing or invalid; the message names it. |
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
curl -s "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/threads" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/threads", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/threads",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()List threads a person has or has not seen
GET/v1/inboxes/{inboxId}/threads/by-seen
Access session: a console session only; an API key gets 403 session_required.
The inbox's threads, newest activity first, kept by a person's own mark: those somebody looked at in the console since mail last arrived in them, or those nobody has. It is the console's list of what is new to a person, and says nothing about isRead, which agents poll. Trashed threads are left out.
OAuth: not available to delegated app tokens.
Also available as client.inboxes.threads.listBySeen in TypeScript and client.inboxes.threads.list_by_seen in Python.
Organizations: a member's console session needs mail:read. See Roles and permissions.
Parameters
inboxIdstring, in pathrequiredThe inbox. Example:
inb_01jc4q7w9k2m5n8p3r6t1v4x7z.isSeen"true" | "false", in queryrequiredfalsefor the threads nobody has looked at,truefor the others.qstring, in queryoptionalKeep the threads whose subject or a participant address contains this text, case-insensitively.
labelstring, in queryoptionalOnly threads containing this exact, case-sensitive label. Example:
needs-review.limitinteger, in queryoptionalPage size, 1 to 100. Defaults to 50.
offsetinteger, in queryoptionalRows to skip. Defaults to 0.
Answers 200: A page of threads.
Response 200: ThreadPage
A page of an inbox's threads, newest activity first. Trashed threads are left out.
dataThread[]requiredlimitintegerrequiredThe page size that was applied.
offsetintegerrequiredThe offset that was applied.
totalintegerrequiredHow many threads match, across every page.
Errors
| Status | Error | Meaning |
|---|---|---|
| 400 | validation_error | A field is missing or invalid; the message names it. |
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | session_required | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
curl -s "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/threads/by-seen" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/threads/by-seen", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/threads/by-seen",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()Read a thread
GET/v1/threads/{threadId}
Access any: any API key, or a console session.
One thread's summary. Its messages are at /v1/threads/{threadId}/messages.
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.threads.get in TypeScript, client.threads.get in Python, the threads_get tool and doorman threads get on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
threadIdstring, in pathrequiredThe thread. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0m.
Answers 200: The thread.
Response 200: Thread
A conversation: the messages that reply to each other, or share a subject and a participant.
idstringrequiredA thread identifier. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0minboxIdstringrequiredAn inbox identifier. Example:
inb_01jc4q7w9k2m5n8p3r6t1v4x7zsubjectstringrequiredThe subject of the first message. Example:
Invoice 2847participantsstring[]requiredEvery address seen in the thread other than the inbox's own, sorted. Example:
["sam@example.com"]messageCountintegerrequiredisReadbooleanrequiredFalse until the thread is marked read or a reply is sent.
isSeenbooleanoptionalWhether a person has looked at the thread in the console since mail last arrived in it. It is the console's own mark and says nothing about
isRead, which is what an agent polls: a person looking at a thread does not mark it read. Older deployments omit it.metadataMetadataoptionallabelsThreadLabelsoptionalriskLevel"low" | "medium" | "high" | "critical" | nulloptionalThe highest risk level among the thread's inbound messages that the owner has not marked safe; null when none was assessed. Older deployments omit it.
firstMessageAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000ZlastMessageAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000ZlastMessageIdstring | nullrequiredcreatedAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000Z
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
{
"id": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
"inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
"subject": "Invoice 2847",
"participants": [
"sam@example.com"
],
"messageCount": 1,
"isRead": false,
"metadata": {},
"labels": [],
"riskLevel": "low",
"firstMessageAt": "2026-11-05T10:05:00.000Z",
"lastMessageAt": "2026-11-05T10:05:00.000Z",
"lastMessageId": "msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
"createdAt": "2026-11-05T10:05:00.000Z"
}curl -s "https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()Update a thread
PATCH/v1/threads/{threadId}
Access any: any API key, or a console session.
Sets read state, metadata or labels. Omitted fields stay unchanged; metadata and labels replace the whole value, with {} or [] clearing it. Sending a reply marks the thread read as well. Actual changes emit thread.updated.
OAuth: allowed with all of mail:write, mail:read. App permissions apply in addition to account and resource checks.
Also available as client.threads.update in TypeScript, client.threads.update in Python, the threads_update tool and doorman threads update on the command line.
Organizations: a member's console session needs mail:write and mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
threadIdstring, in pathrequiredThe thread. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0m.
Request body (application/json): UpdateThread
Changes to the thread's read state, metadata or labels. Omitted fields stay as they are; metadata and labels replace the entire value.
isReadbooleanoptionalmetadataMetadataoptionallabelsThreadLabelsoptional
Answers 200: The thread as it is now.
Response 200: Thread
A conversation: the messages that reply to each other, or share a subject and a participant.
idstringrequiredA thread identifier. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0minboxIdstringrequiredAn inbox identifier. Example:
inb_01jc4q7w9k2m5n8p3r6t1v4x7zsubjectstringrequiredThe subject of the first message. Example:
Invoice 2847participantsstring[]requiredEvery address seen in the thread other than the inbox's own, sorted. Example:
["sam@example.com"]messageCountintegerrequiredisReadbooleanrequiredFalse until the thread is marked read or a reply is sent.
isSeenbooleanoptionalWhether a person has looked at the thread in the console since mail last arrived in it. It is the console's own mark and says nothing about
isRead, which is what an agent polls: a person looking at a thread does not mark it read. Older deployments omit it.metadataMetadataoptionallabelsThreadLabelsoptionalriskLevel"low" | "medium" | "high" | "critical" | nulloptionalThe highest risk level among the thread's inbound messages that the owner has not marked safe; null when none was assessed. Older deployments omit it.
firstMessageAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000ZlastMessageAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000ZlastMessageIdstring | nullrequiredcreatedAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000Z
Errors
| Status | Error | Meaning |
|---|---|---|
| 400 | validation_error | A field is missing or invalid; the message names it. |
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
{
"id": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
"inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
"subject": "Invoice 2847",
"participants": [
"sam@example.com"
],
"messageCount": 1,
"isRead": false,
"metadata": {},
"labels": [],
"riskLevel": "low",
"firstMessageAt": "2026-11-05T10:05:00.000Z",
"lastMessageAt": "2026-11-05T10:05:00.000Z",
"lastMessageId": "msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
"createdAt": "2026-11-05T10:05:00.000Z"
}curl -s -X PATCH "https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m" \
-H "authorization: Bearer $DOORMAN_API_KEY" \
-H "content-type: application/json" \
-d '{
"isRead": true
}'const response = await fetch("https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m", {
method: "PATCH",
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
"content-type": "application/json",
},
redirect: "manual", credentials: "omit",
body: JSON.stringify({
"isRead": true
}),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.patch(
"https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
json={
"isRead": True,
},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()Trash a thread
DELETE/v1/threads/{threadId}
Access any: any API key, or a console session.
The thread and its messages leave every list and read, a reply to it answers 404 thread_not_found, and a later message in the same conversation starts a new thread. Where the deployment erases, it is erased 30 days later.
OAuth: allowed with all of mail:write, mail:read. App permissions apply in addition to account and resource checks.
Also available as client.threads.trash in TypeScript, client.threads.trash in Python, the threads_trash tool and doorman threads trash on the command line.
Organizations: a member's console session needs mail:write and mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
threadIdstring, in pathrequiredThe thread. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0m.
Answers 204: Trashed.
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
curl -s -X DELETE "https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m", {
method: "DELETE",
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
// 204: nothing to read.import os
import requests
response = requests.delete(
"https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
# 204: nothing to read.Restore a trashed thread
POST/v1/threads/{threadId}/restore
Access session: a console session only; an API key gets 403 session_required.
Takes a thread back out of the trash: it and its messages return to every list and read, and thread.updated says so. A thread that is not in the trash is answered as it is. Mail that was held, discarded or still waits for a scan is in the trash to keep it from agents and is not restored this way (404): only releasing held mail delivers it. A message that arrived in the same conversation while the thread was trashed started a thread of its own, and stays there.
OAuth: not available to delegated app tokens.
Also available as client.threads.restore in TypeScript and client.threads.restore in Python.
Organizations: a member's console session needs mail:write and mail:read. See Roles and permissions.
Parameters
threadIdstring, in pathrequiredThe thread. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0m.
Answers 200: The thread, out of the trash.
Response 200: Thread
A conversation: the messages that reply to each other, or share a subject and a participant.
idstringrequiredA thread identifier. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0minboxIdstringrequiredAn inbox identifier. Example:
inb_01jc4q7w9k2m5n8p3r6t1v4x7zsubjectstringrequiredThe subject of the first message. Example:
Invoice 2847participantsstring[]requiredEvery address seen in the thread other than the inbox's own, sorted. Example:
["sam@example.com"]messageCountintegerrequiredisReadbooleanrequiredFalse until the thread is marked read or a reply is sent.
isSeenbooleanoptionalWhether a person has looked at the thread in the console since mail last arrived in it. It is the console's own mark and says nothing about
isRead, which is what an agent polls: a person looking at a thread does not mark it read. Older deployments omit it.metadataMetadataoptionallabelsThreadLabelsoptionalriskLevel"low" | "medium" | "high" | "critical" | nulloptionalThe highest risk level among the thread's inbound messages that the owner has not marked safe; null when none was assessed. Older deployments omit it.
firstMessageAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000ZlastMessageAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000ZlastMessageIdstring | nullrequiredcreatedAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000Z
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | session_required | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
{
"id": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
"inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
"subject": "Invoice 2847",
"participants": [
"sam@example.com"
],
"messageCount": 1,
"isRead": false,
"metadata": {},
"labels": [],
"riskLevel": "low",
"firstMessageAt": "2026-11-05T10:05:00.000Z",
"lastMessageAt": "2026-11-05T10:05:00.000Z",
"lastMessageId": "msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
"createdAt": "2026-11-05T10:05:00.000Z"
}curl -s -X POST "https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/restore" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/restore", {
method: "POST",
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.post(
"https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/restore",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()Mark a thread seen
PUT/v1/threads/{threadId}/seen
Access session: a console session only; an API key gets 403 session_required.
Records that a person looked at the thread in the console, or that they want it shown as new again. It moves isSeen and nothing else: isRead, which agents poll, stays as it is, and no event is emitted. Mail that arrives in the thread clears it.
OAuth: not available to delegated app tokens.
Also available as client.threads.seen in TypeScript and client.threads.seen in Python.
Organizations: a member's console session needs mail:read. See Roles and permissions.
Parameters
threadIdstring, in pathrequiredThe thread. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0m.
Request body (application/json): SetThreadSeen
Whether a person has looked at the thread: true once they opened it, false to show it as new again.
seenbooleanrequired
Answers 200: The thread as it is now.
Response 200: Thread
A conversation: the messages that reply to each other, or share a subject and a participant.
idstringrequiredA thread identifier. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0minboxIdstringrequiredAn inbox identifier. Example:
inb_01jc4q7w9k2m5n8p3r6t1v4x7zsubjectstringrequiredThe subject of the first message. Example:
Invoice 2847participantsstring[]requiredEvery address seen in the thread other than the inbox's own, sorted. Example:
["sam@example.com"]messageCountintegerrequiredisReadbooleanrequiredFalse until the thread is marked read or a reply is sent.
isSeenbooleanoptionalWhether a person has looked at the thread in the console since mail last arrived in it. It is the console's own mark and says nothing about
isRead, which is what an agent polls: a person looking at a thread does not mark it read. Older deployments omit it.metadataMetadataoptionallabelsThreadLabelsoptionalriskLevel"low" | "medium" | "high" | "critical" | nulloptionalThe highest risk level among the thread's inbound messages that the owner has not marked safe; null when none was assessed. Older deployments omit it.
firstMessageAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000ZlastMessageAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000ZlastMessageIdstring | nullrequiredcreatedAtstring (date-time)requiredExample:
2026-11-05T10:05:00.000Z
Errors
| Status | Error | Meaning |
|---|---|---|
| 400 | validation_error | A field is missing or invalid; the message names it. |
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | session_required | Account keys, developer apps, relying parties, installations, consent, approving a sign-in and the assistant require a console session. So does loosening the security policy, trusting a sender, releasing held mail, allowing a sign-in, letting agents sign in to new services alone or telling a service who owns an agent, unless the account allows its account keys to. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
{
"id": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
"inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
"subject": "Invoice 2847",
"participants": [
"sam@example.com"
],
"messageCount": 1,
"isRead": false,
"metadata": {},
"labels": [],
"riskLevel": "low",
"firstMessageAt": "2026-11-05T10:05:00.000Z",
"lastMessageAt": "2026-11-05T10:05:00.000Z",
"lastMessageId": "msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
"createdAt": "2026-11-05T10:05:00.000Z"
}curl -s -X PUT "https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/seen" \
-H "authorization: Bearer $DOORMAN_API_KEY" \
-H "content-type: application/json" \
-d '{
"seen": true
}'const response = await fetch("https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/seen", {
method: "PUT",
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
"content-type": "application/json",
},
redirect: "manual", credentials: "omit",
body: JSON.stringify({
"seen": true
}),
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.put(
"https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/seen",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
json={
"seen": True,
},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()Read a thread's messages
GET/v1/threads/{threadId}/messages
Access any: any API key, or a console session.
The thread and its messages in order, oldest first, each with its text, classification and attachments.
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.threads.messages in TypeScript, client.threads.messages in Python, the threads_messages tool and doorman threads messages on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
threadIdstring, in pathrequiredThe thread. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0m.
Answers 200: The thread and its messages.
Response 200: ThreadMessages
A thread with its messages in order.
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
curl -s "https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/messages" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/messages", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/threads/thr_01jc5a1b2c3d4e5f6g7h8j9k0m/messages",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()List messages
GET/v1/inboxes/{inboxId}/messages
Access any: any API key, or a console session.
The inbox's messages across threads, newest first, inbound and outbound alike unless filtered. Messages in trashed threads are left out.
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.inboxes.messages.list in TypeScript, client.inboxes.messages.list in Python, the inboxes_messages_list tool and doorman inboxes messages list on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
inboxIdstring, in pathrequiredThe inbox. Example:
inb_01jc4q7w9k2m5n8p3r6t1v4x7z.direction"inbound" | "outbound", in queryoptionalOnly received or only sent messages.
limitinteger, in queryoptionalPage size, 1 to 100. Defaults to 50.
offsetinteger, in queryoptionalRows to skip. Defaults to 0.
Answers 200: A page of messages.
Response 200: MessageList
A page of an inbox's messages, newest first.
dataMessage[]requiredlimitintegerrequiredThe page size that was applied.
offsetintegerrequiredThe offset that was applied.
Errors
| Status | Error | Meaning |
|---|---|---|
| 400 | validation_error | A field is missing or invalid; the message names it. |
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
curl -s "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/messages" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/messages", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/messages",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()Read a message
GET/v1/messages/{messageId}
Access any: any API key, or a console session.
One message with its text, headers, classification and attachments.
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.messages.get in TypeScript, client.messages.get in Python, the messages_get tool and doorman messages get on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
messageIdstring, in pathrequiredThe message. Example:
msg_01jc5a6g7h8j9k0m1n2p3q4r5s.
Answers 200: The message.
Response 200: Message
One message, inbound or outbound, with its text, headers, classification and attachments.
idstringrequiredA message identifier. Example:
msg_01jc5a6g7h8j9k0m1n2p3q4r5sinboxIdstringrequiredAn inbox identifier. Example:
inb_01jc4q7w9k2m5n8p3r6t1v4x7zthreadIdstringrequiredA thread identifier. Example:
thr_01jc5a1b2c3d4e5f6g7h8j9k0mdirection"inbound" | "outbound"requiredrfcMessageIdstring | nullrequiredThe Message-ID header of inbound mail; null for mail this API sent. Example:
<a1b2c3@example.com>inReplyTostring | nullrequiredThe In-Reply-To header, when the message is a reply.
referencesstring[]requiredThe References chain, oldest first.
fromNamedAddressrequiredtoNamedAddress[]requiredccNamedAddress[]requiredbccNamedAddress[]requiredOnly outbound mail carries blind copies.
replyTostring | nullrequiredThe Reply-To address, when one was given.
deliveryRole"to" | "cc" | "bcc" | nullrequiredHow the inbox received the message: as a to, cc or bcc recipient. Null for outbound mail.
subjectstringrequiredExample:
Invoice 2847textstring | nullrequiredThe plain-text body, or text derived from the HTML when there was none.
hasHtmlbooleanrequiredWhether an HTML body is stored; read it at /v1/messages/{messageId}/html.
rawUrlstring | nullrequiredWhere to download the original message/rfc822; null for outbound mail.
sizeBytesintegerrequiredcategory"personal" | "automated" | "marketing" | "bounce" | "spam" | "malicious"requiredWhat kind of mail this is; ordinary outbound mail is personal and rule-generated mail is automated.
autoReplyablebooleanrequiredFalse for anything an agent should not answer on its own.
verdict"clean" | "unverified" | "suspicious" | nullrequiredFrom the authentication results; null for outbound mail.
spamScorenumber | nullrequiredHow likely the message is junk, from 0 to 1, when it was assessed; null otherwise.
authenticationAuthenticationResults | nullrequiredserviceMessageService | nulloptionalThe outside service the message came from, for the inbox's passport; null for any other mail and for outbound mail. Older deployments omit it.
riskRiskAssessment | nulloptionalDoorman's assessment of an inbound message (ADR-019). Null for outbound mail and for mail that was not assessed. Older deployments omit it.
redactionRedactionoptionalWhat the account's healthcare guardrails found in the message (ADR-027), and whether
subject,textand the attachments'parsedTextcarry placeholders in place of it. Absent where no guardrail applies.occurredAtstring (date-time)requiredWhen the message arrived or was sent. Example:
2026-11-05T10:05:00.000ZattachmentsAttachment[]required
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
{
"id": "msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
"inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
"threadId": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
"direction": "inbound",
"rfcMessageId": "<a1b2c3@example.com>",
"inReplyTo": null,
"references": [],
"from": {
"address": "sam@example.com",
"name": "Sam Rivera"
},
"to": [
{
"address": "concierge@doorman.example",
"name": null
}
],
"cc": [],
"bcc": [],
"replyTo": null,
"deliveryRole": "to",
"subject": "Invoice 2847",
"text": "Hi, invoice 2847 is attached.",
"hasHtml": true,
"rawUrl": "https://api.doorman.example/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/raw",
"sizeBytes": 48120,
"category": "personal",
"autoReplyable": true,
"verdict": "clean",
"spamScore": 0.02,
"authentication": {
"spf": "pass",
"dkim": "pass",
"dmarc": "pass"
},
"risk": {
"score": 6,
"level": "low",
"labels": [],
"reasons": [],
"sender": {
"standing": "known",
"authenticated": true
},
"action": "delivered",
"analysis": "full",
"review": null
},
"occurredAt": "2026-11-05T10:05:00.000Z",
"attachments": [
{
"filename": "invoice.pdf",
"contentType": "application/pdf",
"sizeBytes": 45000,
"url": "https://api.doorman.example/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf",
"parsedText": "Invoice 2847. Line 3: Setup fee, billed twice. Total 1,480.",
"extractionMethod": "pdf"
}
]
}curl -s "https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()Download the original message
GET/v1/messages/{messageId}/raw
Access any: any API key, or a console session.
The message as it arrived, message/rfc822. Outbound messages have no raw copy and answer 404. One with a malicious attachment is served to a console session only (403 risk_blocked otherwise).
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.messages.raw in TypeScript, client.messages.raw in Python and doorman messages raw on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
messageIdstring, in pathrequiredThe message. Example:
msg_01jc5a6g7h8j9k0m1n2p3q4r5s.
Answers 200 as message/rfc822: The original message.
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | risk_blocked | The send or the download was refused; guard says why: reply when the thread holds a flagged message whose sender is not trusted, recipient when a recipient is not one the inbox knows, content when an attachment did not pass the check of its bytes (reasons lists what was found), guardrail when a healthcare guardrail found what may not be sent (entities lists the kinds). For reply and recipient a person can send from the console, mark the message safe or trust the sender. For content, a program or a file dressed as another kind is refused for every caller; a locked or damaged file, a script, or a document with macros, is refused for keys and app tokens only. A link that delivered harmful software when it was opened in isolation is refused for every caller. |
| 403 | guardrail_blocked | A healthcare guardrail keeps this content from keys and apps: the original message, its HTML body or an attachment's bytes carry what the account's guardrails redact, and bytes cannot be redacted. entities lists the kinds that were found, never the text. The message's text is available with the findings replaced; a person with phi:read reads the original in the console. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
curl -s "https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/raw" \
-H "authorization: Bearer $DOORMAN_API_KEY" \
-o downloaded.binconst response = await fetch("https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/raw", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const bytes = await response.arrayBuffer();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/raw",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
data = response.contentRead the HTML body
GET/v1/messages/{messageId}/html
Access any: any API key, or a console session.
The stored HTML body, served as text/html under cache-control: private, no-store, x-content-type-options: nosniff and a content security policy that allows images and inline styles only, under sandbox. 404 when the message has no HTML body.
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.messages.html in TypeScript, client.messages.html in Python and doorman messages html on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
messageIdstring, in pathrequiredThe message. Example:
msg_01jc5a6g7h8j9k0m1n2p3q4r5s.
Answers 200 as text/html: The HTML body.
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | guardrail_blocked | A healthcare guardrail keeps this content from keys and apps: the original message, its HTML body or an attachment's bytes carry what the account's guardrails redact, and bytes cannot be redacted. entities lists the kinds that were found, never the text. The message's text is available with the findings replaced; a person with phi:read reads the original in the console. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
curl -s "https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/html" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/html", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const text = await response.text();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/messages/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/html",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
text = response.textDownload an attachment
GET/v1/attachments/{messageId}/{filename}
Access any: any API key, or a console session.
The attachment's bytes, served with the attachment's own content type as a download. A malicious attachment is served to a console session only (403 risk_blocked otherwise).
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.attachments.download in TypeScript, client.attachments.download in Python and doorman attachments download on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
messageIdstring, in pathrequiredThe message. Example:
msg_01jc5a6g7h8j9k0m1n2p3q4r5s.filenamestring, in pathrequiredThe attachment's file name, as the message lists it. Example:
invoice.pdf.
Answers 200 as */*: The bytes, with the attachment's content type.
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | risk_blocked | The send or the download was refused; guard says why: reply when the thread holds a flagged message whose sender is not trusted, recipient when a recipient is not one the inbox knows, content when an attachment did not pass the check of its bytes (reasons lists what was found), guardrail when a healthcare guardrail found what may not be sent (entities lists the kinds). For reply and recipient a person can send from the console, mark the message safe or trust the sender. For content, a program or a file dressed as another kind is refused for every caller; a locked or damaged file, a script, or a document with macros, is refused for keys and app tokens only. A link that delivered harmful software when it was opened in isolation is refused for every caller. |
| 403 | guardrail_blocked | A healthcare guardrail keeps this content from keys and apps: the original message, its HTML body or an attachment's bytes carry what the account's guardrails redact, and bytes cannot be redacted. entities lists the kinds that were found, never the text. The message's text is available with the findings replaced; a person with phi:read reads the original in the console. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
curl -s "https://api.doorman.fyi/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf" \
-H "authorization: Bearer $DOORMAN_API_KEY" \
-o downloaded.binconst response = await fetch("https://api.doorman.fyi/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const bytes = await response.arrayBuffer();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
data = response.contentRead an attachment's text
GET/v1/attachments/{messageId}/{filename}/text
Access any: any API key, or a console session.
The extracted text and how it was obtained, or why it was not.
OAuth: allowed with all of mail:read. App permissions apply in addition to account and resource checks.
Also available as client.attachments.text in TypeScript, client.attachments.text in Python, the attachments_text tool and doorman attachments text on the command line.
Organizations: a member's console session needs mail:read. API keys and app tokens are not held to member permissions. See Roles and permissions.
Parameters
messageIdstring, in pathrequiredThe message. Example:
msg_01jc5a6g7h8j9k0m1n2p3q4r5s.filenamestring, in pathrequiredThe attachment's file name, as the message lists it. Example:
invoice.pdf.
Answers 200: The text.
Response 200: AttachmentText
The extracted text of an attachment and how it was obtained.
filenamestringrequiredcontentTypestringrequiredextractionMethod"text" | "csv" | "pdf" | "ocr" | "office" | "unsupported" | "skipped" | "skipped_too_large" | "unavailable" | "timeout" | "pdf_error" | "ocr_error" | "office_error" | "html_error"requiredtextstring | nullrequiredThe text, or null when nothing was extracted;
extractionMethodsays why.
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | unauthorized | The credential was missing, malformed, revoked or belongs to an inactive account. |
| 401 | session_invalid | The console session token could not be verified. |
| 401 | session_expired | The console session token has expired. |
| 401 | session_claims_missing | The session token does not carry a verified email address. |
| 403 | risk_blocked | The send or the download was refused; guard says why: reply when the thread holds a flagged message whose sender is not trusted, recipient when a recipient is not one the inbox knows, content when an attachment did not pass the check of its bytes (reasons lists what was found), guardrail when a healthcare guardrail found what may not be sent (entities lists the kinds). For reply and recipient a person can send from the console, mark the message safe or trust the sender. For content, a program or a file dressed as another kind is refused for every caller; a locked or damaged file, a script, or a document with macros, is refused for keys and app tokens only. A link that delivered harmful software when it was opened in isolation is refused for every caller. |
| 403 | insufficient_scope | The app's token lacks a required scope, or the operation cannot be delegated. |
| 403 | account_suspended | The account is suspended. |
| 403 | account_deleted | The account was deleted. |
| 403 | permission_denied | The signed-in member's role in the organization lacks a permission the operation needs; permission names it. An admin of the organization can do it, or change the member's role. |
| 403 | member_deactivated | The signed-in person's access to the organization was deactivated, or they were removed from it. It holds from their next request, whatever their session token says. An admin of the organization can let a deactivated member in again. |
| 404 | not_found | No such resource for this caller, or no such route. |
| 409 | account_mismatch | The request named another account in x-doorman-account than the one its credential acts for, as happens when the console's organization was switched in another tab. Reload and try again. |
| 500 | internal_error | Something went wrong on the server. |
{
"filename": "invoice.pdf",
"contentType": "application/pdf",
"extractionMethod": "pdf",
"text": "Invoice 2847. Total 1,480."
}curl -s "https://api.doorman.fyi/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf/text" \
-H "authorization: Bearer $DOORMAN_API_KEY"const response = await fetch("https://api.doorman.fyi/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf/text", {
headers: {
authorization: `Bearer ${process.env.DOORMAN_API_KEY}`,
},
redirect: "manual", credentials: "omit",
});
if (!response.ok) throw new Error(`The API answered ${response.status}.`);
const result = await response.json();import os
import requests
response = requests.get(
"https://api.doorman.fyi/v1/attachments/msg_01jc5a6g7h8j9k0m1n2p3q4r5s/invoice.pdf/text",
headers={"authorization": f"Bearer {os.environ['DOORMAN_API_KEY']}"},
allow_redirects=False, timeout=30,
)
response.raise_for_status()
result = response.json()
