---
title: "Manually run a trigger"
method: POST
path: "/triggers/{trigger-name}/run"
tags: ["Runs"]
---

# Manually run a trigger

`POST /triggers/{trigger-name}/run`

Creates an ad hoc run of the trigger. You can run triggers that are _not_ in the `cancelled` state.

## Request body

- object
  - `mode` 'sync' | 'async'

## Response `200`

OK

- Run — Defines a single run for a trigger. A run is an "instance" of a trigger that was created at a given point in time to execute an action (e.g. deliver a webhook)
  - `id` string — A unique identifier generated by the server to identify a particular run of the trigger.
  - `created_at` string, date-time — RFC3339 datetime indicating when the run was created.
  - `action` WebhookTarget
    - `url` string, uri, required — The URL of the webhook end point that cronback will send the request to when the trigger runs. The URL **must** be publicly accessible. Cronback will reject URLs that resolve to IP addresses within [Private Networks](https://en.wikipedia.org/wiki/Private_network).
    - `http_method` 'GET' | 'PUT' | 'PATCH' | 'HEAD' | 'DELETE' | 'POST' — Defines the [HTTP request method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) that cronback will use to invoke the webhook.
    - `timeout_s` number, double — The number of seconds (use fractions for millis) to wait before considering the webhook attempt as `failed`. This timeout is inclusive of DNS resolution, network, and any other latency incurred during the call.
    - `type` 'webhook' — An optional string to indicate the type of action. The only supported type is `webhook` at the moment.
    - `retry` union
      - SimplyRetry — You can choose between a simple retry policy (every X seconds) or an exponential backoff retry policy. Setting `retry: null` (default) means that no retries will take place, if a request to the webhook target fails, the run will immediately be marked as `failed`. Note that runs can run concurrently, new runs will still get created according to schedule even if one of more existing runs are still retrying (in `attempting` state).
        - `max_num_attempts` integer — The maximum number of attempts before giving up
        - `delay_s` number, float — The delay in seconds between every attempt
        - `type` string, required
      - ExponentialBackoffRetry — You can choose between a simple retry policy (every X seconds) or an exponential backoff retry policy. Setting `retry: null` (default) means that no retries will take place, if a request to the webhook target fails, the run will immediately be marked as `failed`. Note that runs can run concurrently, new runs will still get created according to schedule even if one of more existing runs are still retrying (in `attempting` state).
        - `max_num_attempts` integer, required — The maximum number of attempts before giving upon that particular run.
        - `delay_s` number, double, required — The initial delay in seconds between attempts. This value is doubled on every subsequent attempt
        - `max_delay_s` number, double, required — The upper cap for the delay. Delays are doubled on each attempt until it reaches `max_delay_s`
        - `type` string, required
  - `status` 'attempting' | 'succeeded' | 'failed' — The status of the run. An `attempting` run means that it's still in-progress, there are possibly one or more delivery attempts linked to this run. Both `succeeded` and `failed` are terminal states.
  - `payload` Payload — Details of the payload that will be sent out by cronback when a trigger is run.
    - `body` string — The body of the payload is sent as is when a trigger is run
    - `content_type` string — Sets the `Content-Type` header for the webhook request.
    - `headers` object — Additional headers that will be sent when the trigger runs.
  - `latest_attempt` WebhookAttempt
    - `status` 'succeeded' | 'failed' — The status of this particular webhook delivery attempt. Note that if a run has `retry` configured, each retry will generate a separate attempt object.
    - `details` object
      - `response_code` integer — The http status code returned from the webhook end point.
      - `response_latency_s` number, double — The total latency for this webhook delivery attempt. This measures how fast the webhook end point responded to cronback.
      - `error_message` string, nullable — If delivery was not successful, this will hold a human readable error message.
    - `created_at` string, date-time — RFC3339 datetime indicating the time this attempt was created.
    - `attempt_num` integer — Indicates the order of this delivery attempt in a trigger run.

## Other responses

- `404` — An error has occurred. The error body contains information about what went wrong.
- `422` — An error has occurred. The error body contains information about what went wrong.

## Changes

- **2023-07-14** (v1) `8adff51de02f` — 1 info
  - added the optional property `latest_attempt` to the response with the `200` status

[Change history](https://skmtc.dev/devtari-io/apis/cronback-me-api/changes/triggers/:trigger-name/run/post.md)

---

[API](https://skmtc.dev/devtari-io/apis/cronback-me-api.md) · [All operations](https://skmtc.dev/devtari-io/apis/cronback-me-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/devtari-io/cronback-me-api/revisions/4bd8baba5434/schema)
