---
title: "Current plan, subscription, dunning state, caps and usage vs limits of an organization (billing:read)"
method: GET
path: "/billing"
tags: ["Billing"]
---

# Current plan, subscription, dunning state, caps and usage vs limits of an organization (billing:read)

`GET /billing`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/billing`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Query parameters

- `orgId` string: Organization id (required when you belong to several)
- `lang` 'en' | 'sv': Language of labels and Stripe pages (default en)

## Response `200`

Billing status

- object
  - `configured` boolean, required: false: Stripe is not set up on this server — every team has the default plan and nothing can be bought
  - `organizationId` string, uuid, required
  - `plan` object, required
    - `id` 'free' | 'pro' | 'business', required
    - `name` string, required
  - `planSource` 'subscription' | 'default' | 'unlimited' | 'grant', required: grant: a plan given by Hostingsurge without payment (see grant) is the one that applies
  - `subscription` object, nullable, required
    - `status` 'incomplete' | 'incomplete_expired' | 'trialing' | 'active' | 'past_due' | 'canceled' | 'unpaid' | 'paused', required
    - `planId` 'free' | 'pro' | 'business', required
    - `interval` 'month' | 'year', required
    - `currency` string, required: the currency the subscription is billed in; fixed for its lifetime (plan changes keep it)
    - `currentPeriodStart` string, nullable, required: ISO-8601 timestamp
    - `currentPeriodEnd` string, nullable, required: ISO-8601 timestamp
    - `cancelAtPeriodEnd` boolean, required
    - `cancelAt` string, nullable, required: ISO-8601 timestamp
    - `trialEnd` string, nullable, required: ISO-8601 timestamp
    - `pendingUpdate` boolean, required: a plan change waits for a payment to succeed (see paymentUrl)
    - `paymentUrl` string, nullable, required: hosted page of the latest open invoice when it needs payment or authentication
  - `currency` string, required: the team's billing currency: its live subscription's currency (Build Credit packs are sold in it), otherwise the default (usd); a new subscription can choose any catalog currency
  - `trialAvailable` boolean, required: the next subscription of this organization starts with a free trial
  - `dunning` object, required
    - `state` 'ok' | 'past_due' | 'restricted', required: restricted: the grace period ended and new deployments/builds are paused (running sites keep running and nothing is ever deleted for non-payment)
    - `pastDueSince` string, nullable, required: ISO-8601 timestamp
    - `graceUntil` string, nullable, required: ISO-8601 timestamp
    - `deploysBlockedAt` string, nullable, required: ISO-8601 timestamp
  - `caps` object, required
    - `buildMinutes` integer, nullable, required
  - `paymentMethod` object, nullable, required
    - `brand` string, nullable, required
    - `last4` string, nullable, required
    - `expMonth` integer, nullable, required
    - `expYear` integer, nullable, required
  - `canManage` boolean, required: the caller may change the plan and open the Customer Portal (a dashboard session of an owner, admin or billing member)
  - `usage` object, required
    - `organizationId` string, uuid, required
    - `planId` 'free' | 'pro' | 'business', required
    - `period` object, required
      - `start` string, required: ISO-8601 timestamp
      - `end` string, required: ISO-8601 timestamp
      - `source` 'subscription' | 'calendar_month', required
    - `metrics` object[], required
      - `metric` 'projects' | 'databases' | 'seats' | 'buildMinutes' | 'bandwidthGb' | 'storageGb' | 'aiCredits' | 'emailsPerDay' | 'emailsPerMonth', required
      - `unit` 'count' | 'minutes' | 'gb' | 'credits', required
      - `label` string, required
      - `measured` boolean, required: false: no data source yet ("not metered yet"); used is then null
      - `used` number, nullable, required
      - `limit` number, nullable, required: included amount or allowance; null = unlimited
      - `cap` number, nullable, required: hard cap the team set (build minutes); null = none
      - `enforcedAt` 'create' | 'deploy' | 'builder' | 'send' | 'none', required: send: transactional email, refused with rate_limited once the quota is used (emailsPerDay resets 00:00 UTC, emailsPerMonth with the period)
      - `percent` number, nullable, required: used / limit in percent (rounded), null when unlimited or unmeasured
      - `state` 'ok' | 'warning' | 'reached' | 'over', required: warning ≥ 80%, reached ≥ 100%, over: beyond the included amount and billed
      - `overage` object, nullable, required
        - `quantity` number, required
        - `unitAmountDecimal` string, required
        - `currency` string, required
        - `estimatedAmount` integer, required: minor units (cents)
    - `credits` object, required
      - `renewal` 'monthly' | 'once', required
      - `allowance` number, required: credits included by the plan (per period, or once on Free)
      - `allowanceUsed` number, required
      - `allowanceRemaining` number, required
      - `purchased` number, required: remaining purchased or granted credits; they never expire. Negative = a debt from a refunded or disputed top-up that was already spent, repaid by the next purchase
      - `remaining` number, required: allowanceRemaining + purchased (a negative purchased balance counts as 0: a debt never reduces the allowance)
      - `usedThisPeriod` number, required
    - `alerts` object[], required: 80%/100% warnings raised in the current period
      - `metric` 'projects' | 'databases' | 'seats' | 'buildMinutes' | 'bandwidthGb' | 'storageGb' | 'aiCredits' | 'emailsPerDay' | 'emailsPerMonth', required
      - `threshold` union, required
        - 80
        - 100
      - `createdAt` string, required: ISO-8601 timestamp
  - `grant` object: a plan given by Hostingsurge: the one that applies now, or one that recently ended
    - `active` object, nullable, required
      - `planId` 'free' | 'pro' | 'business', required
      - `planName` string, required
      - `startsAt` string, required: ISO-8601 timestamp
      - `endsAt` string, nullable, required: null: no end date
      - `applies` boolean, required: false when the team pays for a plan that is as good or better: that one applies
    - `ended` object, nullable, required: a given plan that ended (or was taken back) in the last 30 days, while none applies now and the team is on Free (planSource default): null once the team pays for a plan or is unlimited
      - `planId` 'free' | 'pro' | 'business', required
      - `planName` string, required
      - `endedAt` string, required: ISO-8601 timestamp
  - `trial` object: the team's Free trial (state none for paid, granted and unlimited teams)
    - `state` 'none' | 'active' | 'site_cap' | 'ended' | 'paused' | 'exempt', required
    - `startedAt` string, nullable, required: ISO-8601 timestamp
    - `endsAt` string, nullable, required: ISO-8601 timestamp
    - `endedAt` string, nullable, required: ISO-8601 timestamp
    - `endReason` 'time' | 'sites' | 'usage' | 'operator' | 'null', nullable, required
    - `sitesDeployed` integer, required: sites the team has ever had live (deleted ones included)
    - `sitesMax` integer, nullable, required
    - `pauseAt` string, nullable, required: when the sites are paused (the end plus the grace days, never before the one warning has stood); null when pausing is off
    - `retentionUntil` string, nullable, required: a paused team's data is kept until then for an operator's review; nothing is deleted automatically
    - `paymentsAvailable` boolean, required: plans can be bought on this server (Stripe is configured), read live
    - `mode` 'off' | 'dry_run' | 'on': the trial switch of the brand (TRIAL_ENFORCE=off reads off)
    - `showCountdown` boolean: the operator lets the dashboard show days left (off by default)
    - `usageCapped` object, nullable: a monthly usage cap of the Free plan was reached
      - `metric` 'requests' | 'bandwidthGb' | 'cpuHours', required
      - `at` string, required: ISO-8601 timestamp

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Authenticated but not permitted (code forbidden); details.requiresSession for plan/payment changes over a token
- `404`: Not found or not visible to the caller (code not_found)
- `409`: Conflicting state, e.g. a subscription already exists (code conflict)
- `429`: Too many requests (code rate_limited); see Retry-After
- `501`: Billing is not set up on this server (code not_configured)
- `503`: The payment provider is unavailable (code provider_unavailable)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
