Skip to Content
API ReferenceSupport automation rules

Create a support automation rule

Create a paused rule that will answer matching tickets on its own.

A rule acts on real tickets without anyone on your team once it is switched on: it messages the customer, can credit a wallet refund, and can close the ticket. Leave is_active out so the rule starts paused, test it with the dry run, then switch it on. A refunding rule also needs support automation on and a daily refund cap.

POST
/v2/support-automation-rules

Create an automation rule, paused unless you send is_active: true. Once switched on, a rule answers new matching tickets without anyone on your team: it posts its template as a reply to the customer, can credit a refund to the customer's store wallet, and can close the ticket. Create it paused, test it with the dry run, then switch it on with the state endpoint. name and response_template_id are required. Conditions you leave out or send as null match every ticket. Amounts are integer USD cents (1999 means $19.99), and action_refund_percent_basis is in hundredths of a percent (5000 is 50%). A field the rule does not take returns 422 naming it. The new rule is checked after your existing rules. Requires the support.automation API-key ability, and the key's user needs the Support Automation role in the store (owners and administrators have it). Not safe to retry blindly: a repeated request creates a second rule, so list the rules first when a response is lost. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.

Authorization

headerAuthorizationBearer <API Key>

Provide your SellApp API key as a bearer token.

Header Parameters

X-STORE?string

Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.

Request Body

application/json
  1. body
name*string

Name your team sees in the rule list.

Lengthlength <= 120
match_reason_source?|

With match_reason_code, the ticket reason the rule answers: platform for a built-in reason, store for one of yours. Send both or neither; null on both answers any reason. A store reason must be active and offered for every product. Read the codes from the support reason options endpoint.

Value in"platform""store"null
match_reason_code?|

A built-in reason code such as not_received, or your reason's slug. An unknown or unusable reason returns 422 on this field.

Lengthlength <= 64
match_product_ids?array<integer>

Products whose tickets the rule answers; a ticket about another product, or without a purchased item, does not match. [] answers every product. At most 200 distinct IDs of your store's products; a repeated, unknown or deleted product returns 422 on match_product_ids.{index}, except a product the rule already names.

Itemsitems <= 200
match_customer_filter?|

first_purchase answers customers with at most one completed order within history_window, repeat answers customers with more.

Value in"first_purchase""repeat"null
history_window?|

How far back the customer-history conditions look: the last 7, 30 or 90 days, or all_time, which is the default.

Value in"7d""30d""90d""all_time"null
match_min_order_total_cents?|

Lowest value of the total of the ticket's purchased item, in integer USD cents (1999 means $19.99). A ticket without a purchased item does not match when either is set.

Range0 <= value <= 999999999999
match_max_order_total_cents?|

Highest value of the total of the ticket's purchased item, in integer USD cents (1999 means $19.99). A ticket without a purchased item does not match when either is set. Lower than the minimum returns 422 on this field.

Range0 <= value <= 999999999999
min_completed_orders?|

Lowest value of how many completed orders the customer has with your store within history_window.

Range0 <= value <= 4294967295
max_completed_orders?|

Highest value of how many completed orders the customer has with your store within history_window. Lower than the minimum returns 422 on this field.

Range0 <= value <= 4294967295
min_lifetime_spend_cents?|

Lowest value of what the customer spent on completed orders within history_window, in integer USD cents.

Range0 <= value <= 999999999999
max_lifetime_spend_cents?|

Highest value of what the customer spent on completed orders within history_window, in integer USD cents. Lower than the minimum returns 422 on this field.

Range0 <= value <= 999999999999
min_prior_ticket_count?|

Lowest value of how many other tickets the customer opened within history_window.

Range0 <= value <= 4294967295
max_prior_ticket_count?|

Highest value of how many other tickets the customer opened within history_window. Lower than the minimum returns 422 on this field.

Range0 <= value <= 4294967295
min_prior_support_refund_count?|

Lowest value of how many support wallet refunds the customer received on other tickets within history_window, not counting reversed ones.

Range0 <= value <= 4294967295
max_prior_support_refund_count?|

Highest value of how many support wallet refunds the customer received on other tickets within history_window, not counting reversed ones. Lower than the minimum returns 422 on this field.

Range0 <= value <= 4294967295
min_prior_support_refund_cents?|

Lowest value of the total of those support wallet refunds, in integer USD cents.

Range0 <= value <= 999999999999
max_prior_support_refund_cents?|

