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 subscriptions

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

Lists the subscriptions of this account and mode, newest first unless you sort otherwise. The filters combine.

customer_id
string

Only this customer’s subscriptions (hc_cus_…).

plan_id
string

Only the subscriptions on this plan now (plan_id; a scheduled change does not count).

status
string
Allowed values: active canceled

Exact status. Any other value is a 422 with param: status.

billing
string
Allowed values: failing

failing returns only subscriptions that carry a billing_failure: those waiting for their next billing attempt and those that are parked (set aside after eight failed billing attempts, until someone retries them). Any other value is a 422 with param: billing.

search
string

Case-insensitive substring match on display name or code.

sort
string
default: created_at
Allowed values: created_at next_billing_at status display_name name

The order of the list. created_at (the default), next_billing_at, status or display_name (or name). Any other value is a 422 with param: sort. Ties are broken by id in the same direction.

Example

created_at
dir
string
default: desc
Allowed values: asc desc

Sort direction: desc (the default) or asc, in lower case. Any other value is a 422 with param: dir.

Example

desc
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.

Subscription list

Media typeapplication/json
object
data
required
Array<object>

A customer’s subscription: the plan it bills, a plan change scheduled for the end of the current period, its status and its current billing period. Every route under /v1/subscriptions that returns a subscription returns this object.

A subscription bills in one currency, the currency of its plan. A customer who needs two plans has two subscriptions. A customer has at most one active subscription on a plan, and two may not bill the same meter. Usage, and a base fee billed in arrears, are invoiced when a period ends. A base fee billed in advance is invoiced when its period starts: the first one in the same transaction that creates the subscription, each later one on the invoice that closes the period before.

object
id
required

The subscription’s ID (hc_sub_…).

string
tenant_id

The account the subscription belongs to.

string
code
required

Your code for the subscription: letters, digits, hyphens and underscores. Unique in your account and mode (live or test).

string
display_name
required

The subscription’s name, as shown in the dashboard.

string
customer_id
required

The customer the subscription bills (hc_cus_…).

string
plan_id

The plan the subscription bills now (hc_pln_…): its base fee and its usage prices. A scheduled plan change shows in pending_plan_id until it takes effect. Absent only on a canceled subscription that an earlier release left with no plan.

string
pending_plan_id

The plan the subscription moves to at pending_plan_effective_at (hc_pln_…). Absent when no change is scheduled.

string
pending_plan_effective_at

When the scheduled plan change takes effect: the end of the period in which it was scheduled. Absent when no change is scheduled.

string format: date-time
status
required

Where the subscription is in its life.

  • active: billing, from the start of the day it is created (in the account’s time zone). Usage and base fees billed in arrears are invoiced when each period ends; a base fee billed in advance when its period starts.
  • canceled: ended at canceled_at. It bills nothing more, and no route makes it active again. A subscription canceled before it started has no started_at and no billing period.
string
Allowed values: active canceled
billing_time
required

How monthly periods line up. The first period starts on the day the subscription is created. calendar: every period ends on the 1st of a month, in your account’s billing time zone, so the first period runs from that day to the next 1st. anniversary: each period starts on the same day of the month as the first one (the last day of a shorter month). A plan billed yearly always bills a year from that first day, whatever this says.

string
Allowed values: calendar anniversary
started_at

The moment the subscription was created. Its first period, and the usage it bills, start at the beginning of that day in the account’s time zone. A subscription that an earlier release activated from a draft has the moment of that activation instead.

string format: date-time
canceled_at

When the subscription was canceled. Absent until then.

string format: date-time
cancel_at_period_end
required

True when the subscription cancels at the end of the current period. False after the subscription is canceled.

boolean
cancel_effective_at

When a scheduled cancel takes effect: with cancel_at_period_end, current_billing_period_end. Absent when no cancel is scheduled.

string format: date-time
current_billing_period_start

Start of the current billing period, the beginning of a day in your account’s billing time zone. On a canceled subscription it keeps its last value.

string format: date-time
current_billing_period_end

End of the current period (exclusive): the start of the next one. On a canceled subscription it keeps its last value.

string format: date-time
current_billing_period_display

The current period as text, with the last day included, in your account’s billing time zone, for example “Oct 1, 2026 – Oct 31, 2026”. Absent when the subscription has no current period, or when the time zone could not be read.

string
next_billing_at

When the current period’s invoice is due to be built: the end of the current period. The billing run builds it once the invoice grace after that time has passed. A canceled subscription keeps its last value, and nothing is billed at that time.

string format: date-time
billing_anchor_day

Day of the month the subscription bills on (1-31): the day its first period started, or the day an earlier release switched it to a plan with another billing interval. Absent for calendar-monthly subscriptions.

integer
billing_failure

Present on a subscription while the billing run is failing on the work that subscription has due now: the close of its current period, which also cancels it when a cancel is scheduled. Absent otherwise: a subscription that bills cleanly, or whose due work changed, carries no billing_failure.

After each failed attempt the billing run waits before the next one: 15 minutes, 1 hour, 4 hours, 12 hours, then 24 hours three times. The eighth failure parks the subscription (parked: true, no next_attempt_at). A parked subscription is not attempted again until POST /v1/subscriptions/{id}/retry-billing is called.

object
attempts
required

Failed attempts on the work that is due now. At least 1.

integer
max_attempts
required

The attempt at which the subscription parks (8).

integer
last_error
required

Why the latest attempt failed: a sentence an operator can act on, or a generic line carrying the subscription id as the reference to search the server log for. Never raw error text.

string
failed_at
required

When the latest attempt failed.

string format: date-time
next_attempt_at

The billing run does not attempt the subscription before this instant. The attempt happens on the first run at or after it, so on an hourly schedule it can be up to an hour later. Absent when parked.

string format: date-time
parked
required

True when automatic attempts have stopped.

boolean
created_at
required

When the subscription was created.

string format: date-time
updated_at
required

When the subscription 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_sub_dauq502q3gpgqfoq5c2g",
"tenant_id": "hc_ten_dajqj02q3gpgqfoq5c00",
"code": "acme-pro",
"display_name": "Acme Pro",
"customer_id": "hc_cus_dakhnk2q3gpgqfoq5c0g",
"plan_id": "hc_pln_dajr5o2q3gpgqfoq5c1g",
"status": "active",
"billing_time": "calendar",
"started_at": "2026-10-01T09:12:44Z",
"cancel_at_period_end": false,
"current_billing_period_start": "2026-10-01T00:00:00Z",
"current_billing_period_end": "2026-11-01T00:00:00Z",
"current_billing_period_display": "Oct 1, 2026 – Oct 31, 2026",
"next_billing_at": "2026-11-01T00:00:00Z",
"created_at": "2026-10-01T09:12:44Z",
"updated_at": "2026-10-01T09:12:44Z"
}
],
"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"
}
}

Code validation_error. A status, billing or collection filter the API does not know, limit or offset out of range or not a whole number, the removed after cursor, or a sort or dir that is not one of its values. param names it, and for the filters, sort and dir the message lists the allowed values.

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": "status must be one of active, canceled",
"request_id": "req_dbjg652q3gpgqfoq5cd0",
"param": "status"
}
}

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