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

# automationExecute

> Run an automation's published version now, once, with the given trigger event, and return the run. Unlike `automationExecuteTest`, this is a real run: its steps act, messages are sent, records change, and it appears in `Automation.runs`. It works whether or not the automation is turned on, and passes through the trigger's filter like any event. The run continues in the background; read it again with `automationRun`. Null if the automation doesn't exist or has never been published. INVALID_PAYLOAD, with the failing fields, for a payload that doesn't match the trigger's event; AUTOMATION_FILTERED when the trigger's filter drops it, so nothing runs.

**Required scopes:** [`automations_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-automations_write)

## Arguments

**id** `ID!` *required*

The automation's id.

**idempotencyKey** `String`

A key of your choosing. Repeating a call with the same key returns the first run rather than starting another.

**payload** *required*

The trigger's event, as the trigger's page in `automationCatalog` describes it.

## Returns

**automationExecute**

One execution of an automation. Runs are deleted 30 days after they finish.

**fields**

**automation** *required*

The automation this run belongs to.

**Requires:** [`automations_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-automations_read)

**fields**

**createdAt** *required*

When the automation was created.

**enabled** `Boolean!` *required*

Whether the automation runs when its trigger fires. Change it with `automationUpdate`.

**id** `ID!` *required*

The id of this automation.

**name** `String!` *required*

The automation's name.

**publishedVersion** `Int`

The latest published version; null until first published.

**revision** `String!` *required*

The draft's revision. Opaque; pass it to `automationPublish` as `expectedRevision`.

**runs** *required*

Runs, newest first. Runs are deleted 30 days after they finish.

**Requires:** [`automations_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-automations_read)

**fields**

**Arguments**

**after** `String`

Returns runs after this cursor.

**first** `Int`

Returns the first N runs (max 100, default 25).

**status**

Only runs with one of these statuses.

**Fields**

**edges** *required*

The list of edges (each a node plus its pagination `cursor`).

**nodes** *required*

The nodes in this page, without the edge/cursor wrapper — a convenience over `edges`.

**pageInfo** *required*

Pagination metadata for the current page.

**script** `String!` *required*

The draft as AutomationScript, Function code inline. To change it, open a workspace with `workspaceCreate`.

**triggerKind** `String!` *required*

The draft's trigger kind.

**updatedAt** *required*

When the automation was last changed.

**versionStrategy** *required*

Which version runs already in flight continue on.

**versions** *required*

Published versions, newest first.

**Requires:** [`automations_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-automations_read)

**fields**

**Arguments**

**after** `String`

Returns versions after this cursor.

**first** `Int`

Returns the first N versions (max 100, default 25).

**Fields**

**edges** *required*

The list of edges (each a node plus its pagination `cursor`).

**nodes** *required*

The nodes in this page, without the edge/cursor wrapper — a convenience over `edges`.

**pageInfo** *required*

Pagination metadata for the current page.

**failure**

Why the run failed; null unless `status` is FAILED.

**fields**

**message** `String!` *required*

The error the run stopped on.

**stepId** `String`

The step that failed, or null for the run as a whole.

**finishedAt**

When the run finished; null while running or waiting.

**id** `ID!` *required*

The id of this run.

**startedAt** *required*

When the run started.

**status** *required*

Where the run is in its lifecycle.

**steps** *required*

The steps the run executed, in order, with their inputs, outputs and effects.

**fields**

**effects** *required*

Side effects the step performed, each with its result.

**finishedAt**

When the step finished; null while it runs or waits.

**inputs**

The step's evaluated config.

**kind** `String!` *required*

The step's kind.

**note** `String`

A note the step left, such as why it was skipped.

**outcome** `String`

completed, disabled, failed or cancelled; null while running.

**output**

What the step produced, as later steps read it.

**port** `String`

The output port the run left the step by.

**startedAt** *required*

When the step started.

**stepId** `String!` *required*

The step's id in the automation's script.

**version** `Int!` *required*

The automation version the run is on. A waiting run that a publish moves to a newer version keeps reporting the old one until it resumes.

## Example

```graphql theme={null}
mutation {
  automationExecute(id: "...", idempotencyKey: "...", payload: "...") {
    finishedAt
    id
    startedAt
    status
    version
  }
}
```


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