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

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Move to inbox

> Add Gmail's Inbox label to one or many messages.

`moveToInbox` adds Gmail's `INBOX` system label to one or many messages. Use it to return archived mail to the inbox.

## Example

Return up to 100 archived messages with the `Needs review` label to the inbox:

```ts theme={null}
import { automation, branch } from "automate.ax"
import { moveToInbox, searchMessages } from "automate.ax/gmail"

export default automation("Return Gmail messages to the inbox", () => {
  const messages = searchMessages({
    limit: 100,
    query: 'label:"Needs review" -in:inbox',
  })

  branch(
    messages.length.transform((length) => length > 0),
    () => {
      moveToInbox({
        messageIds: messages.transform((results) =>
          results.map((message) => message.messageId),
        ),
      })
    },
  )
})
```

## Inputs

| Name         | Type                                 | Required | Description                                                                      |
| ------------ | ------------------------------------ | -------- | -------------------------------------------------------------------------------- |
| `messageIds` | `string \| string[]`                 | Yes      | One or up to 1,000 immutable Gmail message IDs.                                  |
| `account`    | `string \| Google account reference` | No       | Google account binding to use. Defaults to the project's default Google account. |

Every input field also accepts a compatible `Signal`; the example derives message IDs from `searchMessages`.

## Output

The action returns a `Signal<string[]>` containing the modified message IDs in input order.

This action only adds `INBOX`; it does not explicitly remove `SPAM` or restore a message from Trash. Use `markAsNotSpam` for Spam and `untrash` for Trash. Other labels remain applied.
