Skip to content
Connect an agent
Billing

Read the account's plan

The plan the account gets right now, the status of its subscription, when the period paid for ends, whether it is set to end then, and whether the account has billing details at Stripe.

GET/user/billing

TL;DR

QuestionAnswer
What does it do?Read the account's plan.
What does it take?Nothing.
What does it return?Status 200 with a body of type BillingState.
What can go wrong?401 not signed in; 429 too many requests. Every failure uses the one error envelope.

What it does

The plan the account gets right now, the status of its subscription, when the period paid for ends, whether it is set to end then, and whether the account has billing details at Stripe. Reads the account's own record and does not call Stripe.

Responses

StatusMeaningBody
200The account's plan.BillingState
401Not signed in.ErrorResponse
429Too many requests.ErrorResponse

Response body

A 200 answer has the type BillingState.

FieldTypeRequiredDescription
plan"free" | "pro"yesThe plan the account gets right now. It is the free plan whenever the subscription is not paying, whatever plan was bought.
statusstringyesStripe's status for the subscription (active, trialing, past_due, canceled, unpaid, incomplete, and so on), or none when the account never started one.
currentPeriodEndinteger | nullyesWhen the period paid for ends, in milliseconds since the epoch, or null when there is no subscription.
cancelAtPeriodEndbooleanyesTrue while the subscription is scheduled to end at the close of the period already paid for.
hasCustomerbooleanyesTrue once the account has billing details at Stripe, which is when the billing portal can be opened.

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools