# POST /api/v2/automations/{automation}/actions/dry-run

Try an automation flow out on an example record

- MCP id: automations.actions.dry-run
- Scope: api:write:automations
- Scope: api:write:project_automations
- Scope: api:write:customer_automations
- Permission: automations::update
- Needs the automations feature on your organisation
- Rate cost: 1 unit, write bucket. A write costs the same whatever `view` you ask for.
- Cache-Control: private, no-store

Walks the flow the way a run would take it, on an example record, as you: every condition is decided and every step says what it would do, but nothing is written and nothing is sent.

A loop goes through 3 items at most, and a Wait does not wait. Send `record_id` to try it on a record you may see, or leave it out for the example the builder's editors share, or the record changed last. Send a `definition` to try an unsaved flow; a flow with problems is not tried (`outcome` `refused`, with the problems). Tries are limited per person in a short while. The declared permission is `automations::update`; for a project or customer automation, the `project_automations` or `customer_automations` permission of the same action applies instead.

## Parameters
- automation (integer, path): The Automation's numeric id. Accepts a soft-deleted record.
- view (string, optional): Which field set to render.
- X-Request-Id (header, optional): A correlation id of your own. It is recorded in our logs next to the server's request id but never returned: the response header always carries the server's id. A value that does not match the pattern is discarded silently, never rejected.
- If-Match (header, optional): The ETag a write is conditional on. A stale validator is 412 precondition-failed.
- Idempotency-Key (header, optional): A caller-chosen key that makes this POST safe to retry. Replaying it returns the original response with Idempotency-Replayed: true.

## Request body
- definition (object, optional): The flow to try, as a save takes it. Leave it out to try the current version.
  - nodes (array of any ≤ 100, optional): Required when definition is present.
  - edges (array of object ≤ 300, optional)
- record_id (string or null ≤ 255, optional): The key of the record to try it on, of the record type the trigger starts on, as a string such as `"42"`; a work item also by its issue key, such as `ACM-12`.

Unknown keys are refused with `422` validation-failed, naming the key.

## Response 200
- outcome (string ≤ 20, required): `completed`: every step it reached would do what it is asked; `stopped`: a condition did not hold for the example, so the steps after it were left alone; `halted`: a step stops the run on purpose; `failed`: a step would fail; `refused`: it did not start, such as for a flow with problems, no example record, or too many tries in a short while.
- message (string or null, required): Why it stopped, halted, failed or was refused.
- sample (object or null, required): The record it ran on; `null` for a trigger without a record.
  - record_type (string or null ≤ 255, optional): The record type of the example.
  - record_id (string or null ≤ 255, optional): Its key.
  - record_title (string or null, optional): Its title.
  - replaced (boolean, required): Whether the example the builder's editors share is one you may not see, so the record you changed last stands in.
- steps (array of object, required): Every step it reached, in the order it reached them.
- problems (array of object, required): For a flow with problems, which it refused to try: the same list `check-flow` gives.

## Errors
- 403 forbidden-by-policy | insufficient-permission | insufficient-token-scope: Forbidden.
- 409 idempotency-key-in-flight | idempotency-key-reused: Conflict.
- 412 precondition-failed: Precondition failed.
- 415 unsupported-media-type: Unsupported media type.
- 422 unprocessable-relationship | validation-failed: Unprocessable content.
- 400 idempotency-key-required | invalid-cursor | invalid-query-parameter | malformed-request | unsupported-parameter: Bad request.
- 401 token-expired | unauthenticated: Unauthenticated.
- 404 endpoint-not-found | resource-not-found: Not found.
- 406 not-acceptable: Not acceptable.
- 429 rate-limit-exceeded: Too many requests.
- 500 internal-error: Server error.
- 503 tenant-unavailable: Service unavailable.

## Example
```bash
curl -X POST \
  'https://<your-url>/api/v2/automations/1/actions/dry-run' \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: <key>' \
  -d '{}'
```
