Subscription API

Manage subscription and billing information.

Endpoints#

MethodEndpointDescription
GET/subscriptionGet current subscription
POST/subscription/portalGet billing portal URL
GET/subscription/invoicesList invoices
GET/subscription/usageGet usage against plan limits

Subscription Object#

Loading code block...

Get Subscription#

Loading code block...

Example Request#

Loading code block...

Response#

Loading code block...

Subscription Statuses#

StatusDescription
activeSubscription is active and paid
trialingIn free trial period
past_duePayment failed, grace period
canceledSubscription canceled
unpaidPayment failed, access restricted

Get Billing Portal#

Loading code block...

Generates a URL to the Stripe billing portal where users can manage their subscription.

Request Body#

FieldTypeRequiredDescription
returnUrlstringNoURL to redirect after portal

Example Request#

Loading code block...

Response#

Loading code block...

List Invoices#

Loading code block...

Query Parameters#

ParameterTypeDescription
limitintegerNumber of invoices (default: 10)
statusstringFilter: paid, open, void

Example Request#

Loading code block...

Response#

Loading code block...

Get Usage vs Limits#

Loading code block...

Example Request#

Loading code block...

Response#

Loading code block...

Plan Comparison#

FeatureFreeProTeamEnterprise
Price$0$19/mo$49/user/moCustom
Projects11050Unlimited
API Calls/mo1,00010,00050,000Custom
Agent Invocations/mo501,0005,000Custom
Team Members11UnlimitedUnlimited
Priority SupportNoYesYesYes
Custom AgentsNoNoYesYes
Policy ControlsNoNoYesYes
SLANoNo99.9%99.99%

Upgrade Subscription#

Upgrading is done through the billing portal:

Loading code block...

Cancel Subscription#

Cancellation is also done through the billing portal. The subscription remains active until the end of the current billing period.

Check Cancellation Status#

Loading code block...

Webhooks#

Subscribe to billing events:

EventDescription
subscription.createdNew subscription started
subscription.updatedSubscription plan changed
subscription.canceledSubscription canceled
invoice.paidInvoice payment successful
invoice.payment_failedInvoice payment failed

See Webhooks for setup.

Errors#

CodeDescription
no_subscriptionUser has no subscription
subscription_canceledSubscription is canceled
payment_requiredPayment method needed
portal_errorFailed to create portal session