API reference
Webhook subscriptions
Addresses the books' events are sent to as they happen, signed, with each delivery and its tries.
- GET
/v1/webhook_subscriptionsList the addresses the books send events to - POST
/v1/webhook_subscriptionsSend the books' events to an address - GET
/v1/webhook_subscriptions/{subscription_id}Get a webhook subscription - PATCH
/v1/webhook_subscriptions/{subscription_id}Change a webhook subscription, or switch it off and on - DELETE
/v1/webhook_subscriptions/{subscription_id}Delete a webhook subscription - GET
/v1/webhook_subscriptions/{subscription_id}/deliveriesList what was sent to a subscription - GET
/v1/webhook_subscriptions/{subscription_id}/secretGet the secret a subscription's deliveries are signed with - POST
/v1/webhook_subscriptions/{subscription_id}/testSend a test event to a subscription
Guides: Webhooks
List the addresses the books send events to
GET/v1/webhook_subscriptions
client.webhookSubscriptions.list()
The addresses these books send their events to, the newest first.
Parameters
| Name | Type | Description |
|---|---|---|
enabledQuery | boolean or null | Only those switched on ( |
limitQuery | integer | Page size, 1–200. |
cursorQuery | string or null | The |
Response
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl "https://api.ledgerit.ai/v1/webhook_subscriptions" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Send the books' events to an address
POST/v1/webhook_subscriptions· Idempotent
client.webhookSubscriptions.create()
Send these books' events to an https address. Every event from now on
that it wants is POSTed to it, signed with its secret (read it with
GET /webhook_subscriptions/{id}/secret), and retried until the address
answers 2xx.
Request body
Response
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X POST "https://api.ledgerit.ai/v1/webhook_subscriptions" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"url":"…"}'Get a webhook subscription
GET/v1/webhook_subscriptions/{subscription_id}
client.webhookSubscriptions.get()
One webhook subscription.
Parameters
| Name | Type | Description |
|---|---|---|
subscription_idPath · Required | string | An id that starts with |
Response
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl "https://api.ledgerit.ai/v1/webhook_subscriptions/{subscription_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Change a webhook subscription, or switch it off and on
PATCH/v1/webhook_subscriptions/{subscription_id}
client.webhookSubscriptions.update()
Change a subscription's address, description or events, or switch it off and on. Only the fields sent change.
Parameters
| Name | Type | Description |
|---|---|---|
subscription_idPath · Required | string | An id that starts with |
Request body
Response
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X PATCH "https://api.ledgerit.ai/v1/webhook_subscriptions/{subscription_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'Delete a webhook subscription
DELETE/v1/webhook_subscriptions/{subscription_id}
client.webhookSubscriptions.delete()
Stop sending events to an address, for good. Its deliveries still waiting go with it.
Parameters
| Name | Type | Description |
|---|---|---|
subscription_idPath · Required | string | An id that starts with |
Response
204No content
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X DELETE "https://api.ledgerit.ai/v1/webhook_subscriptions/{subscription_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"List what was sent to a subscription
GET/v1/webhook_subscriptions/{subscription_id}/deliveries
client.webhookSubscriptions.listDeliveries()
What has been sent to a subscription, and what is waiting, the newest first: each event, how many tries, and why the last one failed.
Parameters
| Name | Type | Description |
|---|---|---|
subscription_idPath · Required | string | An id that starts with |
statusQuery | string or null | Only pending, delivered |
limitQuery | integer | Page size, 1–200. |
cursorQuery | string or null | The |
Response
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl "https://api.ledgerit.ai/v1/webhook_subscriptions/{subscription_id}/deliveries" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Get the secret a subscription's deliveries are signed with
GET/v1/webhook_subscriptions/{subscription_id}/secret
client.webhookSubscriptions.getSecret()
The secret a subscription's deliveries are signed with, to check the
LedgerIt-Signature header against.
Parameters
| Name | Type | Description |
|---|---|---|
subscription_idPath · Required | string | An id that starts with |
Response
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl "https://api.ledgerit.ai/v1/webhook_subscriptions/{subscription_id}/secret" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Send a test event to a subscription
POST/v1/webhook_subscriptions/{subscription_id}/test· Idempotent
client.webhookSubscriptions.test()
Send a webhook.test event to this subscription alone, to see its
address answer. It is queued like any delivery and listed with them.
Parameters
| Name | Type | Description |
|---|---|---|
subscription_idPath · Required | string | An id that starts with |
Response
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X POST "https://api.ledgerit.ai/v1/webhook_subscriptions/{subscription_id}/test" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Idempotency-Key: $(uuidgen)"Objects
The objects these operations take and return.
WebhookSubscriptionPage
| Name | Type | Description |
|---|---|---|
dataRequired | array of WebhookSubscriptionOut | |
has_moreRequired | boolean | |
next_cursorRequired | string or null |
WebhookSubscriptionCreate
| Name | Type | Description |
|---|---|---|
description | string or null | What it is for. |
event_types | array of string | The events to send: types such as |
urlRequired | string | An https address. |
WebhookSubscriptionOut
| Name | Type | Description |
|---|---|---|
created_atRequired | string (date-time) | |
descriptionRequired | string or null | What it is for, as its maker put it. |
disabled_reasonRequired | string or null | Why it is off: person, failing |
enabledRequired | boolean | Whether events are being sent to it. |
event_typesRequired | array of string | The event types and families it is sent. Empty: every event. |
failing_sinceRequired | string (date-time) or null | The first failure since a delivery last landed. Null while deliveries land. |
idRequired | string | An id that starts with |
updated_atRequired | string (date-time) | |
urlRequired | string | The https address events are POSTed to. |
WebhookSubscriptionUpdate
| Name | Type | Description |
|---|---|---|
description | string or null | What it is for. An empty string clears it. |
enabled | boolean or null | Switch it off, or back on. Back on, the deliveries that waited are sent at once. |
event_types | array of string or null | The events to send: types such as |
url | string or null | A new https address. |
WebhookDeliveryPage
| Name | Type | Description |
|---|---|---|
dataRequired | array of WebhookDeliveryOut | |
has_moreRequired | boolean | |
next_cursorRequired | string or null |
WebhookSecret
| Name | Type | Description |
|---|---|---|
secretRequired | string | What each delivery is signed with: the |
WebhookDeliveryOut
| Name | Type | Description |
|---|---|---|
attemptsRequired | integer | Times it has been tried. |
created_atRequired | string (date-time) | |
delivered_atRequired | string (date-time) or null | |
event_idRequired | string | The event, and the |
event_typeRequired | string | What happened, such as |
idRequired | string | An id that starts with |
last_errorRequired | string or null | Why the last try failed, such as |
next_attempt_atRequired | string (date-time) or null | When it is tried next, while pending. |
statusRequired | string |
pending, delivered |