Subscription API
Manage subscription and billing information.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET | /subscription | Get current subscription |
POST | /subscription/portal | Get billing portal URL |
GET | /subscription/invoices | List invoices |
GET | /subscription/usage | Get 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
| Status | Description |
|---|---|
active | Subscription is active and paid |
trialing | In free trial period |
past_due | Payment failed, grace period |
canceled | Subscription canceled |
unpaid | Payment 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
| Field | Type | Required | Description |
|---|---|---|---|
returnUrl | string | No | URL to redirect after portal |
Example Request
Loading code block...
Response
Loading code block...
List Invoices
Loading code block...
Query Parameters
| Parameter | Type | Description |
|---|---|---|
limit | integer | Number of invoices (default: 10) |
status | string | Filter: 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
| Feature | Free | Pro | Team | Enterprise |
|---|---|---|---|---|
| Price | $0 | $19/mo | $49/user/mo | Custom |
| Projects | 1 | 10 | 50 | Unlimited |
| API Calls/mo | 1,000 | 10,000 | 50,000 | Custom |
| Agent Invocations/mo | 50 | 1,000 | 5,000 | Custom |
| Team Members | 1 | 1 | Unlimited | Unlimited |
| Priority Support | No | Yes | Yes | Yes |
| Custom Agents | No | No | Yes | Yes |
| Policy Controls | No | No | Yes | Yes |
| SLA | No | No | 99.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:
| Event | Description |
|---|---|
subscription.created | New subscription started |
subscription.updated | Subscription plan changed |
subscription.canceled | Subscription canceled |
invoice.paid | Invoice payment successful |
invoice.payment_failed | Invoice payment failed |
See Webhooks for setup.
Errors
| Code | Description |
|---|---|
no_subscription | User has no subscription |
subscription_canceled | Subscription is canceled |
payment_required | Payment method needed |
portal_error | Failed to create portal session |