Skip to main content
POST
Cancel a subscription
Calling cancel again on an already-canceled subscription is a no-op. It returns the same result without hitting the card processor a second time. If the subscription never completed a first successful charge (stripeSubscriptionId is null), cancel returns 400.

Authorizations

x-api-key
string
header
required

Your secret key, from app.agentaos.ai -> Settings -> Developers -> API Keys. The key's prefix is both its identity and its environment: sk_test_... (sandbox, free, no verification) or sk_live_... (real money, requires business verification). A missing or invalid key returns 401.

Path Parameters

id
string<uuid>
required

Subscription UUID (the id field from the list response, not stripeSubscriptionId).

Body

application/json
atPeriodEnd
boolean
default:true

true schedules the cancellation for period end. false cancels now.

Response

The subscription's updated cancellation state.

status
enum<string>
required
Available options:
incomplete,
incomplete_expired,
trialing,
active,
past_due,
canceled,
unpaid,
paused
currentPeriodEnd
string<date-time> | null
required
cancelAtPeriodEnd
boolean
required
effectiveCancelDate
string<date-time> | null
required