import { CommuneClient } from 'commune-ai';
const commune = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY });
const result = await commune.threads.list({
inboxId: 'inbox_abc123',
limit: 20,
});
console.log(result.data.length); // up to 20 threads
console.log(result.next_cursor); // pass to next call for more
console.log(result.has_more); // true if more pages exist
from commune import CommuneClient
client = CommuneClient()
result = client.threads.list(
inbox_id="inbox_abc123",
limit=20,
)
print(result.next_cursor)
list_threads(inbox_id="inbox_abc123", limit=20)
curl "https://api.commune.email/v1/threads?inbox_id=inbox_abc123&limit=20&order=desc" \
-H "Authorization: Bearer comm_..."
commune threads list --inbox-id inbox_abc123
{
"data": [
{
"thread_id": "thread_f47ac10b-58cc-4372-a567-0e02b2c3d479",
"subject": "Order help",
"last_message_at": "2026-02-25T10:30:00.000Z",
"first_message_at": "2026-02-25T09:00:00.000Z",
"message_count": 3,
"snippet": "Hi, I need help with my order.",
"last_direction": "inbound",
"inbox_id": "inbox_abc123",
"domain_id": "domain_xyz789",
"has_attachments": false
}
],
"next_cursor": "eyJsYXN0X21lc3NhZ2VfYXQiOiIyMDI2LTAyLTI1VDEwOjMwOjAwLjAwMFoiLCJpZCI6InRocmVhZF9mNDdhYzEwYiJ9",
"has_more": true
}
{
"error": "Missing required query parameter: inbox_id or domain_id"
}
{
"error": "unauthorized",
"message": "Invalid or missing API key"
}
Threads
List threads
List email threads with cursor-based pagination, filtered by inbox or domain.
GET
/
v1
/
threads
import { CommuneClient } from 'commune-ai';
const commune = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY });
const result = await commune.threads.list({
inboxId: 'inbox_abc123',
limit: 20,
});
console.log(result.data.length); // up to 20 threads
console.log(result.next_cursor); // pass to next call for more
console.log(result.has_more); // true if more pages exist
from commune import CommuneClient
client = CommuneClient()
result = client.threads.list(
inbox_id="inbox_abc123",
limit=20,
)
print(result.next_cursor)
list_threads(inbox_id="inbox_abc123", limit=20)
curl "https://api.commune.email/v1/threads?inbox_id=inbox_abc123&limit=20&order=desc" \
-H "Authorization: Bearer comm_..."
commune threads list --inbox-id inbox_abc123
{
"data": [
{
"thread_id": "thread_f47ac10b-58cc-4372-a567-0e02b2c3d479",
"subject": "Order help",
"last_message_at": "2026-02-25T10:30:00.000Z",
"first_message_at": "2026-02-25T09:00:00.000Z",
"message_count": 3,
"snippet": "Hi, I need help with my order.",
"last_direction": "inbound",
"inbox_id": "inbox_abc123",
"domain_id": "domain_xyz789",
"has_attachments": false
}
],
"next_cursor": "eyJsYXN0X21lc3NhZ2VfYXQiOiIyMDI2LTAyLTI1VDEwOjMwOjAwLjAwMFoiLCJpZCI6InRocmVhZF9mNDdhYzEwYiJ9",
"has_more": true
}
{
"error": "Missing required query parameter: inbox_id or domain_id"
}
{
"error": "unauthorized",
"message": "Invalid or missing API key"
}
import { CommuneClient } from 'commune-ai';
const commune = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY });
const result = await commune.threads.list({
inboxId: 'inbox_abc123',
limit: 20,
});
console.log(result.data.length); // up to 20 threads
console.log(result.next_cursor); // pass to next call for more
console.log(result.has_more); // true if more pages exist
from commune import CommuneClient
client = CommuneClient()
result = client.threads.list(
inbox_id="inbox_abc123",
limit=20,
)
print(result.next_cursor)
list_threads(inbox_id="inbox_abc123", limit=20)
curl "https://api.commune.email/v1/threads?inbox_id=inbox_abc123&limit=20&order=desc" \
-H "Authorization: Bearer comm_..."
commune threads list --inbox-id inbox_abc123
{
"data": [
{
"thread_id": "thread_f47ac10b-58cc-4372-a567-0e02b2c3d479",
"subject": "Order help",
"last_message_at": "2026-02-25T10:30:00.000Z",
"first_message_at": "2026-02-25T09:00:00.000Z",
"message_count": 3,
"snippet": "Hi, I need help with my order.",
"last_direction": "inbound",
"inbox_id": "inbox_abc123",
"domain_id": "domain_xyz789",
"has_attachments": false
}
],
"next_cursor": "eyJsYXN0X21lc3NhZ2VfYXQiOiIyMDI2LTAyLTI1VDEwOjMwOjAwLjAwMFoiLCJpZCI6InRocmVhZF9mNDdhYzEwYiJ9",
"has_more": true
}
{
"error": "Missing required query parameter: inbox_id or domain_id"
}
{
"error": "unauthorized",
"message": "Invalid or missing API key"
}
Query Parameters
At least one of
inbox_id or domain_id is required.string
Filter threads to a specific inbox. Takes precedence over
domain_id.string
Filter threads to all inboxes on a specific domain.
number
default:"20"
Maximum number of threads per page. Range: 1–100.
string
Pagination cursor from the
next_cursor field of a previous response. Pass this to fetch the next page.string
default:"desc"
Sort order by
last_message_at. One of: desc (most recent first) or asc (oldest first).Response
object[]
Array of thread summary objects.
Hide Thread object properties
Hide Thread object properties
string
Unique thread identifier. Format:
thread_<uuid>.string
Subject line of the first message in this thread.
string
ISO 8601 timestamp of the most recent message in the thread.
string
ISO 8601 timestamp of the first message in the thread.
number
Total number of messages in the thread.
string
Plain text preview of the most recent message body. Truncated to 200 characters.
string
Direction of the most recent message. One of:
inbound, outbound.string
ID of the inbox this thread is associated with.
string
ID of the domain this thread is associated with.
boolean
true if any message in this thread has attachments.string | null
Opaque cursor string to pass as
cursor in your next request to fetch the next page. null when there are no more results.boolean
true if there are additional pages of results available.Last modified on March 19, 2026
Was this page helpful?

