List email
Reads a page of the org's ledger, newest first: every message sent through POST /v1/email, and every message SES or SendGrid told of by its events, sent from anywhere on the org's account.
GET /v1/email
| Address | https://api.hanzo.ai/v1/email |
| Method | GET |
| Operation | get_email |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Reads a page of the org's ledger, newest first: every message sent through POST /v1/email, and every message SES or SendGrid told of by its events, sent from anywhere on the org's account. It narrows by status, provider, a range of send time (since, until) and one recipient, and pages by cursor: pass the answer's next to read the page after.
GET /v1/email
Request
7 fields.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | — | Limit is the most messages on the page (default 50, max 200). |
status | query | string | — | Status is one status to list: queued, sent, failed, delivered, opened, clicked, bounced or complained. |
provider | query | string | — | Provider is ses or sendgrid. |
since | query | string | — | Since is the earliest send time listed, RFC 3339. |
until | query | string | — | Until is the send time listing stops before, RFC 3339. |
recipient | query | string | — | Recipient lists the messages to one address. |
cursor | query | string | — | Cursor is the next of the page before; empty is the newest page. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | email.ListMessagesResult | ok |
default | problem-details | refused |
200 body — 22 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
messages | body | email.MessageRecord[] | — | Messages is the page. |
messages[].bounce | body | string | — | Bounce is hard or soft, for a message that bounced. |
messages[].bounced_at | body | string (date-time) | — | BouncedAt is when it bounced, and Bounce whether hard or soft. |
messages[].campaign | body | string | — | Campaign is the campaign the message was tagged with. |
messages[].clicked_at | body | string (date-time) | — | ClickedAt is when a link in it was first clicked. |
messages[].complained_at | body | string (date-time) | — | ComplainedAt is when its recipient reported it as spam. |
messages[].created_at | body | string (date-time) | — | CreatedAt is when the message was sent, or accepted to be. |
messages[].delivered_at | body | string (date-time) | — | DeliveredAt is when the receiving server first took it. |
messages[].error | body | string | — | Error says why it failed, bounced, was deferred or was rejected. |
messages[].from | body | string | — | From is the sender address, when known. |
messages[].id | body | string | — | ID is our id for the message (msg_…): every link in it carries it as from=, and the event stream names it by it. |
messages[].idempotency_key | body | string | — | IdempotencyKey is the key the message was sent under. |
messages[].opened_at | body | string (date-time) | — | OpenedAt is when it was first opened. |
messages[].org | body | string | — | Org is the organization owning this message. |
messages[].origin | body | string | — | Origin is api for a message POST /v1/email sent, provider for one the provider's events told of, sent from the org's own tools. |
messages[].provider | body | string | — | Provider is the rail it went by: ses or sendgrid. |
messages[].provider_id | body | string | — | ProviderID is the provider's own id for the message, which its events name it by; empty until the provider answers one. |
messages[].status | body | string | — | Status is queued, sent, failed, delivered, opened, clicked, bounced or complained. |
messages[].subject | body | string | — | Subject is the message subject line, when known. |
messages[].to | body | string[] | — | To lists the recipients. |
messages[].unsubscribed_at | body | string (date-time) | — | UnsubscribedAt is when its recipient unsubscribed from it. |
next | body | string | — | Next is the cursor of the page after this one; empty on the last page. |
Failure carries the platform error shape — see Errors.
Examples
hanzo email listimport { Configuration, EmailApi } from 'hanzoai';
const api = new EmailApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getEmail();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import EmailApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = EmailApi(client).get_email()cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.EmailAPI.GetEmail(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, email_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = email_api::get_email(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.EmailApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new EmailApi(client).getEmail();curl https://api.hanzo.ai/v1/email \
-H "Authorization: Bearer $HANZO_API_KEY"MCP reaches email through the email tool, which names its 8 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_emails"
}
}
}'