Skip to main content

Witness API

Reference guide for the BitEscrow Witness API.

EndpointDescription
/api/witness/listList statements by pubkey.
/api/witness/:widFetch a statement by ID.

Notice any mistakes, or something missing? Please let us know!
You can submit an issue here: Submit Issue


List Statements By Pubkey

Request a list of statements that are endorsed by the token's pubkey.

Request Format

method   : 'GET'
endpoint : '/api/witness/list'
headers : { 'content-type' : 'application/json' }

Response Interface

interface WitnessListResponse {
data : {
receipts : WitnessReceipt[]
}
}

Example Request

// Generate a request token.
const req = signer.witness.list()
// Submit the request and token.
const res = await client.witness.list(req)
// Check the response is valid.
if (!res.ok) throw new Error(res.error)
// Unpack our data payload.
const { receipts } = res.data

See the full code example here.

Related Interfaces:


Read a Statement By Id

Fetch a witness statement from the server by its identifier (wid).

Request Format

method   : 'GET'
endpoint : '/api/witness/:wid'

Response Interface

interface WitnessDataResponse {
data : {
receipt : WitnessReceipt
}
}

Example Request

// Fetch a contract from the server by cid.
const res = await client.witness.read(wid)
// Check the response is valid.
if (!res.ok) throw new Error(res.error)
// Unpack the data object.
const { receipt } = res.data

See the full code example here.

Example Response

Related Interfaces: