> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API

> API reference for AgentMail: every `agentmail.api.*` operation with input and output types.

Every `agentmail.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

<Info>
  **New to Corsair?** See [API access](/concepts/api), [authentication](/concepts/auth), and [error handling](/concepts/error-handling).
</Info>

## Messages

### get

`messages.get`

Retrieve the complete details of an AgentMail message

**Risk:** `read`

```ts theme={null}
await corsair.agentmail.api.messages.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `inbox_id` | `string` | Yes | — |
| `message_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `inbox_id` | `string` | Yes | — |
| `thread_id` | `string` | Yes | — |
| `message_id` | `string` | Yes | — |
| `labels` | `string[]` | Yes | — |
| `timestamp` | `string` | Yes | — |
| `from` | `string` | Yes | — |
| `to` | `string[]` | Yes | — |
| `size` | `number` | Yes | — |
| `updated_at` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `cc` | `string[]` | No | — |
| `bcc` | `string[]` | No | — |
| `subject` | `string` | No | — |
| `preview` | `string` | No | — |
| `attachments` | `object[]` | No | — |
| `in_reply_to` | `string` | No | — |
| `references` | `string[]` | No | — |
| `headers` | `object` | No | — |
| `reply_to` | `string[]` | No | — |
| `text` | `string` | No | — |
| `html` | `string` | No | — |
| `extracted_text` | `string` | No | — |
| `extracted_html` | `string` | No | — |

<AccordionGroup>
  <Accordion title="attachments full type">
    ```ts theme={null}
    {
      attachment_id: string,
      size: number,
      filename?: string,
      content_type?: string,
      content_disposition?: string,
      content_id?: string
    }[]
    ```
  </Accordion>

  <Accordion title="headers full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

### list

`messages.list`

List messages from an AgentMail inbox

**Risk:** `read`

```ts theme={null}
await corsair.agentmail.api.messages.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `inbox_id` | `string` | Yes | — |
| `limit` | `number` | No | — |
| `page_token` | `string` | No | — |
| `labels` | `string[]` | No | — |
| `before` | `string` | No | — |
| `after` | `string` | No | — |
| `ascending` | `boolean` | No | — |
| `include_spam` | `boolean` | No | — |
| `include_blocked` | `boolean` | No | — |
| `include_unauthenticated` | `boolean` | No | — |
| `include_trash` | `boolean` | No | — |
| `from` | `string[]` | No | — |
| `to` | `string[]` | No | — |
| `subject` | `string[]` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `count` | `number` | Yes | — |
| `messages` | `object[]` | Yes | — |
| `limit` | `number` | Yes | — |
| `next_page_token` | `string` | No | — |

<AccordionGroup>
  <Accordion title="messages full type">
    ```ts theme={null}
    {
      inbox_id: string,
      thread_id: string,
      message_id: string,
      labels: string[],
      timestamp: string,
      from: string,
      to: string[],
      size: number,
      updated_at: string,
      created_at: string,
      cc?: string[],
      bcc?: string[],
      subject?: string,
      preview?: string,
      attachments?: {
        attachment_id: string,
        size: number,
        filename?: string,
        content_type?: string,
        content_disposition?: string,
        content_id?: string
      }[],
      in_reply_to?: string,
      references?: string[],
      headers?: {
      }
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### send

`messages.send`

Send an email using AgentMail

**Risk:** `write`

```ts theme={null}
await corsair.agentmail.api.messages.send({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `inbox_id` | `string` | Yes | — |
| `labels` | `string[]` | No | — |
| `reply_to` | `string \| string[]` | No | — |
| `to` | `string \| string[]` | No | — |
| `cc` | `string \| string[]` | No | — |
| `bcc` | `string \| string[]` | No | — |
| `subject` | `string` | No | — |
| `text` | `string` | No | — |
| `html` | `string` | No | — |
| `headers` | `object` | No | — |

<AccordionGroup>
  <Accordion title="headers full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `message_id` | `string` | Yes | — |
| `thread_id` | `string` | Yes | — |

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.