Update a webhook endpoint
const url = 'http://localhost:8080/v1/webhook-endpoints/endpoints/hc_whe_danslg2q3gpgqfoq5c80';const options = { method: 'PATCH', headers: { 'Idempotency-Key': '5f0c8a2e-7b1d-4c3e-9a6f-2d8b4e1c7a90', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"description":"Billing sync (v2)","events":["invoice.*","payment.*"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url http://localhost:8080/v1/webhook-endpoints/endpoints/hc_whe_danslg2q3gpgqfoq5c80 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 5f0c8a2e-7b1d-4c3e-9a6f-2d8b4e1c7a90' \ --data '{ "description": "Billing sync (v2)", "events": [ "invoice.*", "payment.*" ] }'Changes the endpoint’s url, description, events or active.
The signing secret stays the same, so your receiver keeps checking
signatures while the target or the event list changes. A field you
leave out keeps its value. url and events are checked as on
create, and events: [] means every event.
Send active: false to pause the endpoint: it gets no new events,
and its pending retries end as failed. Send active: true to
resume it. Writes an audit row.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The endpoint’s id (hc_).
Example
hc_whe_danslg2q3gpgqfoq5c80Header Parameters
Section titled “Header Parameters”Makes the call safe to retry. Send a random UUID, and the same value
on every retry. Keys are kept per account and mode, and every API key
and dashboard user of the account shares them, so make a key
unpredictable. A key over 255 characters is refused with 422
validation_, param: Idempotency-Key. A request sent with a
key runs to its end even if the client disconnects: retry with the
same key for its answer.
For 24 hours, a repeat from the same caller (the same API key or the
same dashboard user) with the same key, method, path, query string
and body gets the first response again, byte for byte, with an
Idempotent-Replayed: true header, instead of running again. A
first answer of 401, 403, 409, 422 or 503, or a 400 invalid JSON body, is not kept, so a retry with the same key runs again. A
request to a path or method no route serves holds no key.
A repeat sent while the first request is still running gets 409
with code conflict_ at once: retry it in a moment with
the same key. The same key from another caller,
or with a different method, path, query string or body, is a 422
with code idempotency_ at once, even while the first request
runs. The query string must match byte for byte. After
24 hours the key is free, and a request with it runs as new. The
other error cases are in
Idempotency. The usage routes do
not take it: each usage event carries its own idempotency_.
The requests whose answer carries a secret shown only once
(creating or rotating an API key, creating a webhook endpoint or
rotating its signing secret, rotating a customer’s cost dashboard
token, creating a card setup session) do not take it either:
Hardcount does not keep that answer.
Example
5f0c8a2e-7b1d-4c3e-9a6f-2d8b4e1c7a90Request Bodyrequired
Section titled “Request Bodyrequired”object
A new URL, checked as on create. It cannot be empty.
A new note. An empty string clears it.
A new list of event types, replacing the old one. [] means every event.
False pauses the endpoint; true resumes it.
Example
{ "description": "Billing sync (v2)", "events": [ "invoice.*", "payment.*" ]}Responses
Section titled “Responses”The updated endpoint
A URL that Hardcount sends webhook events to, for one mode. Its signing secret is never returned here: only creating the endpoint and rotating its secret show it, once.
object
The endpoint’s id (hc_).
The account the endpoint belongs to.
The mode the endpoint gets events from, true for live. It is the caller’s mode when the endpoint is created.
Where Hardcount POSTs each event. It must be https:// on a
public address. Outside production (APP_ENV is not
production), a localhost or loopback URL works too, over
http:// or https://. Each delivery checks the address again,
so a host that later points to a private address is not called.
Your note about the endpoint. Absent when empty.
Last 4 characters of the current signing secret.
The event types the endpoint gets. * means every event, and a
prefix such as invoice. means every event whose type starts
with invoice..
False while the endpoint is paused. A paused endpoint gets no
new events, its pending retries end as failed, and its
deliveries cannot be resent.
Last 4 characters of the previous signing secret, after a rotation. Absent if the secret was never rotated.
When the previous secret stops signing deliveries, 72 hours after the rotation. It stays in the answer after that time. Absent if the secret was never rotated.
When the endpoint was created.
When the endpoint last changed.
Example
{ "id": "hc_whe_danslg2q3gpgqfoq5c80", "tenant_id": "hc_ten_dajqj02q3gpgqfoq5c00", "livemode": false, "url": "https://example.com/hardcount/webhooks", "description": "Billing sync (v2)", "secret_last4": "4e9f", "events": [ "invoice.*", "payment.*" ], "active": true, "created_at": "2026-10-02T10:00:00Z", "updated_at": "2026-11-01T11:20:00Z"}The body is not one valid JSON value, it is not a JSON object, it
is empty where the operation needs one, or a field has the wrong
JSON type (such as a string where a number belongs). This answer
is not kept for an Idempotency-Key: send the corrected request
with the same 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": "invalid_request_error", "code": "invalid_request", "message": "invalid JSON body", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}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" }}No endpoint with this id in this mode, or it was deleted.
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": "not_found", "message": "webhook endpoint not found", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}The body is over the 1 MB limit. Send a smaller body. The answer is
the same with or without an Idempotency-Key, and it is not kept
for the key: the same key works for the smaller request.
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": "payload_too_large", "message": "The request body is larger than the 1 MB limit. Send a smaller body.", "request_id": "req_dbjg652q3gpgqfoq5cd0" }}url is empty, is not https:// (only a loopback URL outside
production may use http://), is a loopback URL in production,
cannot be looked up, or points to a private address; an event
type is unknown; or the body has an unknown field. param names
the field.
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": "must start with https://", "request_id": "req_dbjg652q3gpgqfoq5cd0", "param": "url" }}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