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.12.0 (30 Nov 2026) · What’s new →

List plans

GET
/v1/plans
curl --request GET \
--url 'http://localhost:8080/v1/plans?limit=50&offset=0' \
--header 'Authorization: Bearer <token>'

Plans in the mode of your API key, newest first, each with its prices.

limit
integer
default: 50 >= 1 <= 100

Rows per page, from 1 to 100. Default 50. Any other value, one that is not a whole number, or limit sent twice is a 422 with param: limit. It is never clamped.

offset
integer
0

Rows to skip, 0 or more. Default 0. A negative value, one that is not a whole number, or offset sent twice is a 422 with param: offset.

One page of plans, and how many there are.

Media typeapplication/json
object
data
required
Array<object>

A plan is what a subscription buys: a recurring base fee and the usage prices of its meters, in one currency and billing interval. GET /v1/plans lists plans in this shape. Get, create and update answer a PlanDetail, which adds two fields.

object
id
required

The plan’s ID, hc_pln_ and 20 characters.

string
tenant_id

The account the plan belongs to.

string
code
required

Your short name for the plan. Letters, digits, - and _, at most 100 characters, unique in the account and mode. Fixed after create.

string
name
required

The plan’s display name. Create refuses one longer than 255 bytes (UTF-8); an update does not check the length.

string
currency
required

ISO 4217 code in upper case, such as USD. Fixed after create. The plan’s prices take it.

string
billing_interval
required

How often a subscription to the plan is billed. Fixed after create.

string
Allowed values: monthly yearly
status
required

An archived plan takes no new subscriptions and no plan change onto it. Subscriptions already on it keep billing.

string
Allowed values: active archived
base_amount_cents
required

The recurring base fee per billing period, in the currency’s minor unit (cents for USD). 0 for a usage-only plan.

integer format: int64
base_bill_timing
required

When the base fee is invoiced, relative to the period it covers. in_arrears: the base fee and the usage are billed at the period end. in_advance: the base fee is billed at the period start; the first invoice comes when the subscription starts, and each cycle invoice carries the next period’s base fee with the past period’s usage. Usage is always billed at the period end. A plan with no base fee is in_arrears.

string
Allowed values: in_advance in_arrears
prices
required

The plan’s usage prices from now on, in the order they were added. A plan’s meters are the meters it has a price for.

Array<object>

One usage price of a plan: a meter, the events it takes (dimension_match) and its rate. The price takes the plan’s currency. Its id stays the same when its rate changes; its meter and dimension_match are its identity and never change. Every shape field is always sent: the ones the mode does not use are "0", 0 or [].

object
id
required

The price’s ID, hc_prc_ and 20 characters.

string
tenant_id

The account the price belongs to.

string
plan_id
required

The plan the price belongs to.

string
meter_id
required

The meter whose usage the price bills.

string
dimension_match
required

The labels an event must carry for this price to take it, for example {"model": "claude-opus-4.5", "token_type": "input"}. {} takes every event of the meter. Of the prices whose labels an event carries, the one with the most labels takes it.

object
key
additional properties
string
mode
required

How the price bills a quantity; see PriceShape.

string
Allowed values: per_unit graduated package
unit_amount_cents
required

Price per unit, as a decimal string of cents. "0" unless mode is per_unit.

string
tiers
required

Empty ([]) unless mode is graduated.

Array<object>

One tier of a graduated price.

object
up_to
required

The tier’s upper bound in whole units: the tier prices the quantity above the previous tier’s bound, up to this one. null on the last tier, which has no upper bound. Only the last tier is null, and it must be.

integer format: int64
nullable
unit_amount_cents
required

Price per unit in cents in this tier, as a decimal string. "0" makes the tier free.

string
package_size
required

The units in one package. 0 unless mode is package.

integer format: int64
package_amount_cents
required

Price of one package, as a decimal string of cents. "0" unless mode is package.

string
created_at
required

When the price was first added to the plan.

string format: date-time
updated_at
required

When the content shown was saved.

string format: date-time
description

Your description of the plan. Absent when empty.

string
tax_code

A Stripe product tax code, such as txcd_10103001, read only by the Stripe Tax provider. Today only the base fee line of the invoice billed when an in-advance subscription starts carries it; cycle invoices and usage lines use the account’s default_product_tax_code. Absent when not set.

string
created_at
required

When the plan was created.

string format: date-time
updated_at
required

When the plan was last changed.

string format: date-time
total
required

How many rows match the request’s filters, on every page, not only this one. The audit log and the customer list’s search and name or email sort say where they stop counting.

