treg.to Billing API
The Billing API from treg.to — 5 operation(s) for billing.
The Billing API from treg.to — 5 operation(s) for billing.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/treg-to:treg-to-billing-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: treg Billing API
version: 0.0.1
tags:
- name: Billing
paths:
/billing:
get:
summary: Billing Get
description: 'The org''s billing state: whether top-ups are available at all on this deployment, whether
there''s a Stripe customer and a saved card, the auto-top-up policy + why it''s off if it is, and how
much of this month''s automatic cap has been used.'
operationId: billing_get_billing_get
parameters:
- name: x-treg-token
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Token
- name: x-treg-org
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Org
- name: treg_session
in: cookie
required: false
schema:
type: string
default: ''
title: Treg Session
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Billing Get Billing Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Billing
/billing/topup:
post:
summary: Billing Topup
description: 'Start a hosted Stripe Checkout for a one-off top-up and return its URL.
Returns a URL, not a credit: the balance moves when Stripe''s webhook says the payment succeeded
(see billing.py). Nothing about this response — including a payer who "completes" the success
redirect by hand — can create balance.'
operationId: billing_topup_billing_topup_post
parameters:
- name: x-treg-token
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Token
- name: x-treg-org
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Org
- name: treg_session
in: cookie
required: false
schema:
type: string
default: ''
title: Treg Session
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TopupIn'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Billing Topup Billing Topup Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Billing
/billing/autotopup:
post:
summary: Billing Autotopup
description: 'Set the org''s auto-top-up policy (and record consent when enabling).
Enabling without a card on file is not an error — the preferences and the consent are stored and a
Stripe-hosted card-capture URL comes back in `setup_url`. Finishing that page fires
`setup_intent.succeeded`, which saves the payment method and arms the policy. That ordering is
deliberate: consent is recorded against the numbers the human saw, before any card exists.'
operationId: billing_autotopup_billing_autotopup_post
parameters:
- name: x-treg-token
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Token
- name: x-treg-org
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Org
- name: treg_session
in: cookie
required: false
schema:
type: string
default: ''
title: Treg Session
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AutoTopupIn'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Billing Autotopup Billing Autotopup Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Billing
/billing/history:
get:
summary: Billing History
description: This team's paged top-ups and SSO invoices, newest first, with document links.
operationId: billing_history_billing_history_get
parameters:
- name: limit
in: query
required: false
schema:
type: integer
maximum: 100
minimum: 1
default: 24
title: Limit
- name: kind
in: query
required: false
schema:
type: string
default: all
title: Kind
- name: cursor
in: query
required: false
schema:
type: string
maxLength: 2048
default: ''
title: Cursor
- name: x-treg-token
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Token
- name: x-treg-org
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Org
- name: treg_session
in: cookie
required: false
schema:
type: string
default: ''
title: Treg Session
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Billing History Billing History Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Billing
/billing/portal:
post:
summary: Billing Portal
description: 'A one-time link into Stripe''s hosted billing portal — card, billing address, tax ID, and the
full invoice archive. 422 until the team has a Stripe customer, which it gets on its first
payment; `billing_state`''s `portal` flag is what the UI hides the button on.'
operationId: billing_portal_billing_portal_post
parameters:
- name: x-treg-token
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Token
- name: x-treg-org
in: header
required: false
schema:
type: string
default: ''
title: X-Treg-Org
- name: treg_session
in: cookie
required: false
schema:
type: string
default: ''
title: Treg Session
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Billing Portal Billing Portal Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Billing
components:
schemas:
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
AutoTopupIn:
properties:
enabled:
type: boolean
title: Enabled
threshold_usd:
anyOf:
- type: number
- type: 'null'
title: Threshold Usd
amount_usd:
anyOf:
- type: number
- type: 'null'
title: Amount Usd
monthly_cap_usd:
anyOf:
- type: number
- type: 'null'
title: Monthly Cap Usd
per_hour:
anyOf:
- type: integer
- type: 'null'
title: Per Hour
setup_url:
type: boolean
title: Setup Url
default: true
consent:
type: boolean
title: Consent
default: false
type: object
required:
- enabled
title: AutoTopupIn
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
TopupIn:
properties:
amount_usd:
anyOf:
- type: number
- type: 'null'
title: Amount Usd
checkout_source:
type: string
title: Checkout Source
default: ''
type: object
title: TopupIn