Markets
Get Lifecycle Statement
Download a PDF statement of a market lifecycle
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
lifecycle-statement
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/lifecycle-statement?from=2026-01-01&to=2026-06-30" \
-H "X-API-Key: trusset_your_key_here" \
-o statement.pdf
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/lifecycle-statement?categories=loans,liquidations`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
if (res.headers.get('content-type')?.includes('application/pdf')) {
const blob = await res.blob();
save(blob);
} else {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message}`);
}
{
"success": false,
"error": {
"code": "INVALID_CATEGORIES",
"message": "Unknown category: positions. Valid: config, roles, encumbrances, loans, liquidations, auctions"
}
}
{
"success": false,
"error": {
"code": "INDEX_STALE",
"message": "The event index is 12 minutes behind the chain (indexed through block 8412791 at 2026-09-25T11:03:24.000Z), so a document generated now would present itself as the market's record while omitting everything since. Retry once the index has caught up, or pass allowStale=true to generate a document that carries an explicit lag notice in its header and coverage."
}
}
Returns a PDF statement of the market assembled from indexed on-chain events. It covers configuration and parameter changes, roles and authorizations, collateral locks, loans with the liquidity provider ledger, oracle price history, liquidations and auctions. Use it for reporting and audit rather than for programmatic reads.
The Market section names the collateral token’s ISIN with its source. When the token’s instrument record carries an ISIN, it is printed as ISIN, and an ISIN source line notes a different value reported by the token contract. When only the token contract reports one, it is printed as ISIN (token contract), with an ISIN source line saying that no instrument record confirms it.
A statement generated from an index that trails the chain would present itself as the market’s record while omitting everything since. The endpoint therefore refuses with
This endpoint does not return the JSON envelope. On success it responds with
Content-Type: application/pdf and a Content-Disposition: attachment header carrying the generated filename. Errors are returned as the usual JSON envelope, so branch on the response content type rather than parsing unconditionally.INDEX_STALE when the index is more than 300 seconds behind, unless you pass allowStale. Get Index Status reports the lag.
Path Parameters
string
required
Query Parameters
string
Comma-separated sections to include. Any of
config, roles, encumbrances, loans, liquidations, auctions. Omit for all six. Between 1 and 200 characters. Unknown names are rejected.string
Restrict the statement to a single loan. A positive integer of at most 18 digits.
string
Start of the reporting window as
YYYY-MM-DD, from the start of that day in UTC. Not earlier than 2015-01-01.string
End of the reporting window as
YYYY-MM-DD, inclusive to the end of that day in UTC. Must not be earlier than from.string
true or 1 generates the statement even when the index is more than 300 seconds behind the chain. The document then carries an explicit lag notice in its header and coverage. Any other value leaves the refusal in place.Response
A PDF document. The server sets the filename on theContent-Disposition header from the collateral token symbol, the loan when loanId was given, and the generation date, for example Lending-Lifecycle-Statement_NYF1_loan-5_2026-09-25.pdf.
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/lifecycle-statement?from=2026-01-01&to=2026-06-30" \
-H "X-API-Key: trusset_your_key_here" \
-o statement.pdf
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/lifecycle-statement?categories=loans,liquidations`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
if (res.headers.get('content-type')?.includes('application/pdf')) {
const blob = await res.blob();
save(blob);
} else {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message}`);
}
{
"success": false,
"error": {
"code": "INVALID_CATEGORIES",
"message": "Unknown category: positions. Valid: config, roles, encumbrances, loans, liquidations, auctions"
}
}
{
"success": false,
"error": {
"code": "INDEX_STALE",
"message": "The event index is 12 minutes behind the chain (indexed through block 8412791 at 2026-09-25T11:03:24.000Z), so a document generated now would present itself as the market's record while omitting everything since. Retry once the index has caught up, or pass allowStale=true to generate a document that carries an explicit lag notice in its header and coverage."
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_MARKET_ADDRESS | 400 | The market has no on-chain address |
VALIDATION_ERROR | 400 | A query parameter is malformed: categories empty or over 200 characters, loanId not digits, a date not YYYY-MM-DD |
INVALID_CATEGORIES | 400 | categories names a section that does not exist, or names none |
INVALID_LOAN_ID | 400 | loanId is zero |
INVALID_DATE | 400 | from or to is not a calendar date, or falls outside the supported range |
INVALID_DATE_RANGE | 400 | from is after to |
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
LOAN_NOT_FOUND | 404 | The requested loanId is not recorded for this market |
DATASET_TOO_LARGE | 413 | The window covers more activity than one statement can carry. Narrow it with from, to, categories or loanId |
NOT_CONFIGURED | 503 | Event indexing is not configured for this network |
INDEX_NOT_DEPLOYED | 503 | The event index this environment reads is not deployed at its endpoint |
INDEX_UNAVAILABLE | 503 | The index did not report its status |
INDEX_UNHEALTHY | 503 | The index reports indexing errors, so statement generation is suspended |
MARKET_NOT_INDEXED | 503 | The market has produced no indexed history yet |
INDEX_STALE | 503 | The index is more than 300 seconds behind the chain and allowStale was not set |
UPSTREAM_ERROR | 503 | The index returned an error |
QUERY_ERROR | 503 | The statement query was rejected by the index |
EMPTY_RESPONSE | 503 | The index returned no payload |
TIMEOUT | 503 | The statement could not be assembled within its time budget |
NETWORK_ERROR | 503 | The index could not be reached over the network |
⌘I
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/lifecycle-statement?from=2026-01-01&to=2026-06-30" \
-H "X-API-Key: trusset_your_key_here" \
-o statement.pdf
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/lifecycle-statement?categories=loans,liquidations`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
if (res.headers.get('content-type')?.includes('application/pdf')) {
const blob = await res.blob();
save(blob);
} else {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message}`);
}
{
"success": false,
"error": {
"code": "INVALID_CATEGORIES",
"message": "Unknown category: positions. Valid: config, roles, encumbrances, loans, liquidations, auctions"
}
}
{
"success": false,
"error": {
"code": "INDEX_STALE",
"message": "The event index is 12 minutes behind the chain (indexed through block 8412791 at 2026-09-25T11:03:24.000Z), so a document generated now would present itself as the market's record while omitting everything since. Retry once the index has caught up, or pass allowStale=true to generate a document that carries an explicit lag notice in its header and coverage."
}
}