integer

Example

{
"data": [
{
"id": "hc_pln_dajr5o2q3gpgqfoq5c1g",
"tenant_id": "hc_ten_dajqj02q3gpgqfoq5c00",
"code": "pro",
"name": "Pro",
"description": "Base fee plus metered tokens.",
"currency": "USD",
"billing_interval": "monthly",
"status": "active",
"base_amount_cents": 4900,
"base_bill_timing": "in_arrears",
"prices": [
{
"id": "hc_prc_dajr672q3gpgqfoq5c20",
"tenant_id": "hc_ten_dajqj02q3gpgqfoq5c00",
"plan_id": "hc_pln_dajr5o2q3gpgqfoq5c1g",
"meter_id": "hc_mtr_dajr122q3gpgqfoq5c10",
"dimension_match": {},
"mode": "per_unit",
"unit_amount_cents": "0.0003",
"tiers": [],
"package_size": 0,
"package_amount_cents": "0",
"created_at": "2026-09-15T09:05:00Z",
"updated_at": "2026-09-15T09:05:00Z"
}
],
"created_at": "2026-09-15T09:05:00Z",
"updated_at": "2026-09-15T09:05:00Z"
}
],
"total": 1
}

No valid credential: the API key or session is missing, wrong, expired or revoked. With no API key and no valid session cookie, the message starts with missing credentials. A wrong, expired and revoked key all get the same message, invalid or expired API key.

Media typeapplication/json

The body of an error answer. error.type is the broad class, error.code is the exact reason for your code to branch on, and error.message is a sentence for a person. Quote error.request_id when you ask for help.

object
error

What went wrong.

object
type
required

One of invalid_request_error, authentication_error, rate_limit_error or api_error. Every error the API answers has this shape, including an unknown path (404, code route_not_found) and a method the path does not take (405, code method_not_allowed, with an Allow header). The few exceptions are listed in Errors.

string
code
required

The exact reason, such as validation_error, not_found, already_exists, invalid_state or a more specific code the operation lists. Branch on this, not on message.

string
message
required

What went wrong, written for a person to read.

string
request_id
required

The id of the request that produced this answer (req_…). It is normally the same value as the Hardcount-Request-Id response header. On an answer replayed for a repeated Idempotency-Key, the body is the first request’s, so this is the first request’s id, while the Hardcount-Request-Id header holds the new request’s id.

string
param

The request field or query parameter the error is about. Sent only when the error names one.

A request body may hold only the fields its operation lists, spelled and cased as listed. Any other field, or one the server sets (such as id), is refused with 422 and param naming it. An operation with no request body lists no fields: send no body, {} or null. The Stripe and Postmark webhooks and the LiteLLM callback take their sender’s body as it comes.

string

Example

{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "invalid or expired API key",
"request_id": "req_dbjg652q3gpgqfoq5cd0"
}
}

The credential is valid but may not call this route. A usage-only key (hc_ingest_…) can only send usage, read a customer’s live credit balance and call GET /v1/whoami; use a secret key. The message names the permission the key lacks. A browser request that would change data (POST, PUT, PATCH or DELETE) from a page on another site gets this 403 too, with the message cross-site request blocked.

Media typeapplication/json

The body of an error answer. error.type is the broad class, error.code is the exact reason for your code to branch on, and error.message is a sentence for a person. Quote error.request_id when you ask for help.

object
error

What went wrong.

object
type
required

One of invalid_request_error, authentication_error, rate_limit_error or api_error. Every error the API answers has this shape, including an unknown path (404, code route_not_found) and a method the path does not take (405, code method_not_allowed, with an Allow header). The few exceptions are listed in Errors.

string
code
required

The exact reason, such as validation_error, not_found, already_exists, invalid_state or a more specific code the operation lists. Branch on this, not on message.

string
message
required

What went wrong, written for a person to read.

string
request_id
required

The id of the request that produced this answer (req_…). It is normally the same value as the Hardcount-Request-Id response header. On an answer replayed for a repeated Idempotency-Key, the body is the first request’s, so this is the first request’s id, while the Hardcount-Request-Id header holds the new request’s id.

string
param

The request field or query parameter the error is about. Sent only when the error names one.

A request body may hold only the fields its operation lists, spelled and cased as listed. Any other field, or one the server sets (such as id), is refused with 422 and param naming it. An operation with no request body lists no fields: send no body, {} or null. The Stripe and Postmark webhooks and the LiteLLM callback take their sender’s body as it comes.

