# Reference ## Inboxes
client.inboxes.list({ ...params }) -> AgentMail.ListInboxesResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes list ```
#### 🔌 Usage
```typescript await client.inboxes.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.inboxes.ListInboxesRequest`
**requestOptions:** `InboxesClient.RequestOptions`
client.inboxes.search({ ...params }) -> AgentMail.SearchInboxesResponse
#### 📝 Description
Searches inboxes in the organization by address or display name, ranked by relevance. Each word in the query matches the start of a word in the address or display name, so `sup` matches `support@example.com` but `port` does not. An exact address match always ranks first. `limit` cannot exceed 100. A page can be empty and still carry a `next_page_token`; keep paging until the token is absent.
#### 🔌 Usage
```typescript await client.inboxes.search({ q: "q" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.inboxes.SearchInboxesRequest`
**requestOptions:** `InboxesClient.RequestOptions`
client.inboxes.get(inbox_id) -> AgentMail.Inbox
#### 📝 Description
**CLI:** ```bash agentmail inboxes get --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.get("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**requestOptions:** `InboxesClient.RequestOptions`
client.inboxes.create({ ...params }) -> AgentMail.Inbox
#### 📝 Description
**CLI:** ```bash agentmail inboxes create --display-name "My Agent" --username myagent --domain agentmail.to ```
#### 🔌 Usage
```typescript await client.inboxes.create(undefined); ```
#### ⚙️ Parameters
**request:** `AgentMail.CreateInboxRequest`
**requestOptions:** `InboxesClient.RequestOptions`
client.inboxes.update(inbox_id, { ...params }) -> AgentMail.Inbox
#### 📝 Description
**CLI:** ```bash agentmail inboxes update --inbox-id --display-name "Updated Name" ``` To deactivate an inbox, set `status` to `deactivated`; set it back to `active` to reactivate it. To deactivate it later, set `deactivate_at`. See [Deactivating an inbox](/inboxes#deactivating-an-inbox).
#### 🔌 Usage
```typescript await client.inboxes.update("inbox_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.UpdateInboxRequest`
**requestOptions:** `InboxesClient.RequestOptions`
client.inboxes.delete(inbox_id) -> void
#### 📝 Description
Deletion is asynchronous. A `202` means it has started. While it runs, requests for this inbox return `409` `resource_deleting`. Poll `GET /v0/inboxes/{inbox_id}` until it returns `404`, then the address is free. If the inbox still has its own API keys, delete returns `409` `cannot_delete`: revoke those keys first. **CLI:** ```bash agentmail inboxes delete --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.delete("my-agent@agentmail.to"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**requestOptions:** `InboxesClient.RequestOptions`
client.inboxes.authorize(inbox_id, { ...params }) -> AgentMail.AuthorizeInboxResponse
#### 📝 Description
Authorizes the AgentID sign-in a client is already waiting in, for the inbox in the path, and returns the ID of the pending public key it will activate. Read the key with Get API Key. A repeat for the same token, inbox, and bearer returns the same key ID. A `403` `AppSignupLimitError` means the app accepts no more sign-ups from your organization.
#### 🔌 Usage
```typescript await client.inboxes.authorize("inbox_id", { authToken: "blackcurrant.........." }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.AuthorizeInboxRequest`
**requestOptions:** `InboxesClient.RequestOptions`
## Pods
client.pods.list({ ...params }) -> AgentMail.ListPodsResponse
#### 📝 Description
**CLI:** ```bash agentmail pods list ```
#### 🔌 Usage
```typescript await client.pods.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.pods.ListPodsRequest`
**requestOptions:** `PodsClient.RequestOptions`
client.pods.get(pod_id) -> AgentMail.Pod
#### 📝 Description
**CLI:** ```bash agentmail pods get --pod-id ```
#### 🔌 Usage
```typescript await client.pods.get("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**requestOptions:** `PodsClient.RequestOptions`
client.pods.create({ ...params }) -> AgentMail.Pod
#### 📝 Description
**CLI:** ```bash agentmail pods create --client-id my-pod ```
#### 🔌 Usage
```typescript await client.pods.create({}); ```
#### ⚙️ Parameters
**request:** `AgentMail.CreatePodRequest`
**requestOptions:** `PodsClient.RequestOptions`
client.pods.delete(pod_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail pods delete --pod-id ```
#### 🔌 Usage
```typescript await client.pods.delete("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**requestOptions:** `PodsClient.RequestOptions`
## Webhooks
client.webhooks.list({ ...params }) -> AgentMail.ListWebhooksResponse
#### 📝 Description
**CLI:** ```bash agentmail webhooks list ```
#### 🔌 Usage
```typescript await client.webhooks.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.webhooks.ListWebhooksRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.webhooks.get(webhook_id) -> AgentMail.Webhook
#### 📝 Description
**CLI:** ```bash agentmail webhooks get --webhook-id ```
#### 🔌 Usage
```typescript await client.webhooks.get("webhook_id"); ```
#### ⚙️ Parameters
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
client.webhooks.getHeaders(webhook_id) -> AgentMail.WebhookHeaderNamesResponse
#### 📝 Description
List the names of custom HTTP headers included with deliveries to this webhook. Header values are write-only and are never returned.
#### 🔌 Usage
```typescript await client.webhooks.getHeaders("webhook_id"); ```
#### ⚙️ Parameters
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
client.webhooks.create({ ...params }) -> AgentMail.Webhook
#### 📝 Description
**CLI:** ```bash agentmail webhooks create --url https://example.com/webhook --event-types message.received ```
#### 🔌 Usage
```typescript await client.webhooks.create({ url: "url", eventTypes: ["message.received", "message.received"] }); ```
#### ⚙️ Parameters
**request:** `AgentMail.CreateWebhookRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.webhooks.update(webhook_id, { ...params }) -> AgentMail.Webhook
#### 📝 Description
Update inbox or pod subscriptions, or replace the webhook's `event_types` in full when you pass a non-empty `event_types` array (see request field docs). Inbox and pod changes use add/remove lists. **CLI:** ```bash agentmail webhooks update --webhook-id --add-inbox-ids ```
#### 🔌 Usage
```typescript await client.webhooks.update("webhook_id", {}); ```
#### ⚙️ Parameters
**webhook_id:** `AgentMail.WebhookId`
**request:** `AgentMail.UpdateWebhookRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.webhooks.updateHeaders(webhook_id, { ...params }) -> void
#### 📝 Description
Atomically set, replace, or remove custom HTTP headers included with deliveries to this webhook. Header values remain write-only.
#### 🔌 Usage
```typescript await client.webhooks.updateHeaders("webhook_id", {}); ```
#### ⚙️ Parameters
**webhook_id:** `AgentMail.WebhookId`
**request:** `AgentMail.UpdateWebhookHeadersRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.webhooks.delete(webhook_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail webhooks delete --webhook-id ```
#### 🔌 Usage
```typescript await client.webhooks.delete("webhook_id"); ```
#### ⚙️ Parameters
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
## Accounts
client.accounts.list({ ...params }) -> AgentMail.ListAccountsResponse
#### 📝 Description
Lists accounts across all apps, scoped to the API key: an organization key sees every account, a pod key its pod's, an inbox key its inbox's. Requires `inbox_read`.
#### 🔌 Usage
```typescript await client.accounts.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.ListAccountsRequest`
**requestOptions:** `AccountsClient.RequestOptions`
client.accounts.get(account_id) -> AgentMail.Account
#### 📝 Description
Returns one account by ID. An account outside the key's scope is a 404. Requires `inbox_read`.
#### 🔌 Usage
```typescript await client.accounts.get("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); ```
#### ⚙️ Parameters
**account_id:** `AgentMail.AccountId`
**requestOptions:** `AccountsClient.RequestOptions`
client.accounts.update(account_id, { ...params }) -> AgentMail.Account
#### 📝 Description
Updates one account. Set `status` to `disabled` to stop the inbox from signing in at the app again, or to `enabled` to re-enable it. Idempotent: disabling an already disabled account keeps its original `disabled_at`, and enabling an enabled account is a no-op. Find the `account_id` with List Accounts. An account exists only after an inbox's first sign-in at an app, so it cannot be disabled in advance. A disable applies to that inbox at that app whichever sign-in key is used: the app's next authorization ends in `access_denied`, and a code issued earlier is refused with `invalid_grant`. Access tokens already issued stay valid until they expire, and the app's own session is unaffected. Requires `account_update`, which sign-in keys (`type: public_key`) cannot hold, so call this with a bearer API key. An account outside the key's scope is a 404. A 409 means the account changed during the write; read it again and retry.
#### 🔌 Usage
```typescript await client.accounts.update("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", {}); ```
#### ⚙️ Parameters
**account_id:** `AgentMail.AccountId`
**request:** `AgentMail.UpdateAccountRequest`
**requestOptions:** `AccountsClient.RequestOptions`
## Agent
client.agent.signUp({ ...params }) -> AgentMail.AgentSignupResponse
#### 📝 Description
Create a new agent organization with an inbox and API key. This endpoint is for signing up for the first time. If you've already signed up, you're all set — just use your existing API key. A 6-digit OTP is sent to the human's email for verification. The new organization starts with 1 inbox, no custom domains, and 10 emails per day, which can be sent only to `human_email` until the organization is verified. `human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint or, for a US-region inbox, claims it in the AgentMail Console with the API key (see [How do I claim my agent's inbox?](https://docs.agentmail.to/knowledge-base/claiming-agent-inbox)). There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox. This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired. The returned API key has limited permissions until the organization is verified via the verify endpoint. **CLI:** ```bash agentmail agent sign-up --human-email user@example.com --username my-agent ```
#### 🔌 Usage
```typescript await client.agent.signUp({ username: "username" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.AgentSignupRequest`
**requestOptions:** `AgentClient.RequestOptions`
client.agent.attachHuman({ ...params }) -> AgentMail.AgentAttachHumanResponse
#### 📝 Description
Attach a human to an unverified agent organization. A 6-digit OTP is sent to the human's email, which you then submit to the verify endpoint. Use it after signing up without a `human_email`. Once the human is attached, the organization can send email to that human only, and verification lifts the remaining restrictions. For up to 5 minutes after attaching, sends to the human can still be rejected with a `429` daily send limit error while the API key's cached limits catch up. Wait and retry. Calling it again with the same `human_email` does not rotate the API key. It resends the OTP if it was never delivered, or issues a new one if it expired. While the current OTP is still valid, calling it again keeps that OTP and its attempt count. If all 10 attempts are used up, wait until the OTP expires, 24 hours after it was issued, then call it again for a new one. Calling it with a different `human_email` replaces the attached human and sends the new human an OTP. An organization can replace its human at most 2 times. Only available until the organization is verified. **CLI:** ```bash agentmail agent attach-human --human-email user@example.com ```
#### 🔌 Usage
```typescript await client.agent.attachHuman({ humanEmail: "human_email" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.AgentAttachHumanRequest`
**requestOptions:** `AgentClient.RequestOptions`
client.agent.verify({ ...params }) -> AgentMail.AgentVerifyResponse
#### 📝 Description
Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up. On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and the Free plan's entitlements are applied: 3 inboxes and 100 emails per day, at first to at most 3 distinct recipients in the first hour, 5 in the first day, and 10 in the first week. The OTP expires after 24 hours and allows a maximum of 10 attempts. If the OTP expired, call the attach human endpoint with the same `human_email` to get a new one without rotating the API key. Once all 10 attempts are used, even the correct OTP is rejected, and attach human keeps returning the same OTP until it expires, so wait for it to expire before asking for a new one. An organization that signed up without a `human_email` has no OTP until a human is attached. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account. **CLI:** ```bash agentmail agent verify --otp-code 123456 ```
#### 🔌 Usage
```typescript await client.agent.verify({ otpCode: "otp_code" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.AgentVerifyRequest`
**requestOptions:** `AgentClient.RequestOptions`
## ApiKeys
client.apiKeys.list({ ...params }) -> AgentMail.ListApiKeysResponse
#### 📝 Description
Lists every credential, newest first. Filter one family with `type`. Page to token exhaustion: a page can be empty and still carry a `next_page_token`. **CLI:** ```bash agentmail api-keys list ```
#### 🔌 Usage
```typescript await client.apiKeys.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.ListApiKeysRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.apiKeys.get(api_key_id) -> AgentMail.ApiKey
#### 📝 Description
Returns one credential of any family. Public keys also resolve by `client_id`. Poll a sign-in key until `status` is `active`.
#### 🔌 Usage
```typescript await client.apiKeys.get("api_key_id"); ```
#### ⚙️ Parameters
**api_key_id:** `AgentMail.ApiKeyId`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.apiKeys.create({ ...params }) -> AgentMail.CreateApiKeyResult
#### 📝 Description
Creates a bearer key, or registers a public key when the body carries `public_key`. The route selects the scope. Bearer secrets are returned once. **CLI:** ```bash agentmail api-keys create --name "My Key" ```
#### 🔌 Usage
```typescript await client.apiKeys.create({}); ```
#### ⚙️ Parameters
**request:** `AgentMail.CreateApiKeyRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.apiKeys.update(api_key_id, { ...params }) -> AgentMail.ApiKey
#### 📝 Description
Renames a credential or changes its permissions. Public keys also resolve by `client_id`; a sign-in key accepts only `app_connect` and `app_share_owner`.
#### 🔌 Usage
```typescript await client.apiKeys.update("api_key_id", {}); ```
#### ⚙️ Parameters
**api_key_id:** `AgentMail.ApiKeyId`
**request:** `AgentMail.UpdateApiKeyRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.apiKeys.delete(api_key_id) -> void
#### 📝 Description
Deletes one credential of any family. A pending sign-in key is cancelled; an active one is revoked. Public keys also resolve by `client_id`. **CLI:** ```bash agentmail api-keys delete --api-key-id ```
#### 🔌 Usage
```typescript await client.apiKeys.delete("api_key_id"); ```
#### ⚙️ Parameters
**api_key_id:** `AgentMail.ApiKeyId`
**requestOptions:** `ApiKeysClient.RequestOptions`
## Apps
client.apps.list({ ...params }) -> AgentMail.ListAppsResponse
#### 📝 Description
Lists apps, most popular first.
#### 🔌 Usage
```typescript await client.apps.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.ListAppsRequest`
**requestOptions:** `AppsClient.RequestOptions`
client.apps.search({ ...params }) -> AgentMail.SearchAppsResponse
#### 📝 Description
Searches apps by name prefix.
#### 🔌 Usage
```typescript await client.apps.search({ q: "q" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.SearchAppsRequest`
**requestOptions:** `AppsClient.RequestOptions`
client.apps.get(app_id) -> AgentMail.App
#### 📝 Description
Gets one app by ID or slug. A catalog app returns its full entry. A registered app that the catalog does not list returns its ID and name only, without `updated_at`, so anyone holding its ID can still look it up; a slug finds catalog apps only. List Apps and Search Apps show catalog entries only.
#### 🔌 Usage
```typescript await client.apps.get("app_id"); ```
#### ⚙️ Parameters
**app_id:** `string` — ID of app, or the `slug` of an app in the catalog. A slug ignores case, spaces and punctuation.
**requestOptions:** `AppsClient.RequestOptions`
client.apps.listAccounts(app_id, { ...params }) -> AgentMail.ListAppAccountsResponse
#### 📝 Description
Lists accounts at one app, most recent sign-in first.
#### 🔌 Usage
```typescript await client.apps.listAccounts("app_id"); ```
#### ⚙️ Parameters
**app_id:** `string` — ID of app, or the `slug` of an app in the catalog. A slug ignores case, spaces and punctuation.
**request:** `AgentMail.ListAppAccountsRequest`
**requestOptions:** `AppsClient.RequestOptions`
client.apps.connect(app_id, { ...params }) -> AgentMail.ConnectAccepted
#### 📝 Description
Starts signing an inbox in to an app. Returns a single-use `magic_url`, valid for five minutes, to open in the client that will hold the sign-in; the client enrolls as the inbox and continues to the app. An app in the catalog can be named by its `slug`, as in `POST /v0/apps/firecrawl/connect`. A `404` names the missing resource: `App` or `Inbox`. A `403` `AppSignupLimitError` means the app accepts no more sign-ups from your organization; sign in with an inbox that already has an account there.
#### 🔌 Usage
```typescript await client.apps.connect("app_id", undefined); ```
#### ⚙️ Parameters
**app_id:** `string` — ID of app, or the `slug` of an app in the catalog. A slug ignores case, spaces and punctuation.
**request:** `AgentMail.ConnectAppBody`
**requestOptions:** `AppsClient.RequestOptions`
## Auth
client.auth.me() -> AgentMail.Identity
#### 📝 Description
Returns the identity and scope of the authenticated credential. Useful when a client holds a pod-scoped or inbox-scoped API key and needs to discover the parent organization, pod, or inbox without prior knowledge. **CLI:** ```bash agentmail auth me ```
#### 🔌 Usage
```typescript await client.auth.me(); ```
#### ⚙️ Parameters
**requestOptions:** `AuthClient.RequestOptions`
## Domains
client.domains.list({ ...params }) -> AgentMail.ListDomainsResponse
#### 📝 Description
**CLI:** ```bash agentmail domains list ```
#### 🔌 Usage
```typescript await client.domains.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.ListDomainsRequest`
**requestOptions:** `DomainsClient.RequestOptions`
client.domains.get(domain_id) -> AgentMail.Domain
#### 📝 Description
**CLI:** ```bash agentmail domains get --domain-id ```
#### 🔌 Usage
```typescript await client.domains.get("domain_id"); ```
#### ⚙️ Parameters
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
client.domains.getZoneFile(domain_id) -> core.BinaryResponse
#### 📝 Description
**CLI:** ```bash agentmail domains get-zone-file --domain-id ```
#### 🔌 Usage
```typescript await client.domains.getZoneFile("domain_id"); ```
#### ⚙️ Parameters
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
client.domains.create({ ...params }) -> AgentMail.Domain
#### 📝 Description
**CLI:** ```bash agentmail domains create --domain example.com ```
#### 🔌 Usage
```typescript await client.domains.create({ domain: "domain" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.CreateDomainRequest`
**requestOptions:** `DomainsClient.RequestOptions`
client.domains.update(domain_id, { ...params }) -> AgentMail.Domain
#### 📝 Description
**CLI:** ```bash agentmail domains update --domain-id ```
#### 🔌 Usage
```typescript await client.domains.update("domain_id", {}); ```
#### ⚙️ Parameters
**domain_id:** `AgentMail.DomainId`
**request:** `AgentMail.UpdateDomainRequest`
**requestOptions:** `DomainsClient.RequestOptions`
client.domains.delete(domain_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail domains delete --domain-id ```
#### 🔌 Usage
```typescript await client.domains.delete("domain_id"); ```
#### ⚙️ Parameters
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
client.domains.verify(domain_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail domains verify --domain-id ```
#### 🔌 Usage
```typescript await client.domains.verify("domain_id"); ```
#### ⚙️ Parameters
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
client.domains.getSetupLink(domain_id) -> AgentMail.GetSetupLinkResponse
#### 📝 Description
Build a one-click DNS setup link for the domain via the Domain Connect standard. When the domain's DNS provider supports Domain Connect and carries the AgentMail template, the response contains a signed URL: opening it lets the domain owner approve the required DNS records at their provider, which writes them automatically — no copy-paste. When the provider does not support it, `supported` is `false` and the domain's `records` should be added manually instead.
#### 🔌 Usage
```typescript await client.domains.getSetupLink("domain_id"); ```
#### ⚙️ Parameters
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
## Drafts
client.drafts.list({ ...params }) -> AgentMail.ListDraftsResponse
#### 📝 Description
**CLI:** ```bash agentmail drafts list ```
#### 🔌 Usage
```typescript await client.drafts.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.ListDraftsRequest`
**requestOptions:** `DraftsClient.RequestOptions`
client.drafts.get(draft_id) -> AgentMail.Draft
#### 📝 Description
**CLI:** ```bash agentmail drafts get --draft-id ```
#### 🔌 Usage
```typescript await client.drafts.get("draft_id"); ```
#### ⚙️ Parameters
**draft_id:** `AgentMail.DraftId`
**requestOptions:** `DraftsClient.RequestOptions`
client.drafts.getAttachment(draft_id, attachment_id) -> AgentMail.AttachmentResponse
#### 📝 Description
**CLI:** ```bash agentmail drafts get-attachment --draft-id --attachment-id ```
#### 🔌 Usage
```typescript await client.drafts.getAttachment("draft_id", "attachment_id"); ```
#### ⚙️ Parameters
**draft_id:** `AgentMail.DraftId`
**attachment_id:** `AgentMail.AttachmentId`
**requestOptions:** `DraftsClient.RequestOptions`
## Forwarding
client.forwarding.get() -> AgentMail.Forwarding
#### 📝 Description
Get the forwarding the organization sets. Pods and inboxes that set no forwarding of their own use this list. Needs an organization-scoped API key. **CLI:** ```bash agentmail forwarding get ```
#### 🔌 Usage
```typescript await client.forwarding.get(); ```
#### ⚙️ Parameters
**requestOptions:** `ForwardingClient.RequestOptions`
client.forwarding.update({ ...params }) -> AgentMail.UpdateForwardingResponse
#### 📝 Description
Set the addresses the organization forwards to. The list replaces the current one. An address that is not verified is saved but receives nothing until it is verified. Needs an organization-scoped API key in an organization that has completed agent verification. **CLI:** ```bash agentmail forwarding update --destinations ops@example.com --destinations archive@example.com ```
#### 🔌 Usage
```typescript await client.forwarding.update({ destinations: ["destinations", "destinations"] }); ```
#### ⚙️ Parameters
**request:** `AgentMail.UpdateForwardingRequest`
**requestOptions:** `ForwardingClient.RequestOptions`
client.forwarding.delete() -> AgentMail.Forwarding
#### 📝 Description
Remove the organization's forwarding, so its inboxes stop forwarding unless their pod or the inbox sets its own. Verified addresses stay verified, so adding one again needs no new code. Returns `not_found` when the organization sets no forwarding. **CLI:** ```bash agentmail forwarding delete ```
#### 🔌 Usage
```typescript await client.forwarding.delete(); ```
#### ⚙️ Parameters
**requestOptions:** `ForwardingClient.RequestOptions`
client.forwarding.startVerification({ ...params }) -> AgentMail.ForwardingVerificationStarted
#### 📝 Description
Email a confirmation code to an address, so it can receive forwarded mail once confirmed. Verification belongs to the organization: once verified, the address can be used at the organization, any pod and any inbox. Starting again replaces any code already sent to the address. Needs an organization- or pod-scoped API key in an organization that has completed agent verification. **CLI:** ```bash agentmail forwarding start-verification --destination ops@example.com ```
#### 🔌 Usage
```typescript await client.forwarding.startVerification({ destination: "destination" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.StartForwardingVerificationRequest`
**requestOptions:** `ForwardingClient.RequestOptions`
client.forwarding.confirmVerification({ ...params }) -> AgentMail.ForwardingVerificationConfirmed
#### 📝 Description
Submit the code emailed by Start Verification to verify the address. A code allows 10 wrong attempts, then stops working even with the right code, and Start Verification sends a new one. Needs an organization- or pod-scoped API key in an organization that has completed agent verification. **CLI:** ```bash agentmail forwarding confirm-verification --destination ops@example.com --code 7KQ2M-XW9PD ```
#### 🔌 Usage
```typescript await client.forwarding.confirmVerification({ destination: "destination", code: "code" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.ConfirmForwardingVerificationRequest`
**requestOptions:** `ForwardingClient.RequestOptions`
## Inboxes Accounts
client.inboxes.accounts.list(inbox_id, { ...params }) -> AgentMail.ListAccountsResponse
#### 📝 Description
Lists accounts held by the inbox, across all apps. Requires `inbox_read`.
#### 🔌 Usage
```typescript await client.inboxes.accounts.list("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.ListAccountsRequest`
**requestOptions:** `AccountsClient.RequestOptions`
client.inboxes.accounts.get(inbox_id, account_id) -> AgentMail.Account
#### 📝 Description
Returns one account held by the inbox. An account elsewhere is a 404. Requires `inbox_read`.
#### 🔌 Usage
```typescript await client.inboxes.accounts.get("inbox_id", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**account_id:** `AgentMail.AccountId`
**requestOptions:** `AccountsClient.RequestOptions`
## Inboxes ApiKeys
client.inboxes.apiKeys.list(inbox_id, { ...params }) -> AgentMail.ListApiKeysResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes api-keys list --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.apiKeys.list("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.ListApiKeysRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.inboxes.apiKeys.create(inbox_id, { ...params }) -> AgentMail.CreateApiKeyResult
#### 📝 Description
**CLI:** ```bash agentmail inboxes api-keys create --inbox-id --name "My Key" ```
#### 🔌 Usage
```typescript await client.inboxes.apiKeys.create("inbox_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.CreateApiKeyRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.inboxes.apiKeys.update(inbox_id, api_key_id, { ...params }) -> AgentMail.ApiKey
#### 📝 Description
**CLI:** ```bash agentmail inboxes api-keys update --inbox-id --api-key-id --name "Renamed" ```
#### 🔌 Usage
```typescript await client.inboxes.apiKeys.update("inbox_id", "api_key_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**api_key_id:** `AgentMail.ApiKeyId`
**request:** `AgentMail.UpdateApiKeyRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.inboxes.apiKeys.delete(inbox_id, api_key_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail inboxes api-keys delete --inbox-id --api-key-id ```
#### 🔌 Usage
```typescript await client.inboxes.apiKeys.delete("inbox_id", "api_key_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**api_key_id:** `AgentMail.ApiKeyId`
**requestOptions:** `ApiKeysClient.RequestOptions`
## Inboxes Calendar
client.inboxes.calendar.get(inbox_id, { ...params }) -> AgentMail.Calendar
#### 📝 Description
Gets the inbox's calendar. Every inbox has one calendar, so this works before any event is created. Its `etag` (also the `ETag` response header) is the value to send in `If-Match` to make an update conditional. Requires the `calendar_read` permission. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.get("scheduler@agentmail.to"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.GetCalendarRequest`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.update(inbox_id, { ...params }) -> AgentMail.Calendar
#### 📝 Description
Updates the calendar's default time zone. Existing events keep their own `timezone`; only events created later without a `timezone` use the new default. Requires the `calendar_update` permission. To make the update conditional, send the calendar's current `etag` in `If-Match`: a stale value returns `412`. Without `If-Match` the update applies to the calendar as it is. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.update("scheduler@agentmail.to", { timezone: "America/New_York" }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.UpdateCalendarRequestWrapper`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.listEvents(inbox_id, { ...params }) -> AgentMail.ListCalendarEventsResponse
#### 📝 Description
Lists the events stored on the calendar: one item per one-off or recurring event, plus one item for each edited date of a recurring event (as that dated event, with `is_exception: true`). Ordered by most recently updated, and cancelled events are included. Use it to sync or manage what you created. To see what is on the calendar in a time window, use Get Agenda. The list is always read in the region that serves the request, so it can trail a change made moments earlier by a few seconds. Requires the `calendar_event_read` permission. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.listEvents("scheduler@agentmail.to", { limit: 50 }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.ListCalendarEventsRequest`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.getAgenda(inbox_id, { ...params }) -> AgentMail.ListCalendarEventsResponse
#### 📝 Description
Lists every date on the calendar in a time window, ordered by start time: one-off events, and recurring events expanded into their individual dates, with cancelled dates left out. Use it to answer "what is on the calendar". The window defaults to now through 90 days from now and can be at most 366 days. Items omit `description`, `metadata` and `attendees`; get an event by ID for the full object. An item the inbox is invited to still carries `response_status`, so `needs_action` marks an invitation waiting for a reply. Dates of recurring events appear only up to about 90 days from now; use List Event Instances for a recurring event's later dates. While a recurring event's dates are being regenerated after a schedule change, which takes a few seconds, the agenda can briefly leave out some of them; dates that have already started or ended stay as they ran. The agenda is read in the region that serves the request, so it can trail a change made moments earlier by a few seconds. Pass `consistency=primary` to read your own change right away. Requires the `calendar_event_read` permission. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.getAgenda("scheduler@agentmail.to", { after: new Date("2026-10-07T00:00:00.000Z"), before: new Date("2026-10-16T00:00:00.000Z"), limit: 3 }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.GetCalendarAgendaRequest`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.createEvent(inbox_id, { ...params }) -> AgentMail.CalendarEventMutationResponse
#### 📝 Description
Creates a one-off or recurring event on the inbox's calendar. Times are wall-clock values in `timezone` (the calendar's default time zone if omitted); the response also gives each boundary as a UTC instant in `start_at` and `end_at`. `calendar.event.created` is sent once the event is stored, then `calendar.event.starting` and `calendar.event.ending` as each date begins and ends. With `send_invites: true` the inbox also emails an invitation to every attendee. Pass `client_id` to make retries safe: repeating the request with the same `client_id` and body returns the original event with status `200` instead of `201`, for as long as the event exists. With `send_invites: true`, each attendee counts as one send against the organization, pod and inbox send limits, charged before the event is stored. An over-limit request returns `429` `rate_limit_exceeded` and creates nothing. A replay of an earlier create is not charged again. The event's `etag` is the value to send in `If-Match` to make a later update or delete conditional. Requires the `calendar_event_create` permission. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.createEvent("scheduler@agentmail.to", { clientId: "intro-acme-2026-10-15", title: "Intro call with Acme", description: "Walk Jane through the onboarding plan.", location: "https://meet.example.com/acme-intro", metadata: { "crm_deal_id": "D-1042" }, start: "2026-10-15T14:00:00", end: "2026-10-15T14:30:00", timezone: "America/New_York", attendees: [{ email: "jane@acme.com", name: "Jane Doe" }], sendInvites: true }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.CreateCalendarEventRequest`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.getEvent(inbox_id, event_id, { ...params }) -> AgentMail.CalendarEvent
#### 📝 Description
Gets an event by its UUID, or one date of a recurring event by its dated ID (`_`). A dated ID returns the date as it currently stands, including any edit to it, with `kind: instance`. The response's `etag` (also the `ETag` header) is the value to send in `If-Match` to make an update, delete or response to this event or date conditional. Treat it as opaque. Reads can trail a change made moments earlier by a few seconds; pass `consistency=primary` to read the latest state of an event or a date. A date that has already started or ended reads back as it ran, even if a later change to the series no longer produces it. Requires the `calendar_event_read` permission. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.getEvent("scheduler@agentmail.to", "3f8a2c1e-6b4d-4e9f-a7c2-5d1b8e0f9a36"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**event_id:** `AgentMail.CalendarEventId`
**request:** `AgentMail.inboxes.GetCalendarEventRequest`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.updateEvent(inbox_id, event_id, { ...params }) -> AgentMail.CalendarEventMutationResponse
#### 📝 Description
Updates an event. Send only the fields to change. To make the update conditional, send the event's current `etag` in `If-Match`: a stale value returns `412`. Without `If-Match` the update applies to the event as it is; a change that lands while it runs returns `409` `race_condition`, so retry. Send `If-Match` when replacing `attendees`, so you don't overwrite a response that arrived in the meantime. - **One-off or series UUID:** changes the event itself. For a series, the change applies to every date that has not been edited individually. - **Dated ID (`_`):** changes one date (`mode=single`, the default) or that date and every later date (`mode=future`). `all_day`, `timezone` and `recurrence` cannot be sent for a dated ID. Once a date has started, its start can no longer change (409 `event_already_started`), but its end and status can; for a one-off or series UUID, send the unchanged `start` with the new `end`. Once it has ended, only `title`, `description`, `location`, `metadata` and `attendees` can change. During the few seconds a date is starting, schedule changes return 409 `event_starting`; retry shortly. Sends `calendar.event.updated`. With `send_invites: true` the organizer inbox also emails the updated invitation to every attendee. Requires the `calendar_event_update` permission. Emailing attendees counts one send per attendee against the organization, pod and inbox send limits, charged before the change is saved; an over-limit request returns `429` `rate_limit_exceeded` and changes nothing. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.updateEvent("scheduler@agentmail.to", "3f8a2c1e-6b4d-4e9f-a7c2-5d1b8e0f9a36", { start: "2026-10-15T15:00:00", end: "2026-10-15T15:30:00", sendInvites: true }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**event_id:** `AgentMail.CalendarEventId`
**request:** `AgentMail.inboxes.UpdateCalendarEventRequestWrapper`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.deleteEvent(inbox_id, event_id, { ...params }) -> AgentMail.DeleteCalendarEventResponse
#### 📝 Description
Deletes an event, or cancels dates of a recurring event. - **One-off or series UUID:** deletes the event and every date of it. The event disappears from reads immediately and is removed in the background; the response is `202` with a `deletion_id`. A retry returns the same `deletion_id` while removal runs (send the same `Idempotency-Key`, or none and the same `send_invites`); once it has finished, the event no longer exists and a retry returns `404`. No `calendar.event.starting` or `calendar.event.ending` webhook is sent for the event after the delete is accepted. - **Dated ID (`_`):** cancels that date (`mode=single`, the default) or that date and every later date (`mode=future`). Returns `202` with the cancelled date. A `mode=future` delete from the first date deletes the whole series and returns a `deletion_id` instead. A date that is already running still gets its `calendar.event.ending`. Deleting a one-off or series event sends `calendar.event.deleted`. Cancelling dates sends `calendar.event.updated` with the cancelled date. With `send_invites=true` the organizer inbox also emails a cancellation to every attendee. Requires the `calendar_event_delete` permission. To make the delete conditional, send the current `etag` in `If-Match`. Emailing cancellations counts one send per attendee against the organization, pod and inbox send limits, charged before the delete; an over-limit request returns `429` `rate_limit_exceeded` and deletes nothing. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.deleteEvent("scheduler@agentmail.to", "3f8a2c1e-6b4d-4e9f-a7c2-5d1b8e0f9a36", { idempotencyKey: "delete-intro-acme", sendInvites: true }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**event_id:** `AgentMail.CalendarEventId`
**request:** `AgentMail.inboxes.DeleteCalendarEventRequest`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.listEventInstances(inbox_id, event_id, { ...params }) -> AgentMail.ListCalendarEventsResponse
#### 📝 Description
Lists the dates of one recurring event in a time window, in start order, with each date's edits applied. Dates are computed from the rule, so this works for any window up to 366 days, including dates far in the future. Cancelled dates are left out. The window defaults to now through 90 days from now. Items omit `description`, `metadata` and `attendees`; get a date by its ID for the full object. Like other reads, the list can trail a change made moments earlier by a few seconds; pass `consistency=primary` to read your own change right away. Requires the `calendar_event_read` permission. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.listEventInstances("scheduler@agentmail.to", "7c4e9b2a-1f3d-4a8e-b6c5-2e9d0f1a8b47", { after: new Date("2026-10-05T00:00:00.000Z"), before: new Date("2026-10-10T00:00:00.000Z") }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**event_id:** `string` — UUID of the recurring event.
**request:** `AgentMail.inboxes.ListCalendarEventInstancesRequest`
**requestOptions:** `CalendarClient.RequestOptions`
client.inboxes.calendar.respondToEvent(inbox_id, event_id, { ...params }) -> AgentMail.CalendarEventMutationResponse
#### 📝 Description
Accepts, declines or tentatively accepts an invitation the inbox received by email. Pass the event's UUID to respond for every date, or a dated ID to respond for one date only. Only works on `email` events where the inbox is an attendee; anything else returns 409 `calendar_response_invalid`. Updates the inbox's attendee entry and sends `calendar.event.responded`. With `send_reply` (default `true`) the inbox emails the response to the organizer. Requires the `calendar_event_update` permission. To make the response conditional, send the current `etag` in `If-Match`. A reply email counts as one send against the organization, pod and inbox send limits, charged before the response is saved; an over-limit request returns `429` `rate_limit_exceeded` and changes nothing. Calendar is available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`), which returns `403`.
#### 🔌 Usage
```typescript await client.inboxes.calendar.respondToEvent("scheduler@agentmail.to", "a1d5c7e9-2b4f-4c6a-9e8d-3f7b1c5a9d20", { status: "accepted", comment: "See you there." }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**event_id:** `AgentMail.CalendarEventId`
**request:** `AgentMail.inboxes.RespondCalendarEventRequestWrapper`
**requestOptions:** `CalendarClient.RequestOptions`
## Inboxes Drafts
client.inboxes.drafts.list(inbox_id, { ...params }) -> AgentMail.ListDraftsResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes drafts list --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.drafts.list("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.ListDraftsRequest`
**requestOptions:** `DraftsClient.RequestOptions`
client.inboxes.drafts.get(inbox_id, draft_id) -> AgentMail.Draft
#### 📝 Description
**CLI:** ```bash agentmail inboxes drafts get --inbox-id --draft-id ```
#### 🔌 Usage
```typescript await client.inboxes.drafts.get("inbox_id", "draft_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**draft_id:** `AgentMail.DraftId`
**requestOptions:** `DraftsClient.RequestOptions`
client.inboxes.drafts.getAttachment(inbox_id, draft_id, attachment_id) -> AgentMail.AttachmentResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes drafts get-attachment --inbox-id --draft-id --attachment-id ```
#### 🔌 Usage
```typescript await client.inboxes.drafts.getAttachment("inbox_id", "draft_id", "attachment_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**draft_id:** `AgentMail.DraftId`
**attachment_id:** `AgentMail.AttachmentId`
**requestOptions:** `DraftsClient.RequestOptions`
client.inboxes.drafts.create(inbox_id, { ...params }) -> AgentMail.Draft
#### 📝 Description
Create a draft. Supply `in_reply_to` to create a reply draft (with `reply_all` to address the whole thread), whose recipients, subject, and threading are derived from the referenced message, or `forward_of` to create a forward draft, which derives the subject, threading, and forwarded content from the source but keeps recipients caller-supplied. **CLI:** ```bash agentmail inboxes drafts create --inbox-id --to recipient@example.com --subject "Draft subject" --text "Draft body" ```
#### 🔌 Usage
```typescript await client.inboxes.drafts.create("inbox_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.CreateDraftRequest`
**requestOptions:** `DraftsClient.RequestOptions`
client.inboxes.drafts.update(inbox_id, draft_id, { ...params }) -> AgentMail.Draft
#### 📝 Description
Edit fields on an existing draft. Passing `null` clears a field (or `[]` for a recipient field); `send_at: null` un-schedules a scheduled draft. A draft that is already being sent cannot be edited. **CLI:** ```bash agentmail inboxes drafts update --inbox-id --draft-id --subject "Updated subject" ```
#### 🔌 Usage
```typescript await client.inboxes.drafts.update("inbox_id", "draft_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**draft_id:** `AgentMail.DraftId`
**request:** `AgentMail.UpdateDraftRequest`
**requestOptions:** `DraftsClient.RequestOptions`
client.inboxes.drafts.delete(inbox_id, draft_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail inboxes drafts delete --inbox-id --draft-id ```
#### 🔌 Usage
```typescript await client.inboxes.drafts.delete("inbox_id", "draft_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**draft_id:** `AgentMail.DraftId`
**requestOptions:** `DraftsClient.RequestOptions`
client.inboxes.drafts.send(inbox_id, draft_id, { ...params }) -> AgentMail.SendMessageResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes drafts send --inbox-id --draft-id ```
#### 🔌 Usage
```typescript await client.inboxes.drafts.send("inbox_id", "draft_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**draft_id:** `AgentMail.DraftId`
**request:** `AgentMail.UpdateMessageRequest`
**requestOptions:** `DraftsClient.IdempotentRequestOptions`
## Inboxes Events
client.inboxes.events.list(inbox_id, { ...params }) -> AgentMail.ListInboxEventsResponse
#### 📝 Description
List label change events for an inbox. Returns events in reverse chronological order by default. Use for IMAP UID projection or audit logging. **CLI:** ```bash agentmail inboxes events list --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.events.list("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.ListInboxEventsRequest`
**requestOptions:** `EventsClient.RequestOptions`
## Inboxes Files
client.inboxes.files.create(inbox_id, { ...params }) -> AgentMail.CreateFileResponse
#### 📝 Description
Starts an upload: creates a pending file at `path` and returns an `upload` to `PUT` its bytes to. The bytes go straight to storage, not through the API. Then call Complete File to make the file `ready`. Retry-safe: sending the identical request again (same `path`, `size`, `sha256`, `content_type` and `expires_at`) returns the existing file with `200` instead of `201`: a pending one with a fresh `upload`, or a `ready` one without. If its bytes were uploaded but the upload was never completed, it is completed then. A different request at a path whose file is still pending and has no bytes replaces that file; at any other taken path it returns `409`. The file counts against the organization's Drive quota from creation, pending or not: 1 GiB and 10,000 files by default. A file that doesn't fit returns `403` with code `limit_exceeded`. Deleting a file frees its space within seconds. Expired files count until a create needs their space: a create that doesn't fit first gives back what expired files hold, a batch at a time, so retry a refusal while many expired files remain. Requires the `file_create` permission, which an unverified organization's keys don't have at any scope until it completes agent verification. A key without `file_read` can still create files, but gets the plain `409` at any taken path, even for an identical request at a file it didn't create. Agent Drive is in AgentMail Labs, available in US production (`api.agentmail.to`) but not yet in EU production (`api.agentmail.eu`). Organizations that have not joined Labs receive a `403`.
#### 🔌 Usage
```typescript await client.inboxes.files.create("reports@agentmail.to", { path: "reports/q3.pdf", size: 48213, sha256: "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=", contentType: "application/pdf" }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.CreateFileRequestWrapper`
**requestOptions:** `FilesClient.RequestOptions`
client.inboxes.files.complete(inbox_id, file_id) -> AgentMail.File_
#### 📝 Description
Makes a pending file `ready` once its bytes are uploaded, and returns it, with its `download_url` if the key has `file_read`. Calling it on a file that is already `ready` returns the file. Returns `409` if the bytes haven't been uploaded yet, or if what was uploaded doesn't match the file's `size` and `sha256`. Returns `404` for a file that has expired or was deleted, including a pending file not completed within a day of its creation. Requires the `file_create` permission. Only a key with `file_read`, or the key that created the file, can complete it; any other key gets `404`.
#### 🔌 Usage
```typescript await client.inboxes.files.complete("reports@agentmail.to", "6f1c2f4e-8d3b-4a5e-9c7d-1b2a3c4d5e6f"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**file_id:** `AgentMail.FileId`
**requestOptions:** `FilesClient.RequestOptions`
client.inboxes.files.get(inbox_id, file_id) -> AgentMail.File_
#### 📝 Description
Gets a file. A `ready` file comes with a fresh `download_url`, valid for up to an hour. A get reads the region that serves the request, so for about a second after a delete it can still return the deleted file. A file that has expired returns `404` at once. Requires the `file_read` permission.
#### 🔌 Usage
```typescript await client.inboxes.files.get("reports@agentmail.to", "6f1c2f4e-8d3b-4a5e-9c7d-1b2a3c4d5e6f"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**file_id:** `AgentMail.FileId`
**requestOptions:** `FilesClient.RequestOptions`
client.inboxes.files.list(inbox_id, { ...params }) -> AgentMail.ListFilesResponse
#### 📝 Description
Lists the inbox's files in path order, pending ones included, optionally only those whose path starts with `path_prefix`. A prefix matches characters, not whole segments: `reports/q` matches `reports/q3.pdf`. Items carry no download URL; get a file for one. The list is read in the region that serves the request, so a file created or deleted a moment ago may not show yet. Expired files never show. Requires the `file_read` permission.
#### 🔌 Usage
```typescript await client.inboxes.files.list("reports@agentmail.to", { pathPrefix: "reports/" }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.ListFilesRequest`
**requestOptions:** `FilesClient.RequestOptions`
client.inboxes.files.delete(inbox_id, file_id) -> void
#### 📝 Description
Deletes a file, pending or `ready`, and frees its path at once. Its bytes are deleted, and its space given back to the organization's quota, within seconds. A download URL signed before the delete keeps working until it expires, at most an hour. Deleting a file that is already gone returns `404`. Requires the `file_delete` permission. Only a key with `file_read`, or the key that created the file, can delete it; any other key gets `404`.
#### 🔌 Usage
```typescript await client.inboxes.files.delete("reports@agentmail.to", "6f1c2f4e-8d3b-4a5e-9c7d-1b2a3c4d5e6f"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**file_id:** `AgentMail.FileId`
**requestOptions:** `FilesClient.RequestOptions`
## Inboxes Forwarding
client.inboxes.forwarding.get(inbox_id) -> AgentMail.Forwarding
#### 📝 Description
Get the forwarding this inbox sets. When the inbox sets nothing, `destinations` is `null` and the inbox uses its pod's forwarding, or the organization's when the pod sets none. **CLI:** ```bash agentmail inboxes forwarding get --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.forwarding.get("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**requestOptions:** `ForwardingClient.RequestOptions`
client.inboxes.forwarding.update(inbox_id, { ...params }) -> AgentMail.UpdateForwardingResponse
#### 📝 Description
Set the addresses this inbox forwards to. The list replaces the inbox's current one and any pod or organization list for this inbox; lists are never combined. Send an empty list to stop this inbox forwarding even when its pod or the organization forwards. An address that is not verified is saved but receives nothing until it is verified. **CLI:** ```bash agentmail inboxes forwarding update --inbox-id --destinations ops@example.com ```
#### 🔌 Usage
```typescript await client.inboxes.forwarding.update("inbox_id", { destinations: ["destinations", "destinations"] }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.UpdateForwardingRequest`
**requestOptions:** `ForwardingClient.RequestOptions`
client.inboxes.forwarding.delete(inbox_id) -> AgentMail.Forwarding
#### 📝 Description
Remove this inbox's own forwarding, so the inbox uses its pod's or the organization's forwarding again. Verified addresses stay verified. Returns `not_found` when the inbox sets no forwarding. **CLI:** ```bash agentmail inboxes forwarding delete --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.forwarding.delete("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**requestOptions:** `ForwardingClient.RequestOptions`
## Inboxes Lists
client.inboxes.lists.list(inbox_id, direction, type, { ...params }) -> AgentMail.PodListListEntriesResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes lists list --inbox-id --direction --type ```
#### 🔌 Usage
```typescript await client.inboxes.lists.list("inbox_id", "send", "allow"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**request:** `AgentMail.inboxes.InboxListListEntriesRequest`
**requestOptions:** `ListsClient.RequestOptions`
client.inboxes.lists.get(inbox_id, direction, type, entry) -> AgentMail.PodListEntry
#### 📝 Description
**CLI:** ```bash agentmail inboxes lists get --inbox-id --direction --type --entry ```
#### 🔌 Usage
```typescript await client.inboxes.lists.get("inbox_id", "send", "allow", "entry"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**entry:** `string` — Email address or domain.
**requestOptions:** `ListsClient.RequestOptions`
client.inboxes.lists.create(inbox_id, direction, type, { ...params }) -> AgentMail.PodListEntry
#### 📝 Description
**CLI:** ```bash agentmail inboxes lists create --inbox-id --direction --type --entry user@example.com ```
#### 🔌 Usage
```typescript await client.inboxes.lists.create("inbox_id", "send", "allow", { entry: "entry" }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**request:** `AgentMail.CreateListEntryRequest`
**requestOptions:** `ListsClient.RequestOptions`
client.inboxes.lists.delete(inbox_id, direction, type, entry) -> void
#### 📝 Description
**CLI:** ```bash agentmail inboxes lists delete --inbox-id --direction --type --entry ```
#### 🔌 Usage
```typescript await client.inboxes.lists.delete("inbox_id", "send", "allow", "entry"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**entry:** `string` — Email address or domain.
**requestOptions:** `ListsClient.RequestOptions`
## Inboxes Messages
client.inboxes.messages.list(inbox_id, { ...params }) -> AgentMail.ListMessagesResponse
#### 📝 Description
Lists messages in the inbox, most recent first. Pass `from`, `to`, or `subject` to filter by substring. Filtered requests are served by search, which caps `limit` at 100. For relevance-ranked full-text search across sender, recipients, subject, and message body, use `Search Messages`. **CLI:** ```bash agentmail inboxes messages list --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.messages.list("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.ListMessagesRequest`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.search(inbox_id, { ...params }) -> AgentMail.SearchMessagesResponse
#### 📝 Description
Full-text search across messages in the inbox, ranked by relevance. The query is matched against the sender, recipients, and subject (substring) and the message body (tokenized full text). Spam, trash, blocked, and unauthenticated messages are always excluded. `limit` cannot exceed 100.
#### 🔌 Usage
```typescript await client.inboxes.messages.search("inbox_id", { q: "q" }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.SearchMessagesRequest`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.get(inbox_id, message_id) -> AgentMail.Message
#### 📝 Description
**CLI:** ```bash agentmail inboxes messages get --inbox-id --message-id ```
#### 🔌 Usage
```typescript await client.inboxes.messages.get("inbox_id", "message_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.createAgentArmorFeedback(inbox_id, message_id, { ...params }) -> AgentMail.AgentArmorFeedback
#### 📝 Description
Tell us whether Agent Armor's verdict on a message was right. The message needs a completed result. A message accepts up to 20 pieces of feedback. Requires permission to read the message.
#### 🔌 Usage
```typescript await client.inboxes.messages.createAgentArmorFeedback("inbox_id", "message_id", { feedback: "correct_review" }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**request:** `AgentMail.CreateAgentArmorFeedbackRequest`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.releaseAgentArmorMessage(inbox_id, message_id, { ...params }) -> AgentMail.ReleaseAgentArmorMessageResponse
#### 📝 Description
Release a message Agent Armor held for review in hold mode: your agents are sent its `message.received` event, `message.security.override` is sent too, in either order, and its `agent-armor-held` label is removed. Only a message whose verdict is `review` and that is still held can be released; anything else answers `409`. Repeating a release with the same reason and the same API key returns the first release; any other repeat answers `409`. Requires the opt-in `agent_armor_release` permission and permission to read the message. An organization admin can also release from the console.
#### 🔌 Usage
```typescript await client.inboxes.messages.releaseAgentArmorMessage("inbox_id", "message_id", { reason: "reason" }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**request:** `AgentMail.ReleaseAgentArmorMessageRequest`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.batchGet(inbox_id, { ...params }) -> AgentMail.BatchGetMessagesResponse
#### 📝 Description
Fetch metadata for up to 500 messages in one request. Missing or restricted IDs are silently omitted; compare `count` against `limit` to detect misses. **CLI:** ```bash agentmail inboxes messages batch-get --inbox-id --message-ids --message-ids ```
#### 🔌 Usage
```typescript await client.inboxes.messages.batchGet("inbox_id", { messageIds: ["message_ids", "message_ids"] }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.BatchGetMessagesRequest`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.batchUpdate(inbox_id, { ...params }) -> AgentMail.BatchUpdateMessagesResponse
#### 📝 Description
Apply one label change to up to 50 messages in a single request. The same add_labels and remove_labels apply to every message id, and at least one of them must be provided. The update is atomic: either all resolved messages are updated or none are. Missing or restricted ids are silently excluded; compare `count` against `limit` to detect exclusions. **CLI:** ```bash agentmail inboxes messages batch-update --inbox-id --message-ids --message-ids --add-labels read --remove-labels unread ```
#### 🔌 Usage
```typescript await client.inboxes.messages.batchUpdate("inbox_id", { messageIds: ["message_ids", "message_ids"] }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.BatchUpdateMessagesRequest`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.getAttachment(inbox_id, message_id, attachment_id) -> AgentMail.AttachmentResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes messages get-attachment --inbox-id --message-id --attachment-id ```
#### 🔌 Usage
```typescript await client.inboxes.messages.getAttachment("inbox_id", "message_id", "attachment_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**attachment_id:** `AgentMail.AttachmentId`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.getRaw(inbox_id, message_id) -> AgentMail.RawMessageResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes messages get-raw --inbox-id --message-id ```
#### 🔌 Usage
```typescript await client.inboxes.messages.getRaw("inbox_id", "message_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.update(inbox_id, message_id, { ...params }) -> AgentMail.UpdateMessageResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes messages update --inbox-id --message-id --add-labels read --remove-labels unread ```
#### 🔌 Usage
```typescript await client.inboxes.messages.update("inbox_id", "message_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**request:** `AgentMail.UpdateMessageRequest`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.delete(inbox_id, message_id) -> void
#### 📝 Description
Permanently deletes a message. **CLI:** ```bash agentmail inboxes messages delete --inbox-id --message-id ```
#### 🔌 Usage
```typescript await client.inboxes.messages.delete("inbox_id", "message_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**requestOptions:** `MessagesClient.RequestOptions`
client.inboxes.messages.send(inbox_id, { ...params }) -> AgentMail.SendMessageResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes messages send --inbox-id --to recipient@example.com --subject "Hello" --text "Body" ```
#### 🔌 Usage
```typescript await client.inboxes.messages.send("inbox_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.SendMessageRequest`
**requestOptions:** `MessagesClient.IdempotentRequestOptions`
client.inboxes.messages.reply(inbox_id, message_id, { ...params }) -> AgentMail.SendMessageResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes messages reply --inbox-id --message-id --text "Reply text" ```
#### 🔌 Usage
```typescript await client.inboxes.messages.reply("inbox_id", "message_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**request:** `AgentMail.ReplyToMessageRequest`
**requestOptions:** `MessagesClient.IdempotentRequestOptions`
client.inboxes.messages.replyAll(inbox_id, message_id, { ...params }) -> AgentMail.SendMessageResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes messages reply-all --inbox-id --message-id --text "Reply text" ```
#### 🔌 Usage
```typescript await client.inboxes.messages.replyAll("inbox_id", "message_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**request:** `AgentMail.ReplyAllMessageRequest`
**requestOptions:** `MessagesClient.IdempotentRequestOptions`
client.inboxes.messages.forward(inbox_id, message_id, { ...params }) -> AgentMail.SendMessageResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes messages forward --inbox-id --message-id --to recipient@example.com ```
#### 🔌 Usage
```typescript await client.inboxes.messages.forward("inbox_id", "message_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**message_id:** `AgentMail.MessageId`
**request:** `AgentMail.SendMessageRequest`
**requestOptions:** `MessagesClient.IdempotentRequestOptions`
## Inboxes Metrics
client.inboxes.metrics.queryEvents(inbox_id, { ...params }) -> AgentMail.QueryMetricsResponse
#### 📝 Description
Counts of email events (sent, delivered, bounced, etc.) over time for the inbox. Defaults to the last 24 hours; `start` must be within the last 90 days, and a future `end` is clamped to now. Omit `period` for individual event counts, or set it to sum counts into buckets of that many seconds. **CLI:** ```bash agentmail inboxes metrics query-events --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.metrics.queryEvents("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.QueryEventsRequest`
**requestOptions:** `MetricsClient.RequestOptions`
client.inboxes.metrics.queryUsage(inbox_id, { ...params }) -> AgentMail.QueryUsageResponse
#### 📝 Description
Cumulative usage series for the inbox. Each point is the running total of the usage type at that timestamp, not the change within the bucket. Inbox-scoped queries carry `storage_bytes`, `message_count`, and `thread_count`; requested types that don't apply to the scope are ignored. Defaults to the last 24 hours; `start` must be within the last 90 days, and a future `end` is clamped to now. The range divided by `period` must not exceed 1000 buckets.
#### 🔌 Usage
```typescript await client.inboxes.metrics.queryUsage("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.QueryUsageRequest`
**requestOptions:** `MetricsClient.RequestOptions`
client.inboxes.metrics.queryRates(inbox_id, { ...params }) -> AgentMail.QueryRatesResponse
#### 📝 Description
Rolling bounce and complaint rates for the inbox. At each `period` grid point, the bounced (or complained) messages over the preceding `window` divided by the messages sent over the same window, with the send count alongside. Account moderation evaluates the organization-wide rate, so use the organization endpoint to see the number it acts on; the inbox view shows which inboxes contribute. Defaults to the rolling 24-hour rate sampled hourly over the last day; `start` must be within the last 90 days, `window` must be a whole multiple of `period`, and the range plus window divided by `period` must not exceed 1000 buckets. **CLI:** ```bash agentmail inboxes metrics query-rates --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.metrics.queryRates("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.QueryRatesRequest`
**requestOptions:** `MetricsClient.RequestOptions`
## Inboxes Threads
client.inboxes.threads.list(inbox_id, { ...params }) -> AgentMail.ListThreadsResponse
#### 📝 Description
Lists threads in the inbox, most recent first. Pass `senders`, `recipients`, or `subject` to filter by substring. Filtered requests are served by search, which caps `limit` at 100. For relevance-ranked full-text search, use `Search Threads`. **CLI:** ```bash agentmail inboxes threads list --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.threads.list("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.ListThreadsRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.inboxes.threads.search(inbox_id, { ...params }) -> AgentMail.SearchThreadsResponse
#### 📝 Description
Full-text search across threads in the inbox, ranked by relevance. The query is matched against senders, recipients, and subject (substring) and the message body (tokenized full text). Spam, trash, blocked, and unauthenticated threads are always excluded. `limit` cannot exceed 100.
#### 🔌 Usage
```typescript await client.inboxes.threads.search("inbox_id", { q: "q" }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.SearchThreadsRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.inboxes.threads.get(inbox_id, thread_id, { ...params }) -> AgentMail.Thread
#### 📝 Description
**CLI:** ```bash agentmail inboxes threads get --inbox-id --thread-id ```
#### 🔌 Usage
```typescript await client.inboxes.threads.get("inbox_id", "thread_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**thread_id:** `AgentMail.ThreadId`
**request:** `AgentMail.inboxes.GetInboxThreadRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.inboxes.threads.getAttachment(inbox_id, thread_id, attachment_id) -> AgentMail.AttachmentResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes threads get-attachment --inbox-id --thread-id --attachment-id ```
#### 🔌 Usage
```typescript await client.inboxes.threads.getAttachment("inbox_id", "thread_id", "attachment_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**thread_id:** `AgentMail.ThreadId`
**attachment_id:** `AgentMail.AttachmentId`
**requestOptions:** `ThreadsClient.RequestOptions`
client.inboxes.threads.update(inbox_id, thread_id, { ...params }) -> AgentMail.UpdateThreadResponse
#### 📝 Description
Updates thread labels. Cannot add or remove system labels (sent, received, bounced, etc.). Rejects requests with a `422` for threads with 100 or more messages.
#### 🔌 Usage
```typescript await client.inboxes.threads.update("inbox_id", "thread_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**thread_id:** `AgentMail.ThreadId`
**request:** `AgentMail.UpdateThreadRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.inboxes.threads.delete(inbox_id, thread_id) -> void
#### 📝 Description
Permanently deletes a thread and all of its messages. **CLI:** ```bash agentmail inboxes threads delete --inbox-id --thread-id ```
#### 🔌 Usage
```typescript await client.inboxes.threads.delete("inbox_id", "thread_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**thread_id:** `AgentMail.ThreadId`
**requestOptions:** `ThreadsClient.RequestOptions`
## Inboxes Webhooks
client.inboxes.webhooks.list(inbox_id, { ...params }) -> AgentMail.ListWebhooksResponse
#### 📝 Description
**CLI:** ```bash agentmail inboxes webhooks list --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.list("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.InboxListWebhooksRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.inboxes.webhooks.get(inbox_id, webhook_id) -> AgentMail.Webhook
#### 📝 Description
**CLI:** ```bash agentmail inboxes webhooks get --inbox-id --webhook-id ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.get("inbox_id", "webhook_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
client.inboxes.webhooks.getHeaders(inbox_id, webhook_id) -> AgentMail.WebhookHeaderNamesResponse
#### 📝 Description
List the names of custom HTTP headers included with deliveries to this inbox-scoped webhook. Header values are write-only and are never returned.
#### 🔌 Usage
```typescript await client.inboxes.webhooks.getHeaders("inbox_id", "webhook_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
client.inboxes.webhooks.create(inbox_id, { ...params }) -> AgentMail.Webhook
#### 📝 Description
Create a webhook scoped to this inbox. **CLI:** ```bash agentmail inboxes webhooks create --inbox-id --url https://example.com/webhook --event-types message.received ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.create("inbox_id", { url: "url", eventTypes: ["message.received", "message.received"] }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.CreateInboxWebhookRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.inboxes.webhooks.update(inbox_id, webhook_id, { ...params }) -> AgentMail.Webhook
#### 📝 Description
**CLI:** ```bash agentmail inboxes webhooks update --inbox-id --webhook-id --event-types message.received ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.update("inbox_id", "webhook_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**webhook_id:** `AgentMail.WebhookId`
**request:** `AgentMail.UpdateInboxWebhookRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.inboxes.webhooks.updateHeaders(inbox_id, webhook_id, { ...params }) -> void
#### 📝 Description
Atomically set, replace, or remove custom HTTP headers included with deliveries to this inbox-scoped webhook. Header values remain write-only.
#### 🔌 Usage
```typescript await client.inboxes.webhooks.updateHeaders("inbox_id", "webhook_id", {}); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**webhook_id:** `AgentMail.WebhookId`
**request:** `AgentMail.UpdateWebhookHeadersRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.inboxes.webhooks.delete(inbox_id, webhook_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail inboxes webhooks delete --inbox-id --webhook-id ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.delete("inbox_id", "webhook_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
## Inboxes Webhooks Polling
client.inboxes.webhooks.polling.list(inbox_id, { ...params }) -> AgentMail.ListPollingWebhooksResponse
#### 📝 Description
Lists the polling webhooks created through this inbox route. **CLI:** ```bash agentmail inboxes webhooks polling list --inbox-id ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.polling.list("inbox_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.inboxes.webhooks.InboxListPollingWebhooksRequest`
**requestOptions:** `PollingClient.RequestOptions`
client.inboxes.webhooks.polling.get(inbox_id, webhook_id) -> AgentMail.PollingWebhook
#### 📝 Description
**CLI:** ```bash agentmail inboxes webhooks polling get --inbox-id --webhook-id ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.polling.get("inbox_id", "webhook_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `PollingClient.RequestOptions`
client.inboxes.webhooks.polling.create(inbox_id, { ...params }) -> AgentMail.CreatePollingWebhookResponse
#### 📝 Description
Create a polling webhook scoped to this inbox and return the `token` that reads it. **CLI:** ```bash agentmail inboxes webhooks polling create --inbox-id --client-id my-agent --event-types message.received ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.polling.create("inbox_id", { clientId: "client_id", eventTypes: ["message.received", "message.received"] }); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.CreateInboxPollingWebhookRequest`
**requestOptions:** `PollingClient.RequestOptions`
client.inboxes.webhooks.polling.delete(inbox_id, webhook_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail inboxes webhooks polling delete --inbox-id --webhook-id ```
#### 🔌 Usage
```typescript await client.inboxes.webhooks.polling.delete("inbox_id", "webhook_id"); ```
#### ⚙️ Parameters
**inbox_id:** `AgentMail.InboxId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `PollingClient.RequestOptions`
## Lists
client.lists.list(direction, type, { ...params }) -> AgentMail.ListListEntriesResponse
#### 📝 Description
**CLI:** ```bash agentmail lists list --direction --type ```
#### 🔌 Usage
```typescript await client.lists.list("send", "allow"); ```
#### ⚙️ Parameters
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**request:** `AgentMail.ListListEntriesRequest`
**requestOptions:** `ListsClient.RequestOptions`
client.lists.get(direction, type, entry) -> AgentMail.ListEntry
#### 📝 Description
**CLI:** ```bash agentmail lists get --direction --type --entry ```
#### 🔌 Usage
```typescript await client.lists.get("send", "allow", "entry"); ```
#### ⚙️ Parameters
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**entry:** `string` — Email address or domain.
**requestOptions:** `ListsClient.RequestOptions`
client.lists.create(direction, type, { ...params }) -> AgentMail.ListEntry
#### 📝 Description
**CLI:** ```bash agentmail lists create --direction --type --entry user@example.com ```
#### 🔌 Usage
```typescript await client.lists.create("send", "allow", { entry: "entry" }); ```
#### ⚙️ Parameters
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**request:** `AgentMail.CreateListEntryRequest`
**requestOptions:** `ListsClient.RequestOptions`
client.lists.delete(direction, type, entry) -> void
#### 📝 Description
**CLI:** ```bash agentmail lists delete --direction --type --entry ```
#### 🔌 Usage
```typescript await client.lists.delete("send", "allow", "entry"); ```
#### ⚙️ Parameters
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**entry:** `string` — Email address or domain.
**requestOptions:** `ListsClient.RequestOptions`
## Metrics
client.metrics.queryEvents({ ...params }) -> AgentMail.QueryMetricsResponse
#### 📝 Description
Counts of email events (sent, delivered, bounced, etc.) over time for the organization. Defaults to the last 24 hours; `start` must be within the last 90 days, and a future `end` is clamped to now. Omit `period` for individual event counts, or set it to sum counts into buckets of that many seconds. **CLI:** ```bash agentmail metrics query-events ```
#### 🔌 Usage
```typescript await client.metrics.queryEvents(); ```
#### ⚙️ Parameters
**request:** `AgentMail.QueryEventsRequest`
**requestOptions:** `MetricsClient.RequestOptions`
client.metrics.queryUsage({ ...params }) -> AgentMail.QueryUsageResponse
#### 📝 Description
Cumulative usage series for the organization. Each point is the running total of the usage type at that timestamp, not the change within the bucket. Defaults to the last 24 hours; `start` must be within the last 90 days, and a future `end` is clamped to now. The range divided by `period` must not exceed 1000 buckets.
#### 🔌 Usage
```typescript await client.metrics.queryUsage(); ```
#### ⚙️ Parameters
**request:** `AgentMail.QueryUsageRequest`
**requestOptions:** `MetricsClient.RequestOptions`
client.metrics.queryRates({ ...params }) -> AgentMail.QueryRatesResponse
#### 📝 Description
Rolling bounce and complaint rates for the organization. At each `period` grid point, the bounced (or complained) messages over the preceding `window` divided by the messages sent over the same window, with the send count alongside so you can see the volume behind it. AgentMail weighs bounce and complaint signals when deciding whether to suspend an account's sending, so keep both rates low. Defaults to the rolling 24-hour rate sampled hourly over the last day; `start` must be within the last 90 days, `window` must be a whole multiple of `period`, and the range plus window divided by `period` must not exceed 1000 buckets. **CLI:** ```bash agentmail metrics query-rates ```
#### 🔌 Usage
```typescript await client.metrics.queryRates(); ```
#### ⚙️ Parameters
**request:** `AgentMail.QueryRatesRequest`
**requestOptions:** `MetricsClient.RequestOptions`
## Organizations
client.organizations.get() -> AgentMail.Organization
#### 📝 Description
Returns the organization for the authenticated API key (usage limits, counts, and billing metadata). **CLI:** ```bash agentmail organizations get ```
#### 🔌 Usage
```typescript await client.organizations.get(); ```
#### ⚙️ Parameters
**requestOptions:** `OrganizationsClient.RequestOptions`
client.organizations.getLabs() -> AgentMail.OrganizationLabs
#### 📝 Description
Returns whether the organization is in AgentMail Labs, which turns on features that are still in preview, such as [Agent Armor](https://docs.agentmail.to/agent-armor). Requires an organization-scoped API key. **CLI:** ```bash agentmail organizations get-labs ```
#### 🔌 Usage
```typescript await client.organizations.getLabs(); ```
#### ⚙️ Parameters
**requestOptions:** `OrganizationsClient.RequestOptions`
client.organizations.joinLabs() -> AgentMail.OrganizationLabs
#### 📝 Description
Joins AgentMail Labs for the whole organization, which turns on every feature in Labs for every inbox. Joining again has no effect. There is no leave on the API; an organization admin can leave in the console under [Settings, then Labs](https://console.agentmail.to/dashboard/settings/labs). Join only when your organization has decided to. Get Labs reads the same for an organization that never joined and one whose admin left Labs on purpose, so don't join just because `enabled` is `false`. Requires an organization-scoped API key with no permissions restriction, and a verified organization. API keys see the change within five minutes. Where Labs isn't offered (`available` is `false` on Get Labs), joining returns `403`. **CLI:** ```bash agentmail organizations join-labs ```
#### 🔌 Usage
```typescript await client.organizations.joinLabs(); ```
#### ⚙️ Parameters
**requestOptions:** `OrganizationsClient.RequestOptions`
## Pods Accounts
client.pods.accounts.list(pod_id, { ...params }) -> AgentMail.ListAccountsResponse
#### 📝 Description
Lists accounts held by inboxes in the pod, across all apps. Requires `inbox_read`.
#### 🔌 Usage
```typescript await client.pods.accounts.list("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.ListAccountsRequest`
**requestOptions:** `AccountsClient.RequestOptions`
client.pods.accounts.get(pod_id, account_id) -> AgentMail.Account
#### 📝 Description
Returns one account held by inboxes in the pod. An account elsewhere is a 404. Requires `inbox_read`.
#### 🔌 Usage
```typescript await client.pods.accounts.get("pod_id", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**account_id:** `AgentMail.AccountId`
**requestOptions:** `AccountsClient.RequestOptions`
## Pods ApiKeys
client.pods.apiKeys.list(pod_id, { ...params }) -> AgentMail.ListApiKeysResponse
#### 📝 Description
**CLI:** ```bash agentmail pods api-keys list --pod-id ```
#### 🔌 Usage
```typescript await client.pods.apiKeys.list("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.ListApiKeysRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.pods.apiKeys.create(pod_id, { ...params }) -> AgentMail.CreateApiKeyResponse
#### 📝 Description
**CLI:** ```bash agentmail pods api-keys create --pod-id --name "My Key" ```
#### 🔌 Usage
```typescript await client.pods.apiKeys.create("pod_id", {}); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.CreateApiKeyRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.pods.apiKeys.update(pod_id, api_key_id, { ...params }) -> AgentMail.ApiKey
#### 📝 Description
**CLI:** ```bash agentmail pods api-keys update --pod-id --api-key-id --name "Renamed" ```
#### 🔌 Usage
```typescript await client.pods.apiKeys.update("pod_id", "api_key_id", {}); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**api_key_id:** `AgentMail.ApiKeyId`
**request:** `AgentMail.UpdateApiKeyRequest`
**requestOptions:** `ApiKeysClient.RequestOptions`
client.pods.apiKeys.delete(pod_id, api_key_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail pods api-keys delete --pod-id --api-key-id ```
#### 🔌 Usage
```typescript await client.pods.apiKeys.delete("pod_id", "api_key_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**api_key_id:** `AgentMail.ApiKeyId`
**requestOptions:** `ApiKeysClient.RequestOptions`
## Pods Domains
client.pods.domains.list(pod_id, { ...params }) -> AgentMail.ListDomainsResponse
#### 📝 Description
**CLI:** ```bash agentmail pods domains list --pod-id ```
#### 🔌 Usage
```typescript await client.pods.domains.list("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.ListDomainsRequest`
**requestOptions:** `DomainsClient.RequestOptions`
client.pods.domains.get(pod_id, domain_id) -> AgentMail.Domain
#### 📝 Description
**CLI:** ```bash agentmail pods domains get --pod-id --domain-id ```
#### 🔌 Usage
```typescript await client.pods.domains.get("pod_id", "domain_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
client.pods.domains.getZoneFile(pod_id, domain_id) -> core.BinaryResponse
#### 📝 Description
**CLI:** ```bash agentmail pods domains get-zone-file --pod-id --domain-id ```
#### 🔌 Usage
```typescript await client.pods.domains.getZoneFile("pod_id", "domain_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
client.pods.domains.create(pod_id, { ...params }) -> AgentMail.Domain
#### 📝 Description
**CLI:** ```bash agentmail pods domains create --pod-id --domain example.com ```
#### 🔌 Usage
```typescript await client.pods.domains.create("pod_id", { domain: "domain" }); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.CreateDomainRequest`
**requestOptions:** `DomainsClient.RequestOptions`
client.pods.domains.update(pod_id, domain_id, { ...params }) -> AgentMail.Domain
#### 📝 Description
**CLI:** ```bash agentmail pods domains update --pod-id --domain-id ```
#### 🔌 Usage
```typescript await client.pods.domains.update("pod_id", "domain_id", {}); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**domain_id:** `AgentMail.DomainId`
**request:** `AgentMail.UpdateDomainRequest`
**requestOptions:** `DomainsClient.RequestOptions`
client.pods.domains.delete(pod_id, domain_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail pods domains delete --pod-id --domain-id ```
#### 🔌 Usage
```typescript await client.pods.domains.delete("pod_id", "domain_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
client.pods.domains.verify(pod_id, domain_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail pods domains verify --pod-id --domain-id ```
#### 🔌 Usage
```typescript await client.pods.domains.verify("pod_id", "domain_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**domain_id:** `AgentMail.DomainId`
**requestOptions:** `DomainsClient.RequestOptions`
## Pods Drafts
client.pods.drafts.list(pod_id, { ...params }) -> AgentMail.ListDraftsResponse
#### 📝 Description
**CLI:** ```bash agentmail pods drafts list --pod-id ```
#### 🔌 Usage
```typescript await client.pods.drafts.list("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.ListDraftsRequest`
**requestOptions:** `DraftsClient.RequestOptions`
client.pods.drafts.get(pod_id, draft_id) -> AgentMail.Draft
#### 📝 Description
**CLI:** ```bash agentmail pods drafts get --pod-id --draft-id ```
#### 🔌 Usage
```typescript await client.pods.drafts.get("pod_id", "draft_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**draft_id:** `AgentMail.DraftId`
**requestOptions:** `DraftsClient.RequestOptions`
client.pods.drafts.getAttachment(pod_id, draft_id, attachment_id) -> AgentMail.AttachmentResponse
#### 📝 Description
**CLI:** ```bash agentmail pods drafts get-attachment --pod-id --draft-id --attachment-id ```
#### 🔌 Usage
```typescript await client.pods.drafts.getAttachment("pod_id", "draft_id", "attachment_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**draft_id:** `AgentMail.DraftId`
**attachment_id:** `AgentMail.AttachmentId`
**requestOptions:** `DraftsClient.RequestOptions`
## Pods Forwarding
client.pods.forwarding.get(pod_id) -> AgentMail.Forwarding
#### 📝 Description
Get the forwarding this pod sets. Its inboxes that set no forwarding of their own use this list. When the pod sets nothing, `destinations` is `null` and the pod uses the organization's forwarding. **CLI:** ```bash agentmail pods forwarding get --pod-id ```
#### 🔌 Usage
```typescript await client.pods.forwarding.get("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**requestOptions:** `ForwardingClient.RequestOptions`
client.pods.forwarding.update(pod_id, { ...params }) -> AgentMail.UpdateForwardingResponse
#### 📝 Description
Set the addresses this pod forwards to. The list replaces the pod's current one and the organization's list for this pod; lists are never combined. Send an empty list to stop forwarding in this pod even when the organization forwards. An address that is not verified is saved but receives nothing until it is verified. **CLI:** ```bash agentmail pods forwarding update --pod-id --destinations ops@example.com ```
#### 🔌 Usage
```typescript await client.pods.forwarding.update("pod_id", { destinations: ["destinations", "destinations"] }); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.UpdateForwardingRequest`
**requestOptions:** `ForwardingClient.RequestOptions`
client.pods.forwarding.delete(pod_id) -> AgentMail.Forwarding
#### 📝 Description
Remove this pod's own forwarding, so the pod uses the organization's forwarding again. Verified addresses stay verified. Returns `not_found` when the pod sets no forwarding. **CLI:** ```bash agentmail pods forwarding delete --pod-id ```
#### 🔌 Usage
```typescript await client.pods.forwarding.delete("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**requestOptions:** `ForwardingClient.RequestOptions`
## Pods Inboxes
client.pods.inboxes.list(pod_id, { ...params }) -> AgentMail.ListInboxesResponse
#### 📝 Description
**CLI:** ```bash agentmail pods inboxes list --pod-id ```
#### 🔌 Usage
```typescript await client.pods.inboxes.list("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.ListInboxesRequest`
**requestOptions:** `InboxesClient.RequestOptions`
client.pods.inboxes.search(pod_id, { ...params }) -> AgentMail.SearchInboxesResponse
#### 📝 Description
Searches inboxes in the pod by address or display name, ranked by relevance. Each word in the query matches the start of a word in the address or display name, so `sup` matches `support@example.com` but `port` does not. An exact address match always ranks first. `limit` cannot exceed 100. A page can be empty and still carry a `next_page_token`; keep paging until the token is absent.
#### 🔌 Usage
```typescript await client.pods.inboxes.search("pod_id", { q: "q" }); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.SearchInboxesRequest`
**requestOptions:** `InboxesClient.RequestOptions`
client.pods.inboxes.get(pod_id, inbox_id) -> AgentMail.Inbox
#### 📝 Description
**CLI:** ```bash agentmail pods inboxes get --pod-id --inbox-id ```
#### 🔌 Usage
```typescript await client.pods.inboxes.get("pod_id", "inbox_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**inbox_id:** `AgentMail.InboxId`
**requestOptions:** `InboxesClient.RequestOptions`
client.pods.inboxes.create(pod_id, { ...params }) -> AgentMail.Inbox
#### 📝 Description
**CLI:** ```bash agentmail pods inboxes create --pod-id --username myagent --domain example.com ```
#### 🔌 Usage
```typescript await client.pods.inboxes.create("pod_id", {}); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.CreateInboxRequest`
**requestOptions:** `InboxesClient.RequestOptions`
client.pods.inboxes.update(pod_id, inbox_id, { ...params }) -> AgentMail.Inbox
#### 📝 Description
**CLI:** ```bash agentmail pods inboxes update --pod-id --inbox-id ```
#### 🔌 Usage
```typescript await client.pods.inboxes.update("pod_id", "inbox_id", {}); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**inbox_id:** `AgentMail.InboxId`
**request:** `AgentMail.UpdateInboxRequest`
**requestOptions:** `InboxesClient.RequestOptions`
client.pods.inboxes.delete(pod_id, inbox_id) -> void
#### 📝 Description
Deletion is asynchronous. A `202` means it has started. While it runs, requests for this inbox return `409` `resource_deleting`. Poll `GET /v0/pods/{pod_id}/inboxes/{inbox_id}` until it returns `404`, then the address is free. If the inbox still has its own API keys, delete returns `409` `cannot_delete`: revoke those keys first. **CLI:** ```bash agentmail pods inboxes delete --pod-id --inbox-id ```
#### 🔌 Usage
```typescript await client.pods.inboxes.delete("my-pod", "my-agent@agentmail.to"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**inbox_id:** `AgentMail.InboxId`
**requestOptions:** `InboxesClient.RequestOptions`
## Pods Lists
client.pods.lists.list(pod_id, direction, type, { ...params }) -> AgentMail.PodListListEntriesResponse
#### 📝 Description
**CLI:** ```bash agentmail pods lists list --pod-id --direction --type ```
#### 🔌 Usage
```typescript await client.pods.lists.list("pod_id", "send", "allow"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**request:** `AgentMail.pods.ListListEntriesRequest`
**requestOptions:** `ListsClient.RequestOptions`
client.pods.lists.get(pod_id, direction, type, entry) -> AgentMail.PodListEntry
#### 📝 Description
**CLI:** ```bash agentmail pods lists get --pod-id --direction --type --entry ```
#### 🔌 Usage
```typescript await client.pods.lists.get("pod_id", "send", "allow", "entry"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**entry:** `string` — Email address or domain.
**requestOptions:** `ListsClient.RequestOptions`
client.pods.lists.create(pod_id, direction, type, { ...params }) -> AgentMail.PodListEntry
#### 📝 Description
**CLI:** ```bash agentmail pods lists create --pod-id --direction --type --entry user@example.com ```
#### 🔌 Usage
```typescript await client.pods.lists.create("pod_id", "send", "allow", { entry: "entry" }); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**request:** `AgentMail.CreateListEntryRequest`
**requestOptions:** `ListsClient.RequestOptions`
client.pods.lists.delete(pod_id, direction, type, entry) -> void
#### 📝 Description
**CLI:** ```bash agentmail pods lists delete --pod-id --direction --type --entry ```
#### 🔌 Usage
```typescript await client.pods.lists.delete("pod_id", "send", "allow", "entry"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**direction:** `AgentMail.Direction`
**type:** `AgentMail.ListType`
**entry:** `string` — Email address or domain.
**requestOptions:** `ListsClient.RequestOptions`
## Pods Metrics
client.pods.metrics.queryEvents(pod_id, { ...params }) -> AgentMail.QueryMetricsResponse
#### 📝 Description
Counts of email events (sent, delivered, bounced, etc.) over time for the pod. Defaults to the last 24 hours; `start` must be within the last 90 days, and a future `end` is clamped to now. Omit `period` for individual event counts, or set it to sum counts into buckets of that many seconds. **CLI:** ```bash agentmail pods metrics query-events --pod-id ```
#### 🔌 Usage
```typescript await client.pods.metrics.queryEvents("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.QueryEventsRequest`
**requestOptions:** `MetricsClient.RequestOptions`
client.pods.metrics.queryUsage(pod_id, { ...params }) -> AgentMail.QueryUsageResponse
#### 📝 Description
Cumulative usage series for the pod. Each point is the running total of the usage type at that timestamp, not the change within the bucket. Pod-scoped queries carry every usage type except `pod_count`; requested types that don't apply to the scope are ignored. Defaults to the last 24 hours; `start` must be within the last 90 days, and a future `end` is clamped to now. The range divided by `period` must not exceed 1000 buckets.
#### 🔌 Usage
```typescript await client.pods.metrics.queryUsage("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.QueryUsageRequest`
**requestOptions:** `MetricsClient.RequestOptions`
client.pods.metrics.queryRates(pod_id, { ...params }) -> AgentMail.QueryRatesResponse
#### 📝 Description
Rolling bounce and complaint rates for the pod. At each `period` grid point, the bounced (or complained) messages over the preceding `window` divided by the messages sent over the same window, with the send count alongside. Account moderation evaluates the organization-wide rate, so use the organization endpoint to see the number it acts on; the pod view shows which pods contribute. Defaults to the rolling 24-hour rate sampled hourly over the last day; `start` must be within the last 90 days, `window` must be a whole multiple of `period`, and the range plus window divided by `period` must not exceed 1000 buckets. **CLI:** ```bash agentmail pods metrics query-rates --pod-id ```
#### 🔌 Usage
```typescript await client.pods.metrics.queryRates("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.QueryRatesRequest`
**requestOptions:** `MetricsClient.RequestOptions`
## Pods Threads
client.pods.threads.list(pod_id, { ...params }) -> AgentMail.ListThreadsResponse
#### 📝 Description
Lists threads in the pod, most recent first. Pass `senders`, `recipients`, or `subject` to filter by substring. Filtered requests are served by search, which caps `limit` at 100. For relevance-ranked full-text search, use `Search Threads`. **CLI:** ```bash agentmail pods threads list --pod-id ```
#### 🔌 Usage
```typescript await client.pods.threads.list("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.ListThreadsRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.pods.threads.search(pod_id, { ...params }) -> AgentMail.SearchThreadsResponse
#### 📝 Description
Full-text search across threads in the pod, ranked by relevance. The query is matched against senders, recipients, and subject (substring) and the message body (tokenized full text). Spam, trash, blocked, and unauthenticated threads are always excluded. `limit` cannot exceed 100.
#### 🔌 Usage
```typescript await client.pods.threads.search("pod_id", { q: "q" }); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.SearchThreadsRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.pods.threads.get(pod_id, thread_id, { ...params }) -> AgentMail.Thread
#### 📝 Description
**CLI:** ```bash agentmail pods threads get --pod-id --thread-id ```
#### 🔌 Usage
```typescript await client.pods.threads.get("pod_id", "thread_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**thread_id:** `AgentMail.ThreadId`
**request:** `AgentMail.pods.GetPodThreadRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.pods.threads.getAttachment(pod_id, thread_id, attachment_id) -> AgentMail.AttachmentResponse
#### 📝 Description
**CLI:** ```bash agentmail pods threads get-attachment --pod-id --thread-id --attachment-id ```
#### 🔌 Usage
```typescript await client.pods.threads.getAttachment("pod_id", "thread_id", "attachment_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**thread_id:** `AgentMail.ThreadId`
**attachment_id:** `AgentMail.AttachmentId`
**requestOptions:** `ThreadsClient.RequestOptions`
client.pods.threads.update(pod_id, thread_id, { ...params }) -> AgentMail.UpdateThreadResponse
#### 📝 Description
Updates thread labels. Cannot add or remove system labels (sent, received, bounced, etc.). Rejects requests with a `422` for threads with 100 or more messages.
#### 🔌 Usage
```typescript await client.pods.threads.update("pod_id", "thread_id", {}); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**thread_id:** `AgentMail.ThreadId`
**request:** `AgentMail.UpdateThreadRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.pods.threads.delete(pod_id, thread_id) -> void
#### 📝 Description
Permanently deletes a thread and all of its messages. **CLI:** ```bash agentmail pods threads delete --pod-id --thread-id ```
#### 🔌 Usage
```typescript await client.pods.threads.delete("pod_id", "thread_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**thread_id:** `AgentMail.ThreadId`
**requestOptions:** `ThreadsClient.RequestOptions`
## Pods Webhooks
client.pods.webhooks.list(pod_id, { ...params }) -> AgentMail.ListWebhooksResponse
#### 📝 Description
**CLI:** ```bash agentmail pods webhooks list --pod-id ```
#### 🔌 Usage
```typescript await client.pods.webhooks.list("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.PodListWebhooksRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.pods.webhooks.get(pod_id, webhook_id) -> AgentMail.Webhook
#### 📝 Description
**CLI:** ```bash agentmail pods webhooks get --pod-id --webhook-id ```
#### 🔌 Usage
```typescript await client.pods.webhooks.get("pod_id", "webhook_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
client.pods.webhooks.getHeaders(pod_id, webhook_id) -> AgentMail.WebhookHeaderNamesResponse
#### 📝 Description
List the names of custom HTTP headers included with deliveries to this pod-scoped webhook. Header values are write-only and are never returned.
#### 🔌 Usage
```typescript await client.pods.webhooks.getHeaders("pod_id", "webhook_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
client.pods.webhooks.create(pod_id, { ...params }) -> AgentMail.Webhook
#### 📝 Description
Create a webhook scoped to this pod. **CLI:** ```bash agentmail pods webhooks create --pod-id --url https://example.com/webhook --event-types message.received ```
#### 🔌 Usage
```typescript await client.pods.webhooks.create("pod_id", { url: "url", eventTypes: ["message.received", "message.received"] }); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.CreatePodWebhookRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.pods.webhooks.update(pod_id, webhook_id, { ...params }) -> AgentMail.Webhook
#### 📝 Description
**CLI:** ```bash agentmail pods webhooks update --pod-id --webhook-id --add-inbox-ids ```
#### 🔌 Usage
```typescript await client.pods.webhooks.update("pod_id", "webhook_id", {}); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**webhook_id:** `AgentMail.WebhookId`
**request:** `AgentMail.UpdatePodWebhookRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.pods.webhooks.updateHeaders(pod_id, webhook_id, { ...params }) -> void
#### 📝 Description
Atomically set, replace, or remove custom HTTP headers included with deliveries to this pod-scoped webhook. Header values remain write-only.
#### 🔌 Usage
```typescript await client.pods.webhooks.updateHeaders("pod_id", "webhook_id", {}); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**webhook_id:** `AgentMail.WebhookId`
**request:** `AgentMail.UpdateWebhookHeadersRequest`
**requestOptions:** `WebhooksClient.RequestOptions`
client.pods.webhooks.delete(pod_id, webhook_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail pods webhooks delete --pod-id --webhook-id ```
#### 🔌 Usage
```typescript await client.pods.webhooks.delete("pod_id", "webhook_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `WebhooksClient.RequestOptions`
## Pods Webhooks Polling
client.pods.webhooks.polling.list(pod_id, { ...params }) -> AgentMail.ListPollingWebhooksResponse
#### 📝 Description
Lists the polling webhooks created through this pod route. **CLI:** ```bash agentmail pods webhooks polling list --pod-id ```
#### 🔌 Usage
```typescript await client.pods.webhooks.polling.list("pod_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.pods.webhooks.PodListPollingWebhooksRequest`
**requestOptions:** `PollingClient.RequestOptions`
client.pods.webhooks.polling.get(pod_id, webhook_id) -> AgentMail.PollingWebhook
#### 📝 Description
**CLI:** ```bash agentmail pods webhooks polling get --pod-id --webhook-id ```
#### 🔌 Usage
```typescript await client.pods.webhooks.polling.get("pod_id", "webhook_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `PollingClient.RequestOptions`
client.pods.webhooks.polling.create(pod_id, { ...params }) -> AgentMail.CreatePollingWebhookResponse
#### 📝 Description
Create a polling webhook scoped to this pod and return the `token` that reads it. **CLI:** ```bash agentmail pods webhooks polling create --pod-id --client-id my-agent --event-types message.received ```
#### 🔌 Usage
```typescript await client.pods.webhooks.polling.create("pod_id", { clientId: "client_id", eventTypes: ["message.received", "message.received"] }); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**request:** `AgentMail.CreatePodPollingWebhookRequest`
**requestOptions:** `PollingClient.RequestOptions`
client.pods.webhooks.polling.delete(pod_id, webhook_id) -> void
#### 📝 Description
**CLI:** ```bash agentmail pods webhooks polling delete --pod-id --webhook-id ```
#### 🔌 Usage
```typescript await client.pods.webhooks.polling.delete("pod_id", "webhook_id"); ```
#### ⚙️ Parameters
**pod_id:** `AgentMail.PodId`
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `PollingClient.RequestOptions`
## Threads
client.threads.list({ ...params }) -> AgentMail.ListThreadsResponse
#### 📝 Description
Lists threads, most recent first. Pass `senders`, `recipients`, or `subject` to filter by substring. Filtered requests are served by search, which caps `limit` at 100. For relevance-ranked full-text search across senders, recipients, subject, and message body, use `Search Threads`. **CLI:** ```bash agentmail threads list ```
#### 🔌 Usage
```typescript await client.threads.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.ListThreadsRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.threads.search({ ...params }) -> AgentMail.SearchThreadsResponse
#### 📝 Description
Full-text search across threads in the organization, ranked by relevance. The query is matched against senders, recipients, and subject (substring) and the message body (tokenized full text). Spam, trash, blocked, and unauthenticated threads are always excluded. `limit` cannot exceed 100.
#### 🔌 Usage
```typescript await client.threads.search({ q: "q" }); ```
#### ⚙️ Parameters
**request:** `AgentMail.SearchThreadsRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.threads.get(thread_id, { ...params }) -> AgentMail.Thread
#### 📝 Description
**CLI:** ```bash agentmail threads get --thread-id ```
#### 🔌 Usage
```typescript await client.threads.get("thread_id"); ```
#### ⚙️ Parameters
**thread_id:** `AgentMail.ThreadId`
**request:** `AgentMail.GetThreadRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.threads.getAttachment(thread_id, attachment_id) -> AgentMail.AttachmentResponse
#### 📝 Description
**CLI:** ```bash agentmail threads get-attachment --thread-id --attachment-id ```
#### 🔌 Usage
```typescript await client.threads.getAttachment("thread_id", "attachment_id"); ```
#### ⚙️ Parameters
**thread_id:** `AgentMail.ThreadId`
**attachment_id:** `AgentMail.AttachmentId`
**requestOptions:** `ThreadsClient.RequestOptions`
client.threads.update(thread_id, { ...params }) -> AgentMail.UpdateThreadResponse
#### 📝 Description
Updates thread labels. Cannot add or remove system labels (sent, received, bounced, etc.). Rejects requests with a `422` for threads with 100 or more messages.
#### 🔌 Usage
```typescript await client.threads.update("thread_id", {}); ```
#### ⚙️ Parameters
**thread_id:** `AgentMail.ThreadId`
**request:** `AgentMail.UpdateThreadRequest`
**requestOptions:** `ThreadsClient.RequestOptions`
client.threads.delete(thread_id) -> void
#### 📝 Description
Permanently deletes a thread and all of its messages. **CLI:** ```bash agentmail threads delete --thread-id ```
#### 🔌 Usage
```typescript await client.threads.delete("thread_id"); ```
#### ⚙️ Parameters
**thread_id:** `AgentMail.ThreadId`
**requestOptions:** `ThreadsClient.RequestOptions`
## Webhooks Polling
client.webhooks.polling.list({ ...params }) -> AgentMail.ListPollingWebhooksResponse
#### 📝 Description
Lists the polling webhooks created through this route. `page_token` must come from this endpoint; a token from another list endpoint is rejected. **CLI:** ```bash agentmail webhooks polling list ```
#### 🔌 Usage
```typescript await client.webhooks.polling.list(); ```
#### ⚙️ Parameters
**request:** `AgentMail.webhooks.ListPollingWebhooksRequest`
**requestOptions:** `PollingClient.RequestOptions`
client.webhooks.polling.get(webhook_id) -> AgentMail.PollingWebhook
#### 📝 Description
The `token` is never returned here: create again with the same `client_id` to get a new one. **CLI:** ```bash agentmail webhooks polling get --webhook-id ```
#### 🔌 Usage
```typescript await client.webhooks.polling.get("webhook_id"); ```
#### ⚙️ Parameters
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `PollingClient.RequestOptions`
client.webhooks.polling.create({ ...params }) -> AgentMail.CreatePollingWebhookResponse
#### 📝 Description
Creates a subscription the agent polls for events, and returns the `token` that reads it. Each organization, pod, and inbox holds at most 10 polling webhooks; a repeat create with the same `client_id` re-issues the token of the existing one instead of counting against that limit. **CLI:** ```bash agentmail webhooks polling create --client-id my-agent --event-types message.received ```
#### 🔌 Usage
```typescript await client.webhooks.polling.create({ clientId: "client_id", eventTypes: ["message.received", "message.received"] }); ```
#### ⚙️ Parameters
**request:** `AgentMail.CreatePollingWebhookRequest`
**requestOptions:** `PollingClient.RequestOptions`
client.webhooks.polling.delete(webhook_id) -> void
#### 📝 Description
Stops delivery and invalidates the subscription's token. **CLI:** ```bash agentmail webhooks polling delete --webhook-id ```
#### 🔌 Usage
```typescript await client.webhooks.polling.delete("webhook_id"); ```
#### ⚙️ Parameters
**webhook_id:** `AgentMail.WebhookId`
**requestOptions:** `PollingClient.RequestOptions`