Automations

Update Automation

Changed on

Renames an automation, changes its trigger event before its first publish, sets its secrets, or changes its status. Changing secrets or status also needs automation:manage. Use POST /automations/{id}/publish to publish the draft, and the steps endpoints to change what it does.

patch/automations/{id}

Request

  • Base URL
    https://api.whop.com/api/v1
  • Auth
    HTTP bearer

Path parameters

id, string required

Automation ID, prefixed ato_.

Headers

Api-Version-Date, string
Example:2026-11-30

Pins the request to a dated API version.

Request body

object required
name, string

The automation's name, shown on the dashboard. Up to 255 characters.

secrets, object

Secrets to set, by name, merged into the automation's: a name set to null is removed. Step code reads them as environment variables, and no endpoint returns their values. Names are uppercase letters, digits and underscores, starting with a letter, up to 64 characters. Up to 50 secrets, each up to 4 KB.

status, 'active' | 'closed' | 'stopped'

active enrolls members and runs their steps. closed stops new enrollments and lets members already in it finish. stopped stops new enrollments and ends every member's enrollment. active and closed need a published version.

trigger_event, 'payment.succeeded' | 'payment.failed' | 'membership.activated' | 'membership.trial_ending_soon' | 'membership.cancel_at_period_end_changed' | 'member.created' | 'invoice.created' | 'invoice.paid' | 'invoice.past_due' | 'refund.created' | 'dispute.created' | 'resolution_center_case.created' | 'resolution_center_case.decided' | 'course_lesson_interaction.completed' | 'null' nullable

The webhook event that enrolls the member it's about, such as payment.succeeded. null for an automation that only POST /automations/{id}/trigger enrolls into. Fixed once the automation has been published.

Example request

{
  "name": "Still running",
  "secrets": {
    "SHOP_TOKEN": "shpat_123"
  },
  "status": "stopped",
  "trigger_event": "payment.succeeded"
}

Response

Automation updated

Automation required
account_id, string required

ID of the account the automation belongs to, prefixed biz_.

active_enrollments_count, integer required

Members currently in the automation.

created_at, string required

When the automation was created, as an ISO 8601 timestamp.

created_by_actor, AutomationActor required

Who created the automation.

draft_version, integer required

The version that step edits change. Always published_version plus one, or 1 before the first publish.

has_unpublished_changes, boolean required

Whether the draft has edits that POST /automations/{id}/publish would publish. Always true before the first publish.

id, string required

Automation ID, prefixed ato_.

name, string required

The automation's name, shown on the dashboard. Up to 255 characters.

published_at, string nullable required

When the automation was last published, as an ISO 8601 timestamp. null until its first publish.

published_by_actor, AutomationActor nullable required
published_version, integer nullable required

The version new members start on. null until the automation is first published.

secret_names, string[] required
status, 'active' | 'closed' | 'stopped' required

active enrolls members and runs their steps. closed enrolls no one new, and members already in it finish. stopped enrolls no one, and its members' enrollments have ended. A new automation is stopped until its first publish makes it active.

total_enrollments_count, integer required

How many times members have enrolled in the automation, including enrollments that have ended.

trigger_event, 'payment.succeeded' | 'payment.failed' | 'membership.activated' | 'membership.trial_ending_soon' | 'membership.cancel_at_period_end_changed' | 'member.created' | 'invoice.created' | 'invoice.paid' | 'invoice.past_due' | 'refund.created' | 'dispute.created' | 'resolution_center_case.created' | 'resolution_center_case.decided' | 'course_lesson_interaction.completed' | 'null' nullable required

The webhook event that enrolls the member it's about, such as payment.succeeded. null for an automation that only POST /automations/{id}/trigger enrolls into. Fixed once the automation has been published.

updated_at, string required

When the automation was last updated, as an ISO 8601 timestamp.

Example response

{
  "account_id": "biz_xxxxxxxxxxxxxx",
  "created_at": "2026-01-01T12:00:00.000Z",
  "created_by_actor": {
    "id": "biz_xxxxxxxxxxxxxx",
    "resource_type": "account"
  },
  "draft_version": 2,
  "id": "ato_xxxxxxxxxxxxxx",
  "name": "After an order",
  "published_at": "2026-01-01T12:00:00.000Z",
  "published_by_actor": {
    "id": "biz_xxxxxxxxxxxxxx",
    "resource_type": "account"
  },
  "published_version": 1,
  "secret_names": [
    "SHOP_TOKEN"
  ],
  "status": "active",
  "trigger_event": "payment.succeeded",
  "updated_at": "2026-01-01T12:00:00.000Z"
}

Changes

    • warning

      added the new membership.cancel_at_period_end_changed enum value to the trigger_event response property for the response status

    • info

      added the new membership.cancel_at_period_end_changed enum value to the request property trigger_event

    • breaking

      removed the required property created_by_actor/object from the response with the status

    3 more changes in this revision