---
title: "Invoke an Ad Hoc Automation"
method: POST
path: "/automations/invoke"
tags: ["Automations"]
---

# Invoke an Ad Hoc Automation

`POST /automations/invoke`

Runs a series of automation steps supplied inline, without a saved template, and returns a runId.

## Headers

- `Idempotency-Key` string
- `x-idempotency-expiration` string

## Request body

- AutomationAdHocInvokeParams
  - `automation` Automation, required
    - `cancelation_token` string, nullable
    - `steps` AutomationStep[], required
      - union
        - AutomationDelayStep
          - `action` 'delay', required
          - `duration` string, nullable
          - `until` string, nullable
        - AutomationSendStep
          - `action` 'send', required
          - `template` string, nullable
          - `brand` string, nullable
          - `data` object, nullable
          - `profile` object, nullable
          - `recipient` string, nullable
        - AutomationSendListStep
          - `action` 'send-list', required
          - `list` string, required
          - `data` object, nullable
          - `brand` string, nullable
        - AutomationUpdateProfileStep
          - `action` 'update-profile', required
          - `recipient_id` string, nullable
          - `merge` 'none' | 'overwrite' | 'soft-merge' | 'replace', nullable
          - `profile` object, required
        - AutomationCancelStep
          - `action` 'cancel', required
          - `cancelation_token` string, required
        - AutomationFetchDataStep
          - `action` 'fetch-data', required
          - `webhook` AutomationWebhookParams, required
            - `url` string, required
            - `method` 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', required
            - `headers` object, nullable
            - `body` string, nullable
          - `merge_strategy` 'replace' | 'overwrite' | 'soft-merge', nullable
        - AutomationInvokeStep
          - `action` 'invoke', required
          - `template` string, required
  - `brand` string, nullable
  - `data` object, nullable
  - `profile` object, nullable
  - `recipient` string, nullable
  - `template` string, nullable

## Response `200`

- AutomationInvokeResponse
  - `runId` string, required

---

[API](https://skmtc.net/trycourier/apis/courier.md) · [All operations](https://skmtc.net/trycourier/apis/courier/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/trycourier/courier/versions/04f69fbf96a5/schema)