Highest value of the total of those support wallet refunds, in integer USD cents. Lower than the minimum returns 422 on this field.

Range0 <= value <= 999999999999
customer_age_days_min?|

Lowest value of days since the customer's first completed order within history_window.

Range0 <= value <= 4294967295
customer_age_days_max?|

Highest value of days since the customer's first completed order within history_window. Lower than the minimum returns 422 on this field.

Range0 <= value <= 4294967295
response_template_id*|

The reply template the rule sends. It must be one of your active templates with supports_auto_respond; another returns 422 on this field. If the template is paused or taken off automation later, a rule that only replies stops answering and lets the next rule try, and a rule that also refunds or closes takes the tickets it matches but does nothing for them.

action_refund_kind?|

The wallet refund the rule credits to the customer: full refunds what is left to refund on the ticket's item, partial a share of it set by action_refund_percent_basis, fixed the amount in action_refund_fixed_cents. null means the rule does not refund.

Value in"full""partial""fixed"null
action_refund_percent_basis?|

For a partial refund only: the share in hundredths of a percent, so 5000 is 50% and 750 is 7.5%. The refund is rounded down to the cent. Sent with another kind, it returns 422.

Range1 <= value <= 10000
action_refund_fixed_cents?|

For a fixed refund only: the amount in integer USD cents (500 means $5.00). Sent with another kind, it returns 422. When the item has less left to refund, the refund fails and the rule does nothing for that ticket.

Range1 <= value <= 999999999999
action_refund_cap_cents?|

Most the rule refunds automatically for one order, in integer USD cents, counted across all tickets about that order. A refund is reduced to what is left under it; when nothing is left, the rule does nothing for that ticket. Needs action_refund_kind.

Range1 <= value <= 999999999999
action_close_outcome?|

When set, the rule closes the ticket with this outcome after replying. null leaves the ticket open.

Value in"refunded""refunded_partial""delivered""no_action""duplicate""other"null
is_active?boolean

Leave it out, or send false, to create the rule paused, then switch it on with the state endpoint after testing. true switches it on at once; for a refunding rule that returns 422 on is_active while support automation is on and no daily refund cap is set.

id?integer

Read-only. Accepted so a read can be sent back.

archived?boolean

Accepted only as false.

currency?"USD"

Read-only. Accepted only as USD.

Value in"USD"
created_at?|

Read-only. Accepted so a read can be sent back.

Formatdate-time
updated_at?|

Read-only and not checked. Send expected_updated_at to refuse a stale change.

Formatdate-time

Response Body

Automation rule created.

application/json
  1. response
data*
Example Request
curl -X POST 'https://sell.app/api/v2/support-automation-rules' \  -H 'X-STORE: launch-lab' \  -H 'Content-Type: application/json' \  -d '{  "name": "Expired download links",  "response_template_id": 32,  "match_reason_source": "store",  "match_reason_code": "download-link-expired",  "match_product_ids": [    120  ],  "match_max_order_total_cents": 5000,  "max_prior_support_refund_count": 0,  "action_refund_kind": "partial",  "action_refund_percent_basis": 5000,  "action_refund_cap_cents": 1000,  "action_close_outcome": "refunded_partial"}'
{  "data": {    "id": 7,    "name": "Expired download links",    "is_active": false,    "archived": false,    "priority": 1,    "match_reason_source": "store",    "match_reason_code": "download-link-expired",    "match_product_ids": [      120    ],    "match_min_order_total_cents": null,    "match_max_order_total_cents": 5000,    "match_customer_filter": null,    "history_window": "all_time",    "min_completed_orders": null,    "max_completed_orders": null,    "min_lifetime_spend_cents": null,    "max_lifetime_spend_cents": null,    "min_prior_ticket_count": null,    "max_prior_ticket_count": null,    "min_prior_support_refund_count": null,    "max_prior_support_refund_count": 0,    "min_prior_support_refund_cents": null,    "max_prior_support_refund_cents": null,    "customer_age_days_min": null,    "customer_age_days_max": null,    "response_template_id": 32,    "action_refund_kind": "partial",    "action_refund_percent_basis": 5000,    "action_refund_fixed_cents": null,    "action_refund_cap_cents": 1000,    "action_close_outcome": "refunded_partial",    "currency": "USD",    "created_at": "2026-07-03T09:20:00.000000Z",    "updated_at": "2026-07-03T09:20:00.000000Z"  }}