billing
9 calls. Every request needs the Authorization header: see the overview.
billing.alerts
Section titled “billing.alerts”GET /billing/alertsThe low-balance and work-refused alerts the tenant’s admins get.
Who can call it: Admins and members, with an API key or a portal session. Try it in the API playground.
Response: LowBalanceAlertSettings (200)
curl -X GET "https://api.maitento.com/billing/alerts" \ -H "Authorization: $MAITENTO_AUTH"const alerts = await mt.billing.alerts();mt.billing.alerts()billing.setAlerts
Section titled “billing.setAlerts”PUT /billing/alertsReplaces the alerts (Tenant.Admin).
Who can call it: Tenant admins only, with an API key or a portal session. Try it in the API playground.
Request body: LowBalanceAlertSettingsInput
| Field | Type | Required | Description |
|---|---|---|---|
emailAtPercentOfLastTopUp | integer | null | Email when the balance falls to this percentage of the last top-up; null for no email. | |
showPortalBanner | boolean | Show a banner in the portal while the balance is low: below LowBalanceAlertSettings.EmailAtPercentOfLastTopUp of the last top-up, or below 20% of it when the email is off. The billing standing’s lowBalance says when. | |
emailWhenWorkRefused | boolean | Email when work is refused because the balance has run out. |
Response: LowBalanceAlertSettings (200)
curl -X PUT "https://api.maitento.com/billing/alerts" \ -H "Authorization: $MAITENTO_AUTH" \ -H "Content-Type: application/json" \ -d '{"emailAtPercentOfLastTopUp":0,"showPortalBanner":false,"emailWhenWorkRefused":false}'await mt.billing.setAlerts({ emailAtPercentOfLastTopUp: 20, showPortalBanner: true, emailWhenWorkRefused: true });mt.billing.set_alerts(email_at_percent_of_last_top_up=20, show_portal_banner=True, email_when_work_refused=True)billing.autoTopUp
Section titled “billing.autoTopUp”GET /billing/auto-top-upThe automatic top-up: whether it’s on, when it buys credit and how much, and whether it stopped.
Who can call it: Admins and members, with an API key or a portal session. Try it in the API playground.
Response: AutoTopUpView (200)
curl -X GET "https://api.maitento.com/billing/auto-top-up" \ -H "Authorization: $MAITENTO_AUTH"const autoTopUp = await mt.billing.autoTopUp();mt.billing.auto_top_up()billing.setAutoTopUp
Section titled “billing.setAutoTopUp”PUT /billing/auto-top-upTurns the automatic top-up on or off, or changes it (Tenant.Admin). Saving it again restarts one that stopped.
Who can call it: Tenant admins only, with an API key or a portal session. Try it in the API playground.
Request body: AutoTopUpApiRequest
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | ||
thresholdAmount | number | Buy more when the balance falls below this, in the billing currency. | |
topUpAmount | number | How much to buy each time; at least the minimum top-up. |
Response: AutoTopUpView (200)
curl -X PUT "https://api.maitento.com/billing/auto-top-up" \ -H "Authorization: $MAITENTO_AUTH" \ -H "Content-Type: application/json" \ -d '{"enabled":false,"thresholdAmount":0,"topUpAmount":0}'await mt.billing.setAutoTopUp({ enabled: true, thresholdAmount: 10, topUpAmount: 50 });mt.billing.set_auto_top_up(enabled=True, threshold_amount=10, top_up_amount=50)billing.balance
Section titled “billing.balance”GET /billing/balanceThe balance, and whether it can pay for more work.
Who can call it: Admins and members, with an API key or a portal session. Try it in the API playground.
Response: TenantBalance (200)
curl -X GET "https://api.maitento.com/billing/balance" \ -H "Authorization: $MAITENTO_AUTH"const { balance, currency } = await mt.billing.balance();mt.billing.balance()billing.catalogue
Section titled “billing.catalogue”GET /billing/catalogueThe plans on sale, cheapest first, with what each includes and costs (the tenant’s own plan among them).
Who can call it: Admins and members, with an API key or a portal session. Try it in the API playground.
Response: BillingCatalogue (200)
curl -X GET "https://api.maitento.com/billing/catalogue" \ -H "Authorization: $MAITENTO_AUTH"const { tiers } = await mt.billing.catalogue();mt.billing.catalogue()billing.notices
Section titled “billing.notices”GET /billing/noticesThe tenant’s latest billing notices (what its Billing webhooks were sent), newest first.
Who can call it: Admins and members, with an API key or a portal session. Try it in the API playground.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer |
Response: BillingNotice[] (200)
curl -X GET "https://api.maitento.com/billing/notices" \ -H "Authorization: $MAITENTO_AUTH"const notices = await mt.billing.notices({ limit: 10 });mt.billing.notices(limit=10)billing.plan
Section titled “billing.plan”GET /billing/planWhat the plan includes and costs: allowances, lanes, limits, retention, priority and prices.
Who can call it: Admins and members, with an API key or a portal session. Try it in the API playground.
Response: EffectiveEntitlements (200)
curl -X GET "https://api.maitento.com/billing/plan" \ -H "Authorization: $MAITENTO_AUTH"const plan = await mt.billing.plan();mt.billing.plan()billing.standing
Section titled “billing.standing”GET /billing/standingWhere the tenant stands: its plan and its state, its balance, whether it can start work (out of credit, or an allowance used up), any plan change on its way, and this billing period’s use of each allowance.
Who can call it: Admins and members, with an API key or a portal session. Try it in the API playground.
Response: BillingStanding (200)
curl -X GET "https://api.maitento.com/billing/standing" \ -H "Authorization: $MAITENTO_AUTH"const standing = await mt.billing.standing();mt.billing.standing()