List customers
const url = 'http://localhost:8080/v1/customers?sort=created_at&dir=desc&limit=50&offset=0';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'http://localhost:8080/v1/customers?sort=created_at&dir=desc&limit=50&offset=0' \ --header 'Authorization: Bearer <token>'Customers in the mode of your API key, newest first unless you choose
a sort. The list answer leaves out additional_,
email_, the bounce fields and stripe_: get one
customer for those.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Only customers with this status, active or archived. Any other
value is a 422 with param: status.
Only the customer with this external_ (exact match).
Comma-separated customer IDs. Only those customers are returned; IDs not found are skipped.
Case-insensitive substring match on display name, email, external
ID or ID. It looks at the first 5,000 customers, in the list’s
sort order, that match the other filters; the rows and total
stop there.
The order of the list. created_ (the default), display_
(or name), email, external_ or status. Any other value is
a 422 with param: sort. On a server that encrypts customer data,
a sort by display_, name or email looks at the 5,000
newest customers at most; the rows and total stop there.
Example
created_atSort direction: desc (the default) or asc, in lower case. Any
other value is a 422 with param: dir.
Example
descRows 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.
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.
Responses
Section titled “Responses”One page of customers, and how many match.
object
A customer you bill: the person or company that subscriptions,
invoices, credits and payment methods belong to. Create, list, get
and update customers under /. The
customer. and customer. webhook
events carry this object too.
Not every route fills every optional field. Get and update return
the whole record. The list and create answers leave out
email_, the bounce fields and stripe_, and the
list also leaves out additional_.
object
The customer’s ID, hc_cus_ and 20 characters.
Your own ID for the customer, such as the account ID in your app. Unique in the account and mode, and fixed after create. Create refuses one longer than 255 bytes (UTF-8).
The name shown on invoices, emails and the dashboard. Create refuses one longer than 255 bytes (UTF-8); an update does not check the length.
Where billing emails go: invoices, receipts, payment reminders and payment-method links. Absent when the customer has none.
Addresses copied (CC) on billing documents and billing emails:
invoice, receipt, payment reminder, final notice, failed payment
and credit note. Never on the payment setup emails, whose link
lets the reader add a card. Lowercase bare addresses, no
duplicates, never the primary email. At most 10: a create or
update with more is refused with 422. Absent when the list is
empty.
archived blocks new subscriptions for the customer. Its
unpaid invoices stay collectible.
When the customer was created.
The account the customer belongs to.
Whether email receives mail, learned from bounce and spam
reports. unknown until a report arrives. bounced or
complained after one, and Hardcount then stops emailing the
address. Changing email sets it back to unknown. Hardcount
does not set ok today.
When the last bounce or spam report was recorded. Absent until
one is, and again after email changes.
The reason the email provider gave with the last bounce or spam
report. Absent until one is recorded, when the report gave no
reason, and again after email changes.
The Stripe customer linked to this customer. Absent until Hardcount first creates it: when you create a payment-method link (setup session or setup email), or when the customer opens Stripe Checkout from a payment-update link or the hosted invoice page. Set once, never replaced.
Whether the customer is in live mode. The customer routes and webhook events leave it out: use the mode of your API key.
When the customer was last changed.
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.
Example
{ "data": [ { "id": "hc_cus_dakhnk2q3gpgqfoq5c0g", "tenant_id": "hc_ten_dajqj02q3gpgqfoq5c00", "external_id": "acme-42", "display_name": "Acme Inc", "email": "billing@acme.example", "status": "active", "created_at": "2026-09-30T16:20:00Z", "updated_at": "2026-09-30T16:20: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.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
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.
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.
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_) can only send usage, read a customer’s live
credit balance and call GET /; 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.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
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.
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.
Example
{ "error": { "type": "authentication_error", "code": "forbidden", "message": "insufficient permissions: this key type does not have customer:read access", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}status is not one of its values, limit or offset is out of
range or not a whole number, the request sends the removed
after cursor, or sort or dir is not one of its values.
param names it, and for status, sort and dir the
message lists the allowed values.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
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.
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.
Example
{ "error": { "type": "invalid_request_error", "code": "validation_error", "message": "sort \"nope\" is not one of created_at, display_name, name, email, external_id, status", "request_id": "req_dbjg652q3gpgqfoq5cd0", "param": "sort" }}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_), and 1,000 a second on the
usage routes (HARDCOUNT_). The dashboard
sessions of one account share one limit per mode. The routes under
/ and / (sign-in, password reset, invite
accept, setup) count per client address, by default 100 a minute
(HARDCOUNT_). The public invoice,
payment-update and cost-dashboard pages allow 60 a minute per client
address.
The body of an error answer. error. is the broad class,
error. is the exact reason for your code to branch on, and
error. is a sentence for a person. Quote
error. when you ask for help.
object
What went wrong.
object
One of invalid_, authentication_,
rate_ or api_. Every error the API
answers has this shape, including an unknown path (404,
code route_) and a method the path does not take
(405, code method_, with an Allow header).
The few exceptions are listed in
Errors.
The exact reason, such as validation_, not_,
already_, invalid_ or a more specific code
the operation lists. Branch on this, not on message.
What went wrong, written for a person to read.
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.
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.
Example
{ "error": { "type": "rate_limit_error", "code": "rate_limited", "message": "too many requests — please retry after the rate limit resets", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}Headers
Section titled “Headers”Example
12Seconds to wait before the next request can pass, rounded up to a whole second and at least 1.
Example
1000How many requests the limit allows in its period (a minute, or a second on the usage routes).
Example
0How many requests are left in the current period.
Example
1793870460When 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