API reference
Approvals
A person's go-ahead for a payment, bound to its amount and destination, expiring, and stale the moment either changes.
- GET
/v1/approvalsList approvals - GET
/v1/approvals/{approval_id}Get an approval - POST
/v1/approvals/{approval_id}/decideApprove or reject
Guides: Record payments and apply them
List approvals
GET/v1/approvals
client.approvals.list()
Approvals asked for in these books, the newest first: what waits for a decision, and what was decided.
Parameters
| Name | Type | Description |
|---|---|---|
statusQuery | string or null | Only |
subject_idQuery | string or null | An id. Which resource it names is given by the field beside it. |
limitQuery | integer | Page size, 1–200. |
cursorQuery | string or null | The |
Response
200ApprovalPage
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/approvals" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Get an approval
GET/v1/approvals/{approval_id}
client.approvals.get()
One approval: what it approves, who decided, and whether it stands.
Parameters
| Name | Type | Description |
|---|---|---|
approval_idPath · Required | string | An id that starts with |
Response
200ApprovalOut
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/approvals/{approval_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Approve or reject
POST/v1/approvals/{approval_id}/decide· Idempotent
client.approvals.decide()
Approve or reject, once. Needs money.approve, or an approval limit
in the approval's currency that covers its amount (the Approver
add-on); anyone else is refused with role. An approval past its expiry
is refused with conflict: ask for another. So is a change the
assistant proposed, which its person decides in the conversation.
Parameters
| Name | Type | Description |
|---|---|---|
approval_idPath · Required | string | An id that starts with |
Request body
Response
200ApprovalOut
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/approvals/{approval_id}/decide" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"decision":"…"}'Objects
The objects these operations take and return.
ApprovalPage
| Name | Type | Description |
|---|---|---|
dataRequired | array of ApprovalOut | |
has_moreRequired | boolean | |
next_cursorRequired | string or null |
ApprovalOut
| Name | Type | Description |
|---|---|---|
actionRequired | string | What it lets happen: |
amountRequired | string or null | |
can_decideRequired | boolean | Whether the caller may decide it here: pending, and theirs to approve ( |
created_atRequired | string (date-time) | |
currencyRequired | string or null | |
decided_atRequired | string (date-time) or null | |
decisionsRequired | array of DecisionOut | |
expires_atRequired | string (date-time) or null | |
idRequired | string | An id that starts with |
requested_byRequired | string or null | An id that starts with |
standsRequired | boolean | Approved, unexpired, and the subject is still what it was when asked: false once a payment's amount or destination changes. |
statusRequired | string |
|
subject_idRequired | string | An id. Which resource it names is given by the field beside it. |
subject_typeRequired | string | What is approved: |
ApprovalDecide
| Name | Type | Description |
|---|---|---|
comment | string or null | |
decisionRequired | string |
|
DecisionOut
| Name | Type | Description |
|---|---|---|
actor_idRequired | string or null | An id that starts with |
commentRequired | string or null | |
decisionRequired | string | |
recorded_atRequired | string (date-time) |