Get the workspace subscription
const url = 'https://api.pitch2sale.com/api/v1/billing/subscription';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.pitch2sale.com/api/v1/billing/subscription \ --header 'Authorization: Bearer <token>'The current (or most recent) Cashfree subscription, whether self-serve checkout is available, the Cashfree environment, the billing currency, and the resolved access level. entitled_plan is the plan the workspace is entitled to now; subscription.plan_slug is the plan the subscription bills, which becomes the entitled plan only once its first charge succeeds (subscription.charged). subscription.cancel_note states what cancelling means (a never-charged payment setup ends at once and changes nothing), and subscription.review_reason is set when a payment needs review (e.g. collect_at_auth_amount_mismatch: the authorization did not collect the first month, nothing was activated and the mandate was canceled). checkout_terms (collect_at_auth, first_charge_at, reason: trial_end | paid_through) is what a new checkout would charge when, decided by the server. switch_to_yearly is a switch from monthly to yearly now in progress, or null: status (awaiting_authorisation | awaiting_payment), plan_slug, seats, yearly_charge_minor, currency, and order (id, charge_minor, net_minor, tax_minor, credit_net_minor, expires_at, cf_order_id, payment_session_id) once the yearly mandate is authorised. flat_price is the flat price this workspace keeps for one plan and interval (re-authorising its flat subscription, or coming back within 90 days of a paid flat subscription ending), or null: plan_slug, interval, currency, amount_minor (per workspace, before tax); a checkout for that plan and interval takes no seats and charges it. Requires settings.view_own.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”OK
Authentication required or token invalid
object
object
Examplegenerated
{ "error": "example", "code": "example", "message": "example", "details": [ { "field": "example", "message": "example", "code": "example" } ]}Role permission or token scope missing; OAuth app tokens are not accepted on this route
object
object
Examplegenerated
{ "error": "example", "code": "example", "message": "example", "details": [ { "field": "example", "message": "example", "code": "example" } ]}Rate limit exceeded
object
object
Examplegenerated
{ "error": "example", "code": "example", "message": "example", "details": [ { "field": "example", "message": "example", "code": "example" } ]}