API reference

Receipt requests

Missing receipts asked of the person who swiped the card, by email, with reminders.

Guides: Get missing receipts from cardholders

Get whether the books ask cardholders

GET/v1/receipt_request_settings

client.receiptRequests.getSettings()

Whether the books ask cardholders for missing receipts on their own.

Response

200ReceiptRequestSettingsOut

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
curl "https://api.ledgerit.ai/v1/receipt_request_settings" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN"

Turn asking cardholders on or off

PUT/v1/receipt_request_settings

client.receiptRequests.setSettings()

Turn asking cardholders on their own on or off. Requests already made carry on; turned off, a person asks from the Inbox.

Request body

ReceiptRequestSettingsIn

Response

200ReceiptRequestSettingsOut

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
curl -X PUT "https://api.ledgerit.ai/v1/receipt_request_settings" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ask_automatically":false}'

List the receipts asked of cardholders

GET/v1/receipt_requests

client.receiptRequests.list()

The receipts asked of cardholders, the newest first, with what each came to.

Parameters

NameTypeDescription
transaction_idQuerystring or null

An id that starts with txn_.

statusQuerystring or null

Only open, completed, cancelled or expired ones.

One of open, completed, cancelled, expired
limitQueryinteger

Page size, 1–200.

Default 50
cursorQuerystring or null

The next_cursor of the previous page.

Response

200ReceiptRequestPage

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
curl "https://api.ledgerit.ai/v1/receipt_requests" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN"

Ask a cardholder for a charge's receipt

POST/v1/receipt_requests· Idempotent

client.receiptRequests.create()

Ask the cardholder for a charge's receipt. They are emailed a link to a page that needs no account and works for 30 days, where they upload a photo or a PDF; it is attached to the charge and read like any receipt. Reminders follow on day 3 and day 7. The charge's missing_receipt item waits on them meanwhile. Asking again cancels the open request, and its link stops working. emailed says whether the email went; when it did not, the request is open all the same and the books try again. A cardholder who is a member of the books is not emailed: they upload the receipt from their Inbox, and asking them without an email is refused (409).

Request body

ReceiptRequestCreate

Response

201ReceiptRequestOut

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
curl -X POST "https://api.ledgerit.ai/v1/receipt_requests" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"transaction_id":"…"}'

Get a receipt request

GET/v1/receipt_requests/{request_id}

client.receiptRequests.get()

One receipt request, and what it came to.

Parameters

NameTypeDescription
request_idPath · Requiredstring

An id that starts with rcpt_req_.

Response

200ReceiptRequestOut

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
curl "https://api.ledgerit.ai/v1/receipt_requests/{request_id}" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN"

Cancel a receipt request

POST/v1/receipt_requests/{request_id}/cancel

client.receiptRequests.cancel()

Stop an open request's link working. The charge's missing_receipt item goes back to the owner. Settled requests stay as they are.

Parameters

NameTypeDescription
request_idPath · Requiredstring

An id that starts with rcpt_req_.

Response

200ReceiptRequestOut

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
curl -X POST "https://api.ledgerit.ai/v1/receipt_requests/{request_id}/cancel" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN"

Email a receipt request again

POST/v1/receipt_requests/{request_id}/resend· Idempotent

client.receiptRequests.resend()

Email an open request's link again, now. Not twice within a day: a cardholder emailed less than a day ago is refused (409).

Parameters

NameTypeDescription
request_idPath · Requiredstring

An id that starts with rcpt_req_.

Response

200ReceiptRequestOut

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
curl -X POST "https://api.ledgerit.ai/v1/receipt_requests/{request_id}/resend" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"

Objects

The objects these operations take and return.

ReceiptRequestSettingsOut

NameTypeDescription
ask_automaticallyRequiredboolean

Whether a missing receipt is asked of its cardholder as soon as it is raised, when the books know their address. On by default.

ReceiptRequestSettingsIn

NameTypeDescription
ask_automaticallyRequiredboolean

Ask cardholders on their own, or only when a person does.

ReceiptRequestPage

NameTypeDescription
dataRequiredarray of ReceiptRequestOut
has_moreRequiredboolean
next_cursorRequiredstring or null

ReceiptRequestCreate

NameTypeDescription
cardholderstring or null

Who to ask, when the card program does not say. Left out, the person it names.

emailstring or null

Where to send the link. Left out, the cardholder's address the books know: the one the card program gave, a member's of the same name, or one given before. Given for a cardholder the card program names, it is kept for that name.

transaction_idRequiredstring

The card charge. Asking again cancels its open request, and that link stops working.

ReceiptRequestOut

NameTypeDescription
cancelled_atRequiredstring (date-time) or null
cardholderRequiredstring

Who it is asked of: the person who spent the charge.

completed_atRequiredstring (date-time) or null
created_atRequiredstring (date-time)
document_idRequiredstring or null

An id that starts with doc_.

emailedboolean or null

On a request just made or sent again: whether the email went. Null when read later.

expiredRequiredboolean

Open, but past its day: the sweep is about to expire it.

expired_atRequiredstring (date-time) or null
expires_atRequiredstring (date-time)

When its link stops working.

idRequiredstring

An id that starts with rcpt_req_.

reminded_atRequiredstring (date-time) or null

When it was last emailed again.

reminders_sentRequiredinteger

Reminders sent so far: on day 3 and day 7, at most two.

requested_byRequiredstring or null

An id that starts with usr_.

sent_atRequiredstring (date-time) or null

When the first email went; null while it waits to go.

sent_toRequiredstring

The address the link is emailed to.

statusRequiredstring

open until the cardholder uploads the receipt (completed), someone cancels it or asks again (cancelled), or its 30 days run out (expired).

One of open, completed, cancelled, expired
transaction_idRequiredstring

The card charge whose receipt is asked for.