API reference

Detected sources

The accounts the books' own transactions name and the books do not read yet, such as a Stripe payout or a Gusto debit, with the lines that named them.

Guides: Connect your banks, cards, payroll and revenue

List the sources the books' lines name

GET/v1/detected_sources

client.detectedSources.list()

The sources the books' own lines name — a Stripe payout, a Gusto debit — each with how often, what moved through it and its newest lines, newest first. An open one is a suggestion to connect.

Parameters

NameTypeDescription
statusQuerystring or null

Only sources in this state: open, dismissed or connected.

kindQuerystring or null

Only sources of this kind.

limitQueryinteger

Page size, 1–200.

Default 50
cursorQuerystring or null

The next_cursor of the previous page.

Response

200DetectedSourcePage

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/detected_sources" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN"

Read the books' lines again for sources

POST/v1/detected_sources/scan

client.detectedSources.scan()

Read the last year of lines again for the sources they name. Every sync and upload already does this for what it brings in, and a daily sweep does it for every set of books; this is for now. Safe to repeat: a line is evidence of a source once.

Response

200DetectedSourceScanOut

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/detected_sources/scan" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN"

Get a source the books' lines name

GET/v1/detected_sources/{source_id}

client.detectedSources.get()

One source the lines name, with its newest lines.

Parameters

NameTypeDescription
source_idPath · Requiredstring

An id that starts with detected_source_.

Response

200DetectedSourceOut

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/detected_sources/{source_id}" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN"

Dismiss or restore a suggested source

PATCH/v1/detected_sources/{source_id}

client.detectedSources.update()

Dismiss a suggestion (status: dismissed): the books do not use the source, or do not want it read, and it is not suggested again. open takes that back; a dismissed source whose provider is connected comes back as connected. Setting connected by hand is refused (422): connect the provider instead.

Parameters

NameTypeDescription
source_idPath · Requiredstring

An id that starts with detected_source_.

Request body

DetectedSourceUpdate

Response

200DetectedSourceOut

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 PATCH "https://api.ledgerit.ai/v1/detected_sources/{source_id}" \
  -H "Authorization: Bearer $LEDGERIT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status":"…"}'

Objects

The objects these operations take and return.

DetectedSourcePage

NameTypeDescription
dataRequiredarray of DetectedSourceOut
has_moreRequiredboolean
next_cursorRequiredstring or null

DetectedSourceScanOut

What reading the lines again found.

NameTypeDescription
examinedRequiredinteger

Lines read.

sightingsRequiredinteger

Lines that named a source for the first time.

sourcesRequiredarray of string

The keys of the sources the lines named.

DetectedSourceOut

NameTypeDescription
connection_idRequiredstring or null

An id that starts with conn_.

created_atRequiredstring (date-time)
dismissed_atRequiredstring (date-time) or null
dismissed_byRequiredstring or null

An id that starts with usr_.

first_seen_onRequiredstring (date)

The earliest line that named it.

idRequiredstring

An id that starts with detected_source_.

inflowRequiredMoney

What came in from it, in the books' currency.

keyRequiredstring

The source, by the catalog's key for it: stripe, paypal, adp.

kindRequiredstring

What connecting it would bring: revenue, banking, card, payroll, ap, ledger or cap_table.

last_seen_onRequiredstring (date)

The latest line that named it.

nameRequiredstring

The source's name: Stripe, PayPal, ADP.

outflowRequiredMoney

What went out to it, in the books' currency.

providerRequiredstring or null

The provider that connects it (POST /connections), or null when nothing does yet and a statement upload is the way in.

samplesRequiredarray of DetectedSourceSampleOut

Its newest lines, at most five: the evidence.

sightingsRequiredinteger

How many lines named it.

statusRequiredstring

open: suggested. dismissed: a person said the books do not use it. connected: a connection to its provider exists.

updated_atRequiredstring (date-time)

DetectedSourceUpdate

NameTypeDescription
statusRequiredstring

dismissed to say the books do not use it (it is not suggested again), or open to take that back. connected is never set by hand: connect the provider.

Money

An amount and its currency. amount is a base-10 string with two to four decimal places — two unless the currency counts finer, as a dinar does — and an optional leading minus sign. Parse it with a decimal type, not a float.

NameTypeDescription
amountRequiredstring
currencyRequiredstring

ISO 4217 code.

DetectedSourceSampleOut

One of the lines that named the source.

NameTypeDescription
amountRequiredMoney

Signed: positive came in, negative went out.

dateRequiredstring (date)

The line's date, in its source's reckoning.

descriptionRequiredstring

The line, as its source wrote it.

matched_textRequiredstring

The words in the line that named the source: stripe, gusto.

transaction_idRequiredstring or null

An id that starts with txn_.