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

# Unipile: Update Email

> Changes an email in the customer’s connected mailbox: mark it read or unread, or move it to another folder. Includes SDK V2 examples, schemas, and cost.

Changes an email in the customer’s connected mailbox: mark it read or unread, or move it to another folder.

> [!NOTE]
>
> Tool ID: `unipile_update_email`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'unipile_update_email',
  {
    "email_id": "jane.doe@example.com"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline tools execute unipile_update_email --input '{
  "email_id": "jane.doe@example.com"
}' --json
```

## Example response

The SDK returns this shape at `result.toolResponse.raw`. The example values illustrate the response.

```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
{
  "data": {
    "object": "EmailUpdated"
  }
}
```

Use `deepline describe unipile_update_email --json` for the latest machine-readable contract.

## Input reference

Update an email.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.email_id` | `string` | Yes | — | The id of the email to be updated. Either the Unipile id or the provider uid. |
| `payload.account_id` | `string` | No | — | The id of the account related to the email. Required when using the provider uid. |
| `payload.unread` | `boolean` | No | — | Indicates whether the email should be marked as unread. Updates only the targeted email. If unread is supplied, all other parameters are ignored. |
| `payload.folders` | `array` | No | — | The names of the folders to which the email should be moved. Outlook and IMAP accounts accept only one folder. If you provide a label value that does not already exist, a new label will be created with that value. Updates the entire thread if the targeted email is part of a conversation |
| `payload.categories` | `array` | No | — | `Outlook only`: The categories to assign to the email. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Update an email.",
    "properties": {
      "email_id": {
        "type": "string",
        "description": "The id of the email to be updated. Either the Unipile id or the provider uid."
      },
      "account_id": {
        "type": "string",
        "description": "The id of the account related to the email. Required when using the provider uid."
      },
      "unread": {
        "type": "boolean",
        "description": "Indicates whether the email should be marked as unread. Updates only the targeted email. If unread is supplied, all other parameters are ignored."
      },
      "folders": {
        "type": "array",
        "description": "The names of the folders to which the email should be moved. Outlook and IMAP accounts accept only one folder. If you provide a label value that does not already exist, a new label will be created with that value. Updates the entire thread if the targeted email is part of a conversation",
        "items": {
          "type": "string"
        }
      },
      "categories": {
        "type": "array",
        "description": "`Outlook only`: The categories to assign to the email.",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "email_id"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | @todo Email has been updated. |
| `result.data.object` | `"EmailUpdated"` | Yes | — | Allowed: `EmailUpdated`. |
| `result.meta` | `object` | No | — | Additional response metadata (status, paging). |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "type": "object",
        "description": "@todo Email has been updated.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "EmailUpdated"
            ]
          }
        },
        "required": [
          "object"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Unipile provider guide](https://deepline.com/docs/providers/unipile/guide.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


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