Conversations
Bring the replies to your emails back into Outbound. Send an email with captureReplies: true and every reply to it is collected into a conversation that you can read and answer from the API or the dashboard. Replies still reach your own mailbox as well.
New to Conversations? The Conversations guide explains when conversations are created and how to sync them into your own system, and Show Inbound Conversations in Your Application walks through an inbox for your team, with a full example. This page is the method reference.
All examples assume you've set the API key in the constructor. For multi-tenant usage, pass { apiKey } as the last argument to any method. See Configuration.
How It Works
- An Outbound admin enables Conversations for your account and assigns you a reply domain, for example
reply.outbound.yourcompany.com. - You send with
captureReplies: trueonemail.send,email.bulk,templates.sendortemplates.bulkSend. The email carries a second Reply-To address on your reply domain. Your ownreplyTo(orfromEmailwhen you set none) stays first, so a reply goes to your mailbox and to Outbound. AddcreateThread: trueto open each conversation when the email is sent instead of when its first reply arrives. - Replies arrive as conversations. A conversation is one sent email plus every reply to it and every reply you send from Outbound. Each new message can also notify you through a webhook.
await outbound.email.send({
toEmail: 'riya@example.com',
fromEmail: 'admissions@yourcompany.com',
emailSubject: 'Your application',
htmlBody: '<p>Hi Riya, reply to this email with any questions.</p>',
captureReplies: true,
});
for await (const thread of outbound.conversations.listAllThreads({ needsReply: true })) {
console.log(`${thread.lead.email}: ${thread.lastSnippet}`);
}Test without a real recipient
Send with captureReplies: true to success@simulator.amazonses.com, then create a reply with sandbox.simulateReply(). Simulated conversations carry simulated: true.
Message Kinds
kind | Direction | Meaning |
|---|---|---|
original | outbound | The email that started the conversation |
reply | inbound | A reply written by a person |
auto_reply | inbound | An automatic reply, such as an out-of-office message |
bounce | inbound | A delivery failure notice sent to the reply address |
read_receipt | inbound | A read receipt |
staff_reply | outbound or inbound | A reply from your team: outbound when sent from Outbound, inbound when someone on your team replied all from their own mail app |
Who Sent a Message
participant says who wrote an inbound message:
participant | Meaning |
|---|---|
recipient | The person the email went to, or one of its CC or BCC recipients |
staff | Someone from your own team |
external | Anyone else, for example someone the email was forwarded to |
senderAuth says whether the sender's address can be trusted:
senderAuth | Meaning |
|---|---|
verified | The sender's domain authenticated the message (DMARC pass) |
unverified | The sender could not be verified, for example because their domain publishes no DMARC policy |
failed | Authentication failed. Treat the sender address with suspicion |
internal | Sent by Outbound |
Automated Messages
Conversations that contain only automated messages (auto replies, bounce notices and read receipts) are hidden from listThreads() by default and counted separately in summary() as automatedOnly. Pass includeAutomated: true to list them. Conversations opened at send with createThread: true are listed by default, even before anyone replies.
Opt-Out Replies
Every human reply (a message of kind reply) is checked for a request to stop, such as "please remove me from this list". Automatic replies, bounce notices, read receipts and replies from your own team are not checked. When a request is found, the message's optOut.detected is true, the conversation's optOutDetected is true, and optOut.action says what happened:
optOut.action | Meaning |
|---|---|
flagged | Detected and left for you to review |
suppressed | The sender was added to your suppression list |
already_suppressed | The sender was already on your suppression list |
With autoSuppressOptOuts turned on, a request to stop is acted on automatically when it is unambiguous ("unsubscribe", "stop emailing me", "remove me from your list", a reply of just "STOP", and the Hindi equivalents), comes from the recipient themselves, and senderAuth is verified. Looser phrases such as "remove my email", and every other request, are flagged for your team to review. Once a request is acted on, the conversation no longer needs a reply. When the sender is newly suppressed, an unsubscribe webhook also fires with unsubscribeSource: 'reply' and unsubscribeReason: 'reply'.
Get Settings
const { settings } = await outbound.conversations.getSettings();Response
{
settings: {
enabled: true,
autoSuppressOptOuts: false,
retentionDays: null,
captureConfigured: true,
receivingConfigured: true,
replyDomains: [
{ hostname: 'reply.outbound.yourcompany.com', isDefault: true, status: 'active' }
]
}
}| Field | Description |
|---|---|
enabled | An Outbound admin has enabled Conversations for your account. While this is true, any send with captureReplies: true captures replies |
autoSuppressOptOuts | Replies asking to stop are added to your suppression list automatically. See Opt-Out Replies |
retentionDays | Conversations are deleted this many days after their last message. null keeps them until you delete them |
captureConfigured | Reply capture is set up on the platform |
receivingConfigured | Receiving replies is set up on the platform |
replyDomains | Your reply domains. See List Reply Domains |
Possible Errors
| Error | Status | Cause |
|---|---|---|
AuthenticationError | 401 | Invalid or missing API key |
Update Settings
Pass only the fields you want to change.
const { settings } = await outbound.conversations.updateSettings({
autoSuppressOptOuts: true,
retentionDays: 365,
});Parameters
| Field | Type | Required | Description |
|---|---|---|---|
autoSuppressOptOuts | boolean | No | Add a recipient who replies asking to stop to your suppression list automatically. See Opt-Out Replies |
retentionDays | number | null | No | Delete a conversation once its last message is this many days old. A whole number from 30 to 3650, or null to keep conversations until you delete them |
Pass at least one field. Expired conversations are deleted once a day. Simulated conversations are always deleted 30 days after their last message, whatever retentionDays says.
Response
Same shape as Get Settings, with your changes applied.
Possible Errors
| Error | Status | Cause |
|---|---|---|
BadRequestError | 400 | No field given, a field has the wrong type, or retentionDays is not null or a whole number from 30 to 3650 |
ForbiddenError | 403 | An Outbound admin has not enabled Conversations for your account |
List Reply Domains
The reply domains assigned to your account. Only active domains can be used for sending.
const { replyDomains } = await outbound.conversations.listReplyDomains();
const usable = replyDomains.filter((d) => d.status === 'active');Response
{
replyDomains: [
{ hostname: 'reply.outbound.yourcompany.com', isDefault: true, status: 'active' },
{ hostname: 'reply.outbound.yourbrand.com', isDefault: false, status: 'pending_dns' }
]
}| Field | Description |
|---|---|
hostname | The domain. Pass it as replyDomain on a send to use it instead of your default |
isDefault | Used when a send sets captureReplies: true without a replyDomain |
status | active (ready to use), pending_dns (waiting for DNS records), verified (DNS verified, not yet active) or retired (no longer available for new sends) |
Possible Errors
| Error | Status | Cause |
|---|---|---|
AuthenticationError | 401 | Invalid or missing API key |
Get Summary
Counts for an inbox badge.
const { summary } = await outbound.conversations.summary();
// { open: 3, needsReply: 2, unread: 1, automatedOnly: 4, noReply: 1 }Response
| Field | Description |
|---|---|
open | Open conversations. Includes conversations opened at send with createThread: true, even when nobody has replied yet |
needsReply | Conversations waiting for your reply |
unread | Conversations with unread messages |
automatedOnly | Conversations that contain only automated messages. listThreads() hides these unless you pass includeAutomated: true |
noReply | Open conversations where the recipient has not replied yet |
Possible Errors
| Error | Status | Cause |
|---|---|---|
ForbiddenError | 403 | Conversations is not enabled for your account |
List Conversations
Most recent activity first by default. Pages are cursor based: pass the previous response's pagination.nextCursor as cursor to get the next page.
const page = await outbound.conversations.listThreads({ needsReply: true, limit: 25 });
if (page.pagination.nextCursor) {
const next = await outbound.conversations.listThreads({
needsReply: true,
limit: 25,
cursor: page.pagination.nextCursor,
});
}Parameters
Every filter is optional. Filters combine: a conversation must match all of them. See Filtering and Sorting for examples.
| Field | Type | Required | Description |
|---|---|---|---|
status | 'open' | 'closed' | 'all' | No | Filter by status. Default 'open' |
needsReply | boolean | No | true returns only conversations waiting for your reply. false returns only conversations that do not need one |
hasReplies | boolean | No | true returns only conversations with a reply from the recipient. false returns only conversations where the recipient has not replied, the "who has not replied" view. Combine it with campaignId. When set, includeAutomated is ignored |
unread | boolean | No | true returns only conversations with unread messages. false returns only fully read conversations |
optOut | boolean | No | true returns only conversations where a reply asked to stop, false only the others |
simulated | boolean | No | true returns only simulated conversations, false only real ones |
hasAttachments | boolean | No | true returns only conversations with attachments, false only those without |
includeAutomated | boolean | No | Include conversations that contain only automated messages. Default false. Ignored when hasReplies is set |
replyCount | number | { eq?, gt?, gte?, lt?, lte? } | No | Filter by the number of replies. A number matches exactly. An object takes any of eq, gt, gte, lt and lte, each a whole number of 0 or more, and all of them must hold. Replies are counted as in counts.replies: from the recipient or anyone outside your team, excluding the original email, your team's replies and automatic replies |
lastMessageDirection | 'inbound' | 'outbound' | No | Only conversations whose latest message was received (inbound) or sent (outbound). inbound gives the conversations waiting on your team |
deliveryStatus | string | string[] | No | Only conversations whose original email has one of these statuses: sent, delivered, opened, clicked, bounced or complained. Pass an array to match any of them |
campaignId | string | No | Only conversations started by an email in this campaign. Case-insensitive |
leadEmail | string | No | Only conversations with this recipient |
fromEmail | string | No | Only conversations whose original email was sent from this exact address |
subject | string | No | Only conversations whose original subject contains this text. Case-insensitive |
q | string | No | Search the recipient's email address and name, and the subject |
since | string | No | ISO 8601 timestamp. The same as lastMessageFrom. Use it for incremental syncs |
sentFrom / sentTo | string | Date | No | The original email was sent at or after sentFrom, or before sentTo |
lastSentFrom / lastSentTo | string | Date | No | The latest message you sent in the conversation (lastOutboundAt) falls in the range |
lastMessageFrom / lastMessageTo | string | Date | No | The latest message in either direction (lastMessageAt) falls in the range |
createdFrom / createdTo | string | Date | No | The conversation was created (createdAt) in the range |
tz | string | No | IANA time zone for date-only values, such as Asia/Kolkata. Default UTC |
sortBy | 'lastMessageAt' | 'sentAt' | 'createdAt' | 'replyCount' | No | Field to sort by. Default 'lastMessageAt' |
sortOrder | 'desc' | 'asc' | No | Sort direction. Default 'desc' |
limit | number | No | Page size. Default 25, max 100 |
cursor | string | No | pagination.nextCursor from the previous page. A cursor only works with the sortBy and sortOrder it was issued for |
Date ranges accept a YYYY-MM-DD date, an ISO 8601 date-time, or a JavaScript Date, which is sent as toISOString(). From is inclusive. A date-time To is exclusive, so sentTo: '2026-10-31T00:00:00+05:30' stops before that instant. A date-only To includes that whole day. Date-only values are read in the tz time zone, and in UTC when tz is not set.
Response
{
threads: [
{
id: '0199f1c2-5a4e-7c1d-9a3b-2f6e8d4c1a10',
status: 'open',
needsReply: true,
hasReplies: true,
unreadCount: 1,
subject: 'Your application',
lead: { email: 'riya@example.com', name: 'Riya Sharma' },
mailbox: 'admissions@yourcompany.com',
fromEmail: 'admissions@yourcompany.com',
senderName: 'Admissions Team',
campaignId: 'Q3-LEADS',
originMessageId: '0199f1a0-77b2-7e10-8c4d-5b1f2e9a3c71',
jobId: '0199f1a0-77b0-7f42-a1d3-0e6b4c8f2d95',
replyDomain: null,
counts: { messages: 4, replies: 2, autoReplies: 1, staffReplies: 1 },
optOutDetected: false,
simulated: false,
firstReplyAt: '2026-10-18T09:12:40.000Z',
lastInboundAt: '2026-10-18T10:02:11.000Z',
lastOutboundAt: '2026-10-18T09:30:05.000Z',
lastMessageAt: '2026-10-18T10:02:11.000Z',
lastMessageDirection: 'inbound',
sentAt: '2026-10-18T08:00:01.000Z',
deliveryStatus: 'opened',
lastSnippet: 'Yes! What are the fees?',
closedAt: null,
createdAt: '2026-10-18T08:00:03.000Z'
}
],
pagination: {
limit: 25,
hasMore: true,
nextCursor: 'eyJ0IjoiMjAyNi0xMC0xOF...',
sortBy: 'lastMessageAt',
sortOrder: 'desc'
}
}Conversation Fields
| Field | Description |
|---|---|
id | Conversation ID |
status | open or closed. A new reply reopens a closed conversation |
needsReply | A person replied and nobody from your team has answered since |
hasReplies | The recipient has replied at least once. false for a conversation opened at send that nobody has replied to yet |
unreadCount | Replies not yet marked read |
subject | Subject of the original email, or null |
lead | The person the original email was sent to: email, and name or null |
mailbox | Where replies to the original email go: its replyTo, or its fromEmail |
fromEmail / senderName | Sender of the original email. Replies you send from Outbound use them too |
campaignId | Campaign of the original email, or null |
originMessageId | messageId of the original email, as returned by the send call and used in webhooks |
jobId | Job of the original email |
replyDomain | Reply domain the conversation uses. Set by getThread(), null in lists |
counts | messages, replies (human replies), autoReplies (auto replies, bounce notices and read receipts) and staffReplies |
optOutDetected | A message in this conversation asked to stop |
simulated | Created with sandbox.simulateReply() |
firstReplyAt | First human reply, or null |
lastInboundAt / lastOutboundAt | Latest received and latest sent message, or null |
lastMessageAt | Latest message in either direction. Lists are sorted by this unless you pass sortBy |
lastMessageDirection | inbound when the latest message was received, outbound when you or your team sent it last |
sentAt | When the original email was sent |
deliveryStatus | Delivery status of the original email: sent, delivered, opened, clicked, bounced or complained. null when unknown |
lastSnippet | Preview of the latest message |
closedAt | When the conversation was closed, or null |
createdAt | When the conversation was created |
Pagination
pagination has limit, hasMore, nextCursor, and the sortBy and sortOrder the page was sorted by. Keep the same filters and sort on every page. Start again without cursor when you change either of them. On a large account, sort by the field you filter a date range on (for example sortBy: 'sentAt' with sentFrom/sentTo) for the fastest pages.
Filtering and Sorting
Each example is a listThreads() call. listAllThreads() accepts the same filters and sort.
Who has not replied to October sends, counted in India time:
const page = await outbound.conversations.listThreads({
status: 'all',
hasReplies: false,
sentFrom: '2026-10-01',
sentTo: '2026-10-31',
tz: 'Asia/Kolkata',
});Conversations with more than three replies:
const page = await outbound.conversations.listThreads({ replyCount: { gt: 3 } });Conversations with 2 to 5 replies:
const page = await outbound.conversations.listThreads({ replyCount: { gte: 2, lte: 5 } });Bounced emails to one recipient:
const page = await outbound.conversations.listThreads({
deliveryStatus: 'bounced',
leadEmail: 'riya@example.com',
status: 'all',
});Conversations waiting on your team, where the recipient wrote last:
const page = await outbound.conversations.listThreads({ lastMessageDirection: 'inbound' });Most replies first, across every page:
for await (const thread of outbound.conversations.listAllThreads({ sortBy: 'replyCount', sortOrder: 'desc' })) {
console.log(thread.lead.email, thread.counts.replies);
}Auto-Pagination
Iterate through every matching conversation without handling cursors yourself:
for await (const thread of outbound.conversations.listAllThreads({ status: 'all', campaignId: 'Q3-LEADS' })) {
console.log(thread.lead.email, thread.counts.replies);
}Possible Errors
| Error | Status | Cause |
|---|---|---|
BadRequestError | 400 | A filter or sort option has an invalid value, replyCount is not a whole number of 0 or more, cursor is invalid or was issued for a different sortBy or sortOrder, or since is not an ISO 8601 timestamp |
ForbiddenError | 403 | Conversations is not enabled for your account |
Get a Conversation
The conversation and all of its messages, oldest first.
const { thread, messages } = await outbound.conversations.getThread(threadId);
for (const m of messages) {
console.log(`[${m.kind}] ${m.from.email}: ${m.newText ?? m.snippet}`);
}Response
{
thread: { /* conversation fields, with replyDomain set */ },
messages: [
{
id: '0199f1c3-1d2e-7a4b-9c8d-6e5f4a3b2c1d',
threadId: '0199f1c2-5a4e-7c1d-9a3b-2f6e8d4c1a10',
direction: 'inbound',
kind: 'reply',
from: { email: 'riya@example.com', name: 'Riya Sharma' },
to: ['admissions@yourcompany.com'],
cc: [],
subject: 'Re: Your application',
snippet: 'Yes! What are the fees?',
newText: 'Yes! What are the fees?',
text: 'Yes! What are the fees?\n\nOn Sat, 18 Oct 2026, Admissions Team wrote:\n> Hi Riya, ...',
hasHtml: true,
hasRaw: true,
attachmentCount: 1,
attachments: [
{
id: '0199f1c3-1d30-7b11-8e2f-3a4b5c6d7e8f',
filename: 'marksheet.pdf',
contentType: 'application/pdf',
size: 12345,
contentId: null,
inline: false
}
],
participant: 'recipient',
recipient: { email: 'riya@example.com', role: 'to' },
senderAuth: 'verified',
outOfOffice: false,
optOut: { detected: false, phrase: null, action: null },
originMessageId: null,
rfcMessageId: '<CAJx9f2kq7@mail.gmail.com>',
inReplyTo: '<...>',
sentVia: null,
sentBy: null,
simulated: false,
delivery: null,
occurredAt: '2026-10-18T10:02:11.000Z'
}
]
}Message Fields
| Field | Description |
|---|---|
direction | inbound (received) or outbound (sent) |
kind | See Message Kinds |
from | Sender email and name. Either can be null |
to / cc | Addresses on the message |
newText | Only what this message added, with the quoted history removed. The best field for previews and for processing replies |
text | Full plain text, including the quoted history |
snippet | A short preview |
hasHtml | An HTML body is available from getMessageHtml() |
hasRaw | The original email file is stored. See Attachments and Original Files |
attachments | id, filename, contentType, size in bytes, contentId, and inline (an image shown inside the HTML body) |
participant | See Who Sent a Message. null on the original email |
recipient | Which recipient this message belongs to: email and role (to, cc or bcc). null when it is not known |
senderAuth | See Who Sent a Message |
outOfOffice | The message is an out-of-office reply |
optOut | detected, the phrase that matched, and the action taken. See Opt-Out Replies |
originMessageId | On sent messages, the messageId of that email. null on received messages |
rfcMessageId / inReplyTo | The email's threading headers |
sentVia | For replies sent from Outbound: ui (dashboard), api, or admin (an Outbound admin answered on your behalf). Otherwise null |
sentBy | The dashboard user who sent the reply, or null |
simulated | Created with sandbox.simulateReply() |
delivery | On sent messages: status, error, sentAt, deliveredAt and openedAt. null on received messages |
occurredAt | When the message was sent or received |
Possible Errors
| Error | Status | Cause |
|---|---|---|
NotFoundError | 404 | No conversation with this ID for your account |
ForbiddenError | 403 | Conversations is not enabled for your account |
Update a Conversation
Close or reopen a conversation, or mark it read or unread.
await outbound.conversations.updateThread(threadId, { status: 'closed' });
await outbound.conversations.updateThread(threadId, { read: true });Parameters
| Field | Type | Required | Description |
|---|---|---|---|
status | 'open' | 'closed' | No | Closing also clears needsReply. A new reply reopens the conversation |
read | boolean | No | true marks every message read. false marks the conversation unread |
Pass at least one field.
Response
{
thread: { /* the updated conversation */ }
}Possible Errors
| Error | Status | Cause |
|---|---|---|
BadRequestError | 400 | No field given, or a field has an invalid value |
NotFoundError | 404 | No conversation with this ID for your account |
ForbiddenError | 403 | Conversations is not enabled for your account |
Reply to a Conversation
Send a reply from Outbound.
const reply = await outbound.conversations.reply(threadId, {
text: 'Hi Riya, the fee schedule is on our admissions page.',
idempotencyKey: `reply:${threadId}:${draftId}`,
});
console.log(`Reply ${reply.replyId} queued to ${reply.to}`);How the reply is sent:
- From the original email's
fromEmailandsenderName, with the subjectRe: <original subject>. - To the person who wrote the latest reply, or to the lead when nobody has replied yet or the latest reply came from your team.
- It threads under the message it answers in the recipient's mail app, and quotes that message unless you pass
includeQuote: false. - It captures replies too, so the answer comes back into the same conversation.
- A copy goes to the conversation's
mailboxby BCC, so your team's inbox keeps the whole exchange. - It counts as one email against your quota. It marks the conversation read, clears
needsReplyand fires areplywebhook withreplyType: staff_reply.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
text | string | One of text / html | Plain-text body, up to 50,000 characters |
html | string | One of text / html | HTML body, up to 500,000 characters |
includeQuote | boolean | No | Quote the message you are answering below your reply. Default true |
idempotencyKey | string | No | Makes retries safe: a repeat with the same key returns the first response with duplicate: true instead of sending again. Keys expire after 24 hours |
Response
{
message: 'Reply queued',
threadId: '0199f1c2-5a4e-7c1d-9a3b-2f6e8d4c1a10',
replyId: '0199f1d0-0b1c-7d2e-8f3a-4b5c6d7e8f90',
messageId: '0199f1d0-0b1a-7c3d-9e4f-5a6b7c8d9e0f',
jobId: '0199f1d0-0b19-7a2b-8c3d-4e5f6a7b8c9d',
to: 'riya@example.com',
replyDomain: 'reply.outbound.yourcompany.com'
}| Field | Description |
|---|---|
replyId | ID of the new message in the conversation |
messageId | Message ID of the sent email, as used by email.getMessageStatus() and webhooks |
jobId | Job ID of the sent email, for email.status() |
to | Who the reply was sent to |
replyDomain | Reply domain the reply uses |
duplicate | true when an idempotencyKey was replayed. Nothing new was sent |
Possible Errors
| Error | Status | Cause |
|---|---|---|
BadRequestError | 400 | Neither text nor html given, a body is too long, or idempotencyKey is empty |
ForbiddenError | 403 | Conversations is not enabled for your account |
NotFoundError | 404 | No conversation with this ID for your account |
ConflictError | 409 | A request with the same idempotencyKey is still being processed |
OutboundError | 422 | The recipient is on your suppression list (details.email, details.reason), your account has no active reply domain, or the conversation has nobody to reply to |
RateLimitError | 429 | Rate limit exceeded, or the daily sending quota is exhausted |
ServerError | 503 | Reply capture is not configured on the platform |
Get Message HTML
The HTML body of one message, cleaned up for safe display. Remote images are blocked by default, so opening a reply does not tell its sender that you read it.
const { html, remoteImagesBlocked } = await outbound.conversations.getMessageHtml(messageId);
iframe.setAttribute('sandbox', '');
iframe.srcdoc = html;
if (remoteImagesBlocked > 0) {
showImagesButton.onclick = async () => {
const withImages = await outbound.conversations.getMessageHtml(messageId, { images: true });
iframe.srcdoc = withImages.html;
};
}Parameters
| Field | Type | Required | Description |
|---|---|---|---|
messageId | string | Yes | A message id from getThread(). First argument |
images | boolean | No | Load remote images. Default false |
Response
{
html: '<div dir="ltr">Yes! What are the fees?</div><div class="gmail_quote">...</div>',
displayHtml: '<div dir="ltr">Yes! What are the fees?</div>',
remoteImagesBlocked: 2,
inlineImagesOmitted: 0
}| Field | Description |
|---|---|
html | The sanitized HTML. Render it inside a sandboxed iframe |
displayHtml | The same message with the quoted earlier emails removed, or null when there was nothing to trim. Show it by default and put html behind a "Show trimmed content" toggle, as Gmail does |
remoteImagesBlocked | Remote images that were removed. When above 0, offer a "Show images" action that refetches with images: true |
inlineImagesOmitted | Images embedded in the email that were too large to include |
Possible Errors
| Error | Status | Cause |
|---|---|---|
NotFoundError | 404 | No message with this ID, or the message has no HTML body (hasHtml is false, or the content of the original email is no longer stored) |
ForbiddenError | 403 | Conversations is not enabled for your account |
Attachments and Original Files
Downloading attachments and the original .eml file is not part of the SDK yet. Use the dashboard, or call the REST API with your API key:
GET /v1/conversations/messages/:messageId/attachments/:attachmentIdGET /v1/conversations/messages/:messageId/raw
const res = await fetch(
`https://outbound-api.unionstack.in/v1/conversations/messages/${messageId}/attachments/${attachmentId}`,
{ headers: { 'X-Api-Key': process.env.OUTBOUND_API_KEY! } },
);
const file = Buffer.from(await res.arrayBuffer());Erase a Person's Conversations
Permanently delete everything Conversations stores about one person, for example to honor a data deletion request.
const { erasure } = await outbound.conversations.erase({ email: 'riya@example.com' });
console.log(`Deleted ${erasure.threadsDeleted} conversations and ${erasure.messagesDeleted} messages`);This is permanent
Erasure cannot be undone. It deletes:
- every conversation where this person is the lead, with all of its messages and files
- every message this person sent in other conversations, for example as a CC recipient
- the stored copies of emails received from this person
- the logged webhook deliveries of
reply,auto_replyandunsubscribeevents that carried their conversations or messages
It works even if Conversations has since been disabled for your account. It does not change your email logs, suppression list or contact lists, and it cannot recall webhooks your endpoint has already received.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | The person's email address. Matched case-insensitively |
Response
{
erasure: {
email: 'riya@example.com',
threadsDeleted: 2,
messagesDeleted: 7,
filesDeleted: 9,
receivedEmailsDeleted: 5,
webhookLogsDeleted: 3
}
}| Field | Description |
|---|---|
email | The address that was erased, lowercased |
threadsDeleted | Conversations deleted because this person was the lead |
messagesDeleted | Messages deleted, in those conversations and in others |
filesDeleted | Stored files deleted: message bodies, attachments and original email files |
receivedEmailsDeleted | Stored emails received from this person that were deleted |
webhookLogsDeleted | Logged webhook deliveries that were deleted because they carried this person's conversations or messages |
Erasure is safe to retry. A repeat call for the same address only deletes what has arrived since the last one.
Possible Errors
| Error | Status | Cause |
|---|---|---|
BadRequestError | 400 | email is missing or is not an email address |
AuthenticationError | 401 | Invalid or missing API key |