> ## 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.

# On Automate.ax deployment event

> Run an automation for every status transition in an Automate.ax project.

`automate.onDeploymentEvent` covers the complete deployment lifecycle. Use a semantic trigger when only awaiting authorization, success, failure, or cancellation matters.

```ts automations/watch-deployments.automation.ts theme={null}
import { automation } from "automate.ax"
import { automate } from "automate.ax/automate"

export default automation("Watch deployments", () => {
  const event = automate.onDeploymentEvent({
    account: "operations",
    projectId: "proj_01",
  })

  // Route the Automate.ax deployment by status.
})
```

## Configuration

| Property    | Type                                                | Required | Description                                                                                                          |
| ----------- | --------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| `account`   | `string \| IntegrationAccountReference<"automate">` | No       | Static binding with `deployment:read` for another organization. Omit it to use the deploying project's organization. |
| `projectId` | `string`                                            | Yes      | Project whose deployments should be watched. It must belong to the resulting organization identity.                  |

## Trigger data

Returns `deployment`, `project`, `organization`, `previousStatus`, `status`, `transitionedAt`, and `failure`. Deployment contains `id`, `createdAt`, and nullable `completedAt`. Project and organization each contain `id` and `name`.

`previousStatus` is `null` for a newly created deployment. Otherwise, `previousStatus` and `status` use `planning`, `awaiting_authorization`, `configuring`, `publishing`, `succeeded`, `failed`, or `cancelled`. `failure` is normally `null`; a failed deployment includes its terminal error message.

Automate.ax stores the event in the same transaction as the status transition. An action does not wake the automation that performed that action, but other subscribed automations still receive it.
