Skip to content

Supersede what was said about this line, correcting or reversing what it booked

POST
/v1/entities/{entity_id}/lines/{line_id}/reexplain
curl --request POST \
--url https://example.com/v1/entities/example/lines/example/reexplain \
--header 'Content-Type: application/json' \
--data '{ "kind": "example", "reason": "example", "legs": [ { "account": "example", "commodity": "example", "amount": "-12.00", "memo": "example", "tax_code": "example" } ], "parts": [ { "posting_id": "example", "amount": "-12.00" } ], "narration": "example", "dt": "example", "memo": "example", "tax_code": "example", "code": "", "comment": "", "id": "example" }'
line_id
required
Line Id
string
entity_id
required
Entity Id

The entity this path is relative to

string

The entity this path is relative to

Media typeapplication/json
LineReexplainSubmission

Supersede what was said about this line before.

The previous explanation is kept and the new one names it. If the previous one booked an entry, the books are put right through the ordinary correction path in the same transaction: kind: booked with new legs corrects it, and kind: linked/ignored reverses it. A closed period refuses.

object
kind
required
Kind

Booked | linked | ignored

string
reason
required
Reason

Why the previous reading was wrong; recorded verbatim

string
>= 1 characters
legs
Any of:
Array<object>
>= 1 items
LineLeg

One contra leg of a booking: what the line was for.

The cash leg is not supplied and cannot be: it is the statement line itself, on the line’s own account for the line’s own amount. These legs are the other side, and must sum to the negative of the line.

object
account
required
Account

Account path (preferred) or stable account id

string
>= 1 characters <= 255 characters
commodity
required
Commodity
string
>= 1 characters <= 64 characters
amount
required
Amount

Signed decimal amount in whole commodity units, as a string; never a JSON number. Converted by the commodity’s declared precision, so more decimal places than the currency has is refused rather than rounded.

string
/^-?[0-9]+(\.[0-9]+)?$/
memo
Any of:
string
<= 4096 characters
tax_code
Any of:
string
<= 255 characters
parts
Any of:
Array<object>
>= 1 items
LinePartSubmission

One part of a split: an existing posting, and how much of the line it is.

A posting is named by id: it has no path, and naming its account would not say which leg. The amount is in the line’s own commodity, the only commodity a part can be in.

object
posting_id
required
Posting Id
string
>= 1 characters <= 255 characters
amount
required
Amount

Signed decimal amount in whole commodity units, as a string; never a JSON number. Converted by the commodity’s declared precision, so more decimal places than the currency has is refused rather than rounded.

string
/^-?[0-9]+(\.[0-9]+)?$/
narration
Any of:
string
>= 1 characters <= 4096 characters
dt
Any of:
string
memo
Any of:
string
<= 4096 characters
tax_code
Any of:
string
<= 255 characters
code
Code
string
"" <= 255 characters
comment
Comment
string
"" <= 4096 characters
id
Any of:
string

Successful Response

Media typeapplication/json
LineResponse
object
entity_id
required
Entity Id
string
legal_name
required
Legal Name
string
base_currency
required
Base Currency
string
snapshot_seq
required
Snapshot Seq
integer
line
required
Line

What has become of one statement line.

status is derived from the live explanation, never stored, so there is exactly one answer. unexplained_micros is the remainder, reported in every state including a fully explained line, where it is "0". history is every explanation ever written for this line, oldest first.

object
line_id
required
Line Id
string
statement_id
required
Statement Id
string
statement_live
required
Statement Live
boolean
line_no
required
Line No
integer
source_key
required
Source Key
string
dt
required
Dt
string
amount_micros
required
Amount Micros

Signed integer micro-units (millionths) as a base-10 string; never a JSON number.

string
/^-?(0|[1-9][0-9]*)$/
commodity
required
Commodity
string
account_id
required
Account Id
string
description
required
Description
string
reference
required
Any of:
string
raw
required
Raw
string
status
required
Status

Unexplained | partly_explained | booked | linked | ignored | superseded_input

string
allocated_micros
required
Allocated Micros

Signed integer micro-units (millionths) as a base-10 string; never a JSON number.

string
/^-?(0|[1-9][0-9]*)$/
unexplained_micros
required
Unexplained Micros

