import { CommuneClient } from 'commune-ai';
const commune = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY });
const result = await commune.messages.list({
inboxId: 'inbox_abc123',
limit: 25,
direction: 'desc',
});
console.log(result.data.length); // up to 25
from commune import CommuneClient
client = CommuneClient()
result = client.messages.list(
inbox_id="inbox_abc123",
limit=25,
direction="desc",
)
print(len(result.data))
list_messages(
inbox_id="inbox_abc123",
limit=25
)
curl "https://api.commune.email/v1/messages?inbox_id=inbox_abc123&limit=25&order=desc" \
-H "Authorization: Bearer comm_..."
commune messages list --inbox-id inbox_abc123 --limit 25
{
"data": [
{
"channel": "email",
"message_id": "49a3999c-0ce1-4ea6-ab68-e08a5c73e498",
"thread_id": "thread_f47ac10b-58cc-4372-a567-0e02b2c3d479",
"direction": "inbound",
"participants": [
{ "role": "sender", "identity": "customer@example.com" },
{ "role": "to", "identity": "support@mycompany.com" }
],
"content": "Hi, I need help with my order.",
"content_html": "<p>Hi, I need help with my order.</p>",
"attachments": [],
"created_at": "2026-02-25T10:30:00.000Z",
"metadata": {
"created_at": "2026-02-25T10:30:00.000Z",
"subject": "Order help",
"inbox_id": "inbox_abc123",
"domain_id": "domain_xyz789",
"delivery_status": "delivered",
"has_attachments": false,
"attachment_count": 0,
"spam_checked": true,
"spam_score": 0.02,
"spam_action": "accept",
"spam_flagged": false,
"prompt_injection_checked": true,
"prompt_injection_detected": false,
"prompt_injection_risk": "none"
}
}
]
}
{
"error": "Provide at least one filter: sender, domain_id, or inbox_id"
}
{
"error": "unauthorized",
"message": "Invalid or missing API key"
}
Messages
List messages
List messages filtered by inbox, domain, or sender identity.
GET
/
v1
/
messages
import { CommuneClient } from 'commune-ai';
const commune = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY });
const result = await commune.messages.list({
inboxId: 'inbox_abc123',
limit: 25,
direction: 'desc',
});
console.log(result.data.length); // up to 25
from commune import CommuneClient
client = CommuneClient()
result = client.messages.list(
inbox_id="inbox_abc123",
limit=25,
direction="desc",
)
print(len(result.data))
list_messages(
inbox_id="inbox_abc123",
limit=25
)
curl "https://api.commune.email/v1/messages?inbox_id=inbox_abc123&limit=25&order=desc" \
-H "Authorization: Bearer comm_..."
commune messages list --inbox-id inbox_abc123 --limit 25
{
"data": [
{
"channel": "email",
"message_id": "49a3999c-0ce1-4ea6-ab68-e08a5c73e498",
"thread_id": "thread_f47ac10b-58cc-4372-a567-0e02b2c3d479",
"direction": "inbound",
"participants": [
{ "role": "sender", "identity": "customer@example.com" },
{ "role": "to", "identity": "support@mycompany.com" }
],
"content": "Hi, I need help with my order.",
"content_html": "<p>Hi, I need help with my order.</p>",
"attachments": [],
"created_at": "2026-02-25T10:30:00.000Z",
"metadata": {
"created_at": "2026-02-25T10:30:00.000Z",
"subject": "Order help",
"inbox_id": "inbox_abc123",
"domain_id": "domain_xyz789",
"delivery_status": "delivered",
"has_attachments": false,
"attachment_count": 0,
"spam_checked": true,
"spam_score": 0.02,
"spam_action": "accept",
"spam_flagged": false,
"prompt_injection_checked": true,
"prompt_injection_detected": false,
"prompt_injection_risk": "none"
}
}
]
}
{
"error": "Provide at least one filter: sender, domain_id, or inbox_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.messages.list({
inboxId: 'inbox_abc123',
limit: 25,
direction: 'desc',
});
console.log(result.data.length); // up to 25
from commune import CommuneClient
client = CommuneClient()
result = client.messages.list(
inbox_id="inbox_abc123",
limit=25,
direction="desc",
)
print(len(result.data))
list_messages(
inbox_id="inbox_abc123",
limit=25
)
curl "https://api.commune.email/v1/messages?inbox_id=inbox_abc123&limit=25&order=desc" \
-H "Authorization: Bearer comm_..."
commune messages list --inbox-id inbox_abc123 --limit 25
{
"data": [
{
"channel": "email",
"message_id": "49a3999c-0ce1-4ea6-ab68-e08a5c73e498",
"thread_id": "thread_f47ac10b-58cc-4372-a567-0e02b2c3d479",
"direction": "inbound",
"participants": [
{ "role": "sender", "identity": "customer@example.com" },
{ "role": "to", "identity": "support@mycompany.com" }
],
"content": "Hi, I need help with my order.",
"content_html": "<p>Hi, I need help with my order.</p>",
"attachments": [],
"created_at": "2026-02-25T10:30:00.000Z",
"metadata": {
"created_at": "2026-02-25T10:30:00.000Z",
"subject": "Order help",
"inbox_id": "inbox_abc123",
"domain_id": "domain_xyz789",
"delivery_status": "delivered",
"has_attachments": false,
"attachment_count": 0,
"spam_checked": true,
"spam_score": 0.02,
"spam_action": "accept",
"spam_flagged": false,
"prompt_injection_checked": true,
"prompt_injection_detected": false,
"prompt_injection_risk": "none"
}
}
]
}
{
"error": "Provide at least one filter: sender, domain_id, or inbox_id"
}
{
"error": "unauthorized",
"message": "Invalid or missing API key"
}
Query Parameters
At least one of
inbox_id, domain_id, or sender is required. The endpoint returns a 400 error if none are provided.string
Filter messages to a specific inbox. Takes precedence over
domain_id and sender when provided.string
Filter messages to a specific domain. Used when
inbox_id is not provided. Takes precedence over sender.string
Filter messages by sender identity (email address). Used when neither
inbox_id nor domain_id is provided.number
default:"50"
Maximum number of results to return. Range: 1–1000.
string
default:"desc"
Sort order by
created_at. One of: asc (oldest first) or desc (newest first).string
ISO 8601 date string. Return only messages created before this timestamp. Example:
2026-02-25T00:00:00.000Z.string
ISO 8601 date string. Return only messages created after this timestamp. Example:
2026-02-01T00:00:00.000Z.Response
object[]
Array of message objects.
Hide Message object properties
Hide Message object properties
string
Always
"email" for email messages.string
Unique message identifier.
string
Thread this message belongs to. Format:
thread_<uuid>.string
"inbound" for received messages, "outbound" for sent messages.object[]
string
Plain text body of the message.
string | null
HTML body of the message.
null if no HTML body was present.string[]
Array of attachment IDs associated with this message.
string
ISO 8601 timestamp when this message was created.
object
Show Metadata properties
Show Metadata properties
string
Email subject line.
string | null
ID of the inbox this message belongs to.
string | null
ID of the domain this message belongs to.
string | null
Full email address of the inbox (e.g.
support@mycompany.com).string | null
RFC 5322
In-Reply-To header value. Present on replies.string[]
RFC 5322
References header values for thread chaining.string
Current delivery status. One of:
sent, delivered, bounced, failed, complained, suppressed, blocked, credit_limit.object
Show Delivery data properties
Show Delivery data properties
string
ISO 8601 timestamp when the message was sent.
string
ISO 8601 timestamp when delivery was confirmed.
string
ISO 8601 timestamp of bounce event.
string
Human-readable bounce reason from the receiving server.
string
One of:
hard, soft.string
ISO 8601 timestamp of failure event.
string
Reason for delivery failure.
boolean
true if this message has one or more attachments.number
Number of attachments on this message.
string[]
IDs of attachments linked to this message.
boolean
Whether spam analysis was performed on this message.
number
Spam probability score between 0.0 (clean) and 1.0 (spam).
string
Action taken based on spam analysis. One of:
accept, flag, reject.boolean
true if the message was flagged as spam.string[]
List of reasons the message was flagged, if applicable.
boolean
Whether prompt injection analysis was performed.
boolean
true if a prompt injection attempt was detected in the message body.string
Risk level of detected prompt injection. One of:
none, low, medium, high, critical.number
Rule-based prompt injection score between 0.0 and 1.0.
string
Comma-separated list of rule signals that triggered the score.
object
Structured data extracted from the message body when an extraction schema is configured on the inbox. Keys and value types are defined by your schema.
Structured extraction requires the Business plan or higher.
Last modified on March 19, 2026
Was this page helpful?