string

Example

{
"error": {
"type": "authentication_error",
"code": "forbidden",
"message": "insufficient permissions: this key type does not have customer:read access",
"request_id": "req_dbjg652q3gpgqfoq5cd0"
}
}

limit or offset is out of range, not a whole number or sent twice, or the request sends the removed after cursor (param names it)

Media typeapplication/json

The body of an error answer. error.type is the broad class, error.code is the exact reason for your code to branch on, and error.message is a sentence for a person. Quote error.request_id when you ask for help.

object
error

What went wrong.

object
type
required

One of invalid_request_error, authentication_error, rate_limit_error or api_error. Every error the API answers has this shape, including an unknown path (404, code route_not_found) and a method the path does not take (405, code method_not_allowed, with an Allow header). The few exceptions are listed in Errors.

string
code
required

The exact reason, such as validation_error, not_found, already_exists, invalid_state or a more specific code the operation lists. Branch on this, not on message.

string
message
required

What went wrong, written for a person to read.

string
request_id
required

The id of the request that produced this answer (req_…). It is normally the same value as the Hardcount-Request-Id response header. On an answer replayed for a repeated Idempotency-Key, the body is the first request’s, so this is the first request’s id, while the Hardcount-Request-Id header holds the new request’s id.

string
param

The request field or query parameter the error is about. Sent only when the error names one.

A request body may hold only the fields its operation lists, spelled and cased as listed. Any other field, or one the server sets (such as id), is refused with 422 and param naming it. An operation with no request body lists no fields: send no body, {} or null. The Stripe and Postmark webhooks and the LiteLLM callback take their sender’s body as it comes.

string

Example

{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "limit must be a whole number from 1 to 100",
"request_id": "req_dbjg652q3gpgqfoq5cd0",
"param": "limit"
}
}

Too many requests. Wait for the number of seconds in Retry-After, then retry. The answers that pass the limit carry the X-RateLimit-* headers too.

Each API key has its own limit, by default 1,000 requests a minute (HARDCOUNT_RATE_LIMIT_GENERAL_PER_MIN), and 1,000 a second on the usage routes (HARDCOUNT_RATE_LIMIT_INGEST_PER_SEC). The dashboard sessions of one account share one limit per mode. The routes under /v1/auth and /v1/bootstrap (sign-in, password reset, invite accept, setup) count per client address, by default 100 a minute (HARDCOUNT_RATE_LIMIT_AUTH_PER_MIN). The public invoice, payment-update and cost-dashboard pages allow 60 a minute per client address.

Media typeapplication/json

The body of an error answer. error.type is the broad class, error.code is the exact reason for your code to branch on, and error.message is a sentence for a person. Quote error.request_id when you ask for help.

object
error

What went wrong.

object
type
required

One of invalid_request_error, authentication_error, rate_limit_error or api_error. Every error the API answers has this shape, including an unknown path (404, code route_not_found) and a method the path does not take (405, code method_not_allowed, with an Allow header). The few exceptions are listed in Errors.

string
code
required

The exact reason, such as validation_error, not_found, already_exists, invalid_state or a more specific code the operation lists. Branch on this, not on message.

string
message
required

What went wrong, written for a person to read.

string
request_id
required

The id of the request that produced this answer (req_…). It is normally the same value as the Hardcount-Request-Id response header. On an answer replayed for a repeated Idempotency-Key, the body is the first request’s, so this is the first request’s id, while the Hardcount-Request-Id header holds the new request’s id.

string
param

The request field or query parameter the error is about. Sent only when the error names one.

A request body may hold only the fields its operation lists, spelled and cased as listed. Any other field, or one the server sets (such as id), is refused with 422 and param naming it. An operation with no request body lists no fields: send no body, {} or null. The Stripe and Postmark webhooks and the LiteLLM callback take their sender’s body as it comes.

string

Example

{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "too many requests — please retry after the rate limit resets",
"request_id": "req_dbjg652q3gpgqfoq5cd0"
}
}
Retry-After
integer
Example
12

Seconds to wait before the next request can pass, rounded up to a whole second and at least 1.

X-RateLimit-Limit
integer
Example
1000

How many requests the limit allows in its period (a minute, or a second on the usage routes).

X-RateLimit-Remaining
integer
Example
0

How many requests are left in the current period.

X-RateLimit-Reset
integer format: int64
Example
1793870460

When the whole limit is available again, as Unix seconds. One request may pass sooner; Retry-After says when.

Stuck, or found a bug? Ask in Discussions · Open an issue