import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.events.list({ limit: 10 });
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.list_events(limit=10)
print(result)curl 'https://api.mails.ai/v1/events?limit=10' \
-H "Authorization: Bearer $MAILS_API_KEY"mails events list --event-type message.received \
--limit 5{
"name": "mails_events_list",
"arguments": { "limit": 10 }
}{
"data": [
{
"id": "evt_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"type": "<type>",
"workspace_id": "wsk_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"agent_id": "agt_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"thread_id": "thrd_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"source_message_id": "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"intent": "<intent>",
"urgency": 0,
"injection_score": 0,
"sender_reputation": 0,
"entities": {},
"injection_categories": ["<injection_categories>"],
"classifier_model": "<classifier_model>",
"quarantined": false,
"test_mode": false,
"data": {},
"created_at": "2026-10-04T12:00:00.000Z"
}
],
"has_more": false,
"next_cursor": "<next_cursor>"
}200 A page of typed events.
400 Invalid request — malformed JSON or a field failed
validation. Also feature_not_enabled when this
server has a feature switched off (custom domains
before they are available).
401 Missing or invalid API key.
403 The API key lacks the required scope
(insufficient_scope), or the token belongs to an
app connected by sign-in and this operation is
closed to connected apps
(connected_app_not_allowed).
409 Conflict — duplicate resource, an in-progress
idempotent request, a draft or scheduled message
that started sending while it was being changed, or
a thread deleted for good while one of its messages
is being sent (duplicate_resource); or an agent
name more than one agent has (agent_name_conflict:
use the agent's id); or a status change on an
archived agent, since archiving cannot be undone
(agent_archived).
500 Internal server error.List events
import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.events.list({ limit: 10 });
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.list_events(limit=10)
print(result)curl 'https://api.mails.ai/v1/events?limit=10' \
-H "Authorization: Bearer $MAILS_API_KEY"mails events list --event-type message.received \
--limit 5{
"name": "mails_events_list",
"arguments": { "limit": 10 }
}{
"data": [
{
"id": "evt_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"type": "<type>",
"workspace_id": "wsk_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"agent_id": "agt_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"thread_id": "thrd_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"source_message_id": "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"intent": "<intent>",
"urgency": 0,
"injection_score": 0,
"sender_reputation": 0,
"entities": {},
"injection_categories": ["<injection_categories>"],
"classifier_model": "<classifier_model>",
"quarantined": false,
"test_mode": false,
"data": {},
"created_at": "2026-10-04T12:00:00.000Z"
}
],
"has_more": false,
"next_cursor": "<next_cursor>"
}200 A page of typed events.
400 Invalid request — malformed JSON or a field failed
validation. Also feature_not_enabled when this
server has a feature switched off (custom domains
before they are available).
401 Missing or invalid API key.
403 The API key lacks the required scope
(insufficient_scope), or the token belongs to an
app connected by sign-in and this operation is
closed to connected apps
(connected_app_not_allowed).
409 Conflict — duplicate resource, an in-progress
idempotent request, a draft or scheduled message
that started sending while it was being changed, or
a thread deleted for good while one of its messages
is being sent (duplicate_resource); or an agent
name more than one agent has (agent_name_conflict:
use the agent's id); or a status change on an
archived agent, since archiving cannot be undone
(agent_archived).
500 Internal server error.Query Parameters
limitinteger
Page size (1–100).
cursorstring
Opaque cursor from a previous page's next_cursor.
event_typestring
Filter by exact event type.
agent_idstring
Filter by agent id or name.
sincestring
Only events created at or after this time: an ISO 8601 time such as 2026-10-05T07:00:00Z or 2026-10-05T16:00:00+09:00, or a date (2026-10-05, midnight UTC). A time with no offset is UTC, and its seconds and milliseconds may be left out. Any other value answers 400 invalid_param_value. The event stream's since is different: a position the stream gave, or an event id.
Response
dataobject[]
The items on this page, at most limit of them.
has_moreboolean
True when more items follow this page: pass next_cursor as cursor to get them.
next_cursorstring
Pass as cursor to fetch the next page. Absent on the last page.
Was this page helpful?