Skip to content
Hardcount
Run it locally
Pre-1.0 · one maintainer · Stripe and cards only · no SDKs (client libraries) yet · no production users yet. Docs describe v0.9.1 (29 Oct 2026) · What’s new →

Public cost-dashboard projection (ADR-032)

GET
/v1/public/cost-dashboard/{token}
curl --request GET \
--url http://localhost:8080/v1/public/cost-dashboard/example

Unauthenticated. The hc_pcd_… token in the URL is the sole credential — partners embed via iframe / fetch from their own app without an API key. Sanitized projection: customer_id, tenant_id, livemode, billing_period, subscriptions, usage[], totals, projected_total_cents, credits. PII (email, display_name, external_id, metadata, billing_profile) is NEVER on this response. Wrong prefix or unknown token → 401 (anti-enumeration). No active sub → 200 with billing_period.source = "no_subscription": subscriptions, usage and totals are empty, and credits still lists the customer’s credit balance.

token
required
string

Projection

Media typeapplication/json
object
customer_id
required
string
tenant_id
required
string
livemode
required
boolean
billing_period
required
object
start
required
string format: date-time
end
required
string format: date-time
source
required

Branch on this before rendering the period. When it is no_subscription the customer has no active subscription, subscriptions, usage and totals are empty (credits is not), and start/end carry the zero time (0001-01-01T00:00:00Z) rather than a real range — display them and the page reads “January 1, year 1”.

string
Allowed values: subscription no_subscription
subscriptions
required
Array<object>
object
id
required
string
plan_name
required
string
currency
required
string
current_period_start
required
string format: date-time
current_period_end
required
string format: date-time
usage
required
Array<object>
object
event_name
required
string
meter_name
required
string
unit
required
string
currency
required
string
total_quantity
required
string
total_amount_cents
required
integer format: int64
prices
required

One row per price that took usage this period.

Array<object>
object
dimension_match

The labels the price takes. Absent for a price that takes every event.

object
key
additional properties
string
quantity
required
string
amount_cents
required
integer format: int64
unit_amount_decimal

Per-unit price in DECIMAL CENTS (ADR-045, the Stripe unit_amount_decimal model) — NOT dollars. “0.0003” is 0.0003 CENTS per unit ($3.00 per 1M units); multiplying it by quantity yields CENTS, matching the sibling amount_cents. Reading it as dollars overstates the cost 100x.

string
totals
required

One entry per currency present in usage.

Array<object>
object
currency
required
string
amount_cents
required
integer format: int64
projected_total_cents
required

The metered cost of the current billing period so far, in cents, including usage a threshold invoice already billed. Recurring base fees are not included — an in_advance base is already invoiced at period open.

integer format: int64
credits
required

The customer’s credit position, one entry per currency, ordered by currency. balance_cents is the ledger balance in that currency, less any grant past its expiry date that is not yet written off: credit is drawn down when an invoice is issued, so it does not move with usage. unbilled_usage_cents is the usage no invoice has billed yet that will be invoiced in that currency, and estimated_remaining_cents is the balance minus that, never below zero. These three are the same figures GET /v1/credits/balance/{customer_id}/live returns. unbilled_usage_cents differs from projected_total_cents after a threshold invoice: it leaves out the usage that invoice billed. It is an estimate: tax, base fees billed at period end and unpaid invoices are not subtracted.

Array<object>
object
currency
required
string
balance_cents
required
integer format: int64
unbilled_usage_cents
required
integer format: int64
commit_remaining_cents
required

What is left of the customer’s prepaid commit.

integer format: int64
promotional_remaining_cents
required

What is left of promotional credit.

integer format: int64
estimated_remaining_cents
required
integer format: int64

Example

{
"billing_period": {
"source": "subscription"
}
}

Invalid token

Rate limited (60/min/IP)