Signed integer micro-units (millionths) as a base-10 string; never a JSON number.

string
/^-?(0|[1-9][0-9]*)$/
explanation
required
Any of:
LineExplanation

One thing somebody said about a line. The chain of these is the line’s history.

object
explanation_id
required
Explanation Id
string
line_id
required
Line Id
string
kind
required
Kind

Booked | linked | ignored

string
reason
required
Reason
string
entry_id
required
Any of:
string
correction_id
required
Any of:
string
supersedes_id
required
Any of:
string
allocations
required
Allocations
Array<object>
LineAllocation
object
allocation_id
required
Allocation Id
string
posting_id
required
Posting Id
string
entry_id
required
Entry Id
string
amount_micros
required
Amount Micros

Signed integer micro-units (millionths) as a base-10 string; never a JSON number.

string
/^-?(0|[1-9][0-9]*)$/
allocated_micros
required
Allocated Micros

Signed integer micro-units (millionths) as a base-10 string; never a JSON number.

string
/^-?(0|[1-9][0-9]*)$/
created_at
required
Created At
string
created_by
required
Created By
string
history
required
History
Array<object>
LineExplanation

One thing somebody said about a line. The chain of these is the line’s history.

object
explanation_id
required
Explanation Id
string
line_id
required
Line Id
string
kind
required
Kind

Booked | linked | ignored

string
reason
required
Reason
string
entry_id
required
Any of:
string
correction_id
required
Any of:
string
supersedes_id
required
Any of:
string
allocations
required
Allocations
Array<object>
LineAllocation
object
allocation_id
required
Allocation Id
string
posting_id
required
Posting Id
string
entry_id
required
Entry Id
string
amount_micros
required
Amount Micros

Signed integer micro-units (millionths) as a base-10 string; never a JSON number.

string
/^-?(0|[1-9][0-9]*)$/
allocated_micros
required
Allocated Micros

Signed integer micro-units (millionths) as a base-10 string; never a JSON number.

string
/^-?(0|[1-9][0-9]*)$/
created_at
required
Created At
string
created_by
required
Created By
string
entries
Entries

The entries this line is booked or linked to, oldest first

Array<object>
LineEntry

An entry a statement line is explained by, with the mirror that already reverses it, if any.

object
id
required
Id
string
dt
required
Dt
string
narration
required
Narration
string
status
required
Status
string
origin
required
Origin
string
version
required
Version
integer
code
required
Code
string
comment
required
Comment
string
tags
required
Tags
Array<Array<string>>
created_at
required
Created At
string
created_by
required
Created By
string
postings
required
Postings
Array<object>
Posting
object
id
required
Id
string
seq
required
Seq
integer
account_id
required
Account Id
string
account_path
required
Account Path
string
commodity
required
Commodity
string
amount_micros
required
Amount Micros

Signed integer micro-units (millionths) as a base-10 string; never a JSON number.

string
/^-?(0|[1-9][0-9]*)$/
memo
required
Any of:
string
tax_code
required
Any of:
string
links
required
Links
object
key
additional properties
string
reversed_by
Any of:
string
links
required
Links
object
key
additional properties
string
result
Any of:
object
key
additional properties
any

Example

{
"line": {
"amount_micros": "-12000000",
"allocated_micros": "-12000000",
"unexplained_micros": "-12000000",
"explanation": {
"allocations": [
{
"amount_micros": "-12000000"
}
],
"allocated_micros": "-12000000"
},
"history": [
{
"allocations": [
{
"amount_micros": "-12000000"
}
],
"allocated_micros": "-12000000"
}
],
"entries": [
{
"postings": [
{
"amount_micros": "-12000000"
}
]
}
]
}
}

Bad Request

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Unauthorized

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Forbidden

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Not Found

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Conflict

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Precondition Failed

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Unprocessable Content

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Internal Server Error

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}

Service Unavailable

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
retryable
required
Retryable
boolean
details
required
Details
Array<object>
object
key
additional properties
any
request_id
Any of:
string
next_action
Any of:
object
key
additional properties
any

Example generated

{
"error": {
"code": "example",
"message": "example",
"retryable": true,
"details": [
{}
],
"request_id": "example",
"next_action": {}
}
}