POST
/
api
/
v2
/
threads
/
{id}
/
actions
import { Inbound } from '@inboundemail/sdk'

const inbound = new Inbound('YOUR_API_KEY')

const { data, error } = await inbound.thread.markAsRead('thread_abc123')

if (error) {
  console.error('Error:', error)
} else {
  console.log(`Marked ${data.affectedMessages} messages as read`)
}
{
  "success": true,
  "action": "mark_as_read",
  "threadId": "thread_abc123",
  "affectedMessages": 3,
  "message": "Successfully marked 3 messages as read"
}

Overview

This endpoint allows you to perform bulk actions on all messages within a thread. Actions affect all messages in the thread simultaneously, making it easy to manage entire conversations.

Authentication

Authorization
string
required
Bearer token for API authentication. Format: Bearer YOUR_API_KEY

Path Parameters

id
string
required
The unique identifier of the thread to perform actions on.

Request Body

action
string
required
The action to perform on the thread. Valid values:
  • mark_as_read - Mark all messages in the thread as read
  • mark_as_unread - Mark all messages in the thread as unread
  • archive - Archive all messages in the thread
  • unarchive - Unarchive all messages in the thread

Response

success
boolean
required
Whether the action was completed successfully.
action
string
required
The action that was performed.
threadId
string
required
The ID of the thread that was acted upon.
affectedMessages
integer
Number of messages that were affected by the action.
message
string
Human-readable description of what was accomplished.

Examples

Mark Thread as Read

import { Inbound } from '@inboundemail/sdk'

const inbound = new Inbound('YOUR_API_KEY')

const { data, error } = await inbound.thread.markAsRead('thread_abc123')

if (error) {
  console.error('Error:', error)
} else {
  console.log(`Marked ${data.affectedMessages} messages as read`)
}

Archive Thread

import { Inbound } from '@inboundemail/sdk'

const inbound = new Inbound('YOUR_API_KEY')

const { data, error } = await inbound.thread.archive('thread_abc123')

if (error) {
  console.error('Error:', error)
} else {
  console.log(`Archived thread with ${data.affectedMessages} messages`)
}

Response

{
  "success": true,
  "action": "mark_as_read",
  "threadId": "thread_abc123",
  "affectedMessages": 3,
  "message": "Successfully marked 3 messages as read"
}

Error Responses

{
  "error": "Invalid action. Supported actions: mark_as_read, mark_as_unread, archive, unarchive"
}