Moonborn — API · billing
Cancel the subscription (immediately or at period end)
Default is `cancelAtPeriodEnd=true`: paid features remain until `currentPeriodEnd`. `cancelImmediately=true` revokes access immediately and prorates the unused portion (subject to plan).
DELETE/v1/billing/subscriptionscope · Bearer (API key or session JWT)
Request body
| Field | Type | Description |
|---|---|---|
| cancelImmediately | boolean | |
| reason | string · "too_expensive" | "missing_features" | "switched_provider" | "unused" | "other" | |
| feedback | string |
Responses
200OK
Body
| Field | Type | Description |
|---|---|---|
| subscriptionIdreq | string | |
| orgIdreq | string | |
| planTierreq | string · "free" | "pro" | "team" | "enterprise" | |
| statusreq | string · "trialing" | "active" | "past_due" | "canceled" | "incomplete" | "unpaid" | |
| intervalreq | string · "month" | "year" | |
| currencyreq | string | |
| recurringAmountMinorreq | number | |
| trialEndsAtreq | string | |
| currentPeriodStartreq | string | |
| currentPeriodEndreq | string | |
| cancelAtPeriodEndreq | boolean | |
| createdAtreq | string | |
| updatedAtreq | string |
401Unauthenticated
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
404No active subscription
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
409Subscription already canceled
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
422Validation error
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
Examples
cURL
curl -X DELETE https://api.moonborn.co/v1/billing/subscription \
-H "Authorization: Bearer $MOONBORN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"cancelImmediately": false,
"reason": "too_expensive",
"feedback": "<string>"
}'TypeScript
import Moonborn from '@moonborn/sdk';
const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });
const result = await client.billing.cancelSubscription({
cancelImmediately: false,
reason: "too_expensive",
feedback: "<string>",
});Python
import os
from moonborn import Moonborn
client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])
result = client.billing.cancel_subscription(
cancel_immediately=False,
reason="too_expensive",
feedback="<string>",
)