Skip to content

Register a document by its hash: an invoice, a receipt, a contract, anything the books rest on

POST
/v1/entities/{entity_id}/documents
curl --request POST \
--url https://example.com/v1/entities/example/documents \
--header 'Content-Type: application/json' \
--data '{ "sha256": "example", "filename": "example", "media_type": "example", "size_bytes": 1, "blob_path": "", "external_ref": "example", "reason": "example" }'

Register a document; 201 when this call registered it, 200 when the same bytes were already here.

A document is identified by its content, so two entries resting on one invoice will register it twice in the ordinary course of events. That is not refused, and the caller does not need to look first. The one contradiction that is refused is a different size_bytes for the same hash.

entity_id
required
Entity Id

The entity this path is relative to

string

The entity this path is relative to

Media typeapplication/json
DocumentSubmission

A document to register: the bytes’ hash, what the file is called, and where it is kept.

The ledger records this and does not fetch it, the same contract as POST /statements. Identity is sha256 alone, so registering the same file twice returns the existing row rather than creating a second one or refusing.

object
sha256
required
Sha256

SHA-256 of the document, 64 lowercase hex characters; its identity here

string
>= 64 characters <= 64 characters /^[0-9a-f]{64}$/
filename
required
Filename
string
>= 1 characters <= 512 characters
media_type
required
Media Type
string
>= 1 characters <= 255 characters
size_bytes
required
Size Bytes

Size of the document in bytes

integer
blob_path
Blob Path

Where the bytes are kept, when this service keeps them

string
"" <= 2048 characters
external_ref
Any of:
string
<= 2048 characters
reason
required
Reason

Why it is being registered; kept in the record

string
>= 1 characters

OK

Media typeapplication/json
DocumentResponse
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
document
required
Document

A registered document, read back.

links.content is present only when the bytes are here to be served. An external document has nothing at that address, and the link would only give the interface a button that always fails.

object
sha256
required
Sha256

SHA-256 of the registered bytes, and the document’s identity

string
filename
required
Filename
string
media_type
required
Media Type
string
size_bytes
required
Size Bytes
integer
storage
required
Storage

Stored | external

string
external_ref
required
Any of:
string
id
required
Id
string
filing_count
required
Filing Count

How many records cite this document

integer
created_at
required
Created At
string
created_by
required
Created By
string
links
required
Links
object
key
additional properties
string
created
required
Created

False when this call found the document already registered

boolean
filings
required
Filings
Array<object>
DocumentFiling

One place a document is cited: which record, where in the file, and what it says.

object
evidence_id
required
Evidence Id
string
subject_kind
required
Subject Kind

Entry | statement

string
subject_id
required
Any of:
string
page
required
Any of:
integer
locator
required
Locator
string
caption
required
Caption
string
created_at
required
Created At
string
created_by
required
Created By
string

Example generated

{
"entity_id": "example",
"legal_name": "example",
"base_currency": "example",
"snapshot_seq": 1,
"document": {
"sha256": "example",
"filename": "example",
"media_type": "example",
"size_bytes": 1,
"storage": "example",
"external_ref": "example",
"id": "example",
"filing_count": 1,
"created_at": "example",
"created_by": "example",
"links": {
"additionalProperty": "example"
}
},
"created": true,
"filings": [
{
"evidence_id": "example",
"subject_kind": "example",
"subject_id": "example",
"page": 1,
"locator": "example",
"caption": "example",
"created_at": "example",
"created_by": "example"
}
]
}

Successful Response

Media typeapplication/json
DocumentResponse
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
document
required
Document

A registered document, read back.

links.content is present only when the bytes are here to be served. An external document has nothing at that address, and the link would only give the interface a button that always fails.

object
sha256
required
Sha256

SHA-256 of the registered bytes, and the document’s identity

string
filename
required
Filename
string
media_type
required
Media Type
string
size_bytes
required
Size Bytes
integer
storage
required
Storage

Stored | external

string
external_ref
required
Any of:
string
id
required
Id
string
filing_count
required
Filing Count

How many records cite this document

integer
created_at
required
Created At
string
created_by
required
Created By
string
links
required
Links
object
key
additional properties
string
created
required
Created

False when this call found the document already registered

boolean
filings
required
Filings
Array<object>
DocumentFiling

One place a document is cited: which record, where in the file, and what it says.

object
evidence_id
required
Evidence Id
string
subject_kind
required
Subject Kind

Entry | statement

string
subject_id
required
Any of:
string
page
required
Any of:
integer
locator
required
Locator
string
caption
required
Caption
string
created_at
required
Created At
string
created_by
required
Created By
string

Example generated

{
"entity_id": "example",
"legal_name": "example",
"base_currency": "example",
"snapshot_seq": 1,
"document": {
"sha256": "example",
"filename": "example",
"media_type": "example",
"size_bytes": 1,
"storage": "example",
"external_ref": "example",
"id": "example",
"filing_count": 1,
"created_at": "example",
"created_by": "example",
"links": {
"additionalProperty": "example"
}
},
"created": true,
"filings": [
{
"evidence_id": "example",
"subject_kind": "example",
"subject_id": "example",
"page": 1,
"locator": "example",
"caption": "example",
"created_at": "example",
"created_by": "example"
}
]
}

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": {}
}
}