The organisation's billing state.
const url = 'https://api.opdns.io/v1/account/billing';const options = { method: 'GET', headers: {cookie: '__Host-opdns_session=<__Host-opdns_session>'}};
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.opdns.io/v1/account/billing \ --cookie __Host-opdns_session=<__Host-opdns_session>Token scope: billing:read. The organisation owner only (403 owner_required
for another member, with a session or a token). Solutions Opero Inc sells the plans
and Stripe takes the payments: enabled is false until the deployment has
its Stripe secret key and webhook signing secret, and every billing write then
answers 503 billing_unavailable. offers are the plans and intervals
POST /v1/account/billing/checkout sells. subscription is the organisation’s
one subscription as the last webhook left it (null before the first checkout);
past_due is set while a payment has failed: the plan stays until
grace_ends_at (7 days after the first failure, two emails to the owners), then
the organisation moves to free, keeping everything it holds, until a payment
goes through. customer says whether Stripe’s customer portal opens (card, plan
change, cancellation, invoices). Read from the control plane’s database, not from
Stripe.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”The billing state.
object
The deployment takes payments (its Stripe secret key and webhook signing secret are set).
Stripe’s test mode; test cards only, nothing is charged.
The plans and intervals Checkout sells, in upgrade order.
object
The organisation is a Stripe customer, so the portal (card, plan, invoices) opens.
object
Stripe’s subscription status.
The plan the subscription’s product sells (empty if unknown).
Monthly or yearly (empty if unknown).
The next charge; null when the subscription ends at the period’s end or has ended.
object
The first failed payment.
When the organisation moves to free unless a payment goes through.
The grace ended; the organisation is on free until a payment restores the plan.
Example
{ "enabled": true, "test_mode": true, "offers": [ { "plan": "personal", "interval": "monthly" }, { "plan": "personal", "interval": "yearly" } ], "customer": true, "subscription": { "status": "active", "plan": "personal", "interval": "yearly", "current_period_end": "2027-10-03T12:00:00Z", "renews_at": "2027-10-03T12:00:00Z", "cancel_at_period_end": false }, "past_due": null}Not authenticated.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/unauthenticated", "title": "Unauthorized", "status": 401, "code": "unauthenticated", "detail": "You're not signed in, or your sign-in has ended. Please sign in again to continue.", "request_id": "5f2c9a0e7b1d4c38"}Authenticated but not allowed: insufficient_scope, session_required, csrf_rejected, reauth_required (sign in again within five minutes), account_pending_deletion (the account is in its deletion cooling-off), email_unverified (creating a profile before the email address is verified).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/insufficient_scope", "title": "Forbidden", "status": 403, "code": "insufficient_scope", "detail": "This API token isn't allowed to do this: it needs the profiles:write scope. Create a token that includes it, then try again.", "required_scope": "profiles:write", "request_id": "5f2c9a0e7b1d4c38"}