Ledger collections & retrieval
Save a ledger selection. Retrieve its records through the ordinary records interface.
Read as Markdown ↗On this page
Find ledgers by their definition
Use ledgers.search to match an exact name or metadata that you defined, or add query.text to retrieve relevant definitions with a provisioned search runtime. It searches readable ledgers in the selected local store or hosted workspace. Each result contains the ledger definition and an observation identifying authority or retained replica data. It does not search record contents or discover ledgers you cannot read.
Filters use the same typed path/eq pattern as records.search: conditions combine with AND, keys and array indexes are explicit, and missing fields never equal null. For exact searches, follow next_cursor as cursor, including after empty pages; original scope, filter and limit are restored. Catalogue or access changes require restarting the search; ordinary record appends do not.
page = client.ledgers.search( filter={"metadata": [{"path": ["reference_id"], "eq": "example-42"}]}, limit=25,)ledger_ids = [item["ledger"]["ledger_id"] for item in page["items"]]# Continue with page["next_cursor"] before treating discovery as complete.Save a ledger selection
collections.create saves a name, ledger IDs and the selection’s access settings. collections.update replaces those settings at an expected revision. collections.get returns the selection visible to you. collections.list finds readable collections with paginated ID, name and revision summaries. collections.delete removes a saved selection at its expected revision; it leaves ledgers, records and their permissions unchanged. Collections contain no records or saved filters, and never grant access to their ledgers.
A person or agent can discover relevant ledgers, save a collection, then reuse or revise that selection. Groups belong to authorization: they contain principals, not ledgers. Groups and collections belong to the selected store and identity issuer; ledger synchronization does not copy their definitions.
Find collectionsRemove a collectionSave a collectionAuthorization & groupsOne retrieval interface, either scope
Use records.search with optional ledger_ids or collection_id. Omit both for all readable ledgers. An explicitly inaccessible or missing ledger returns permission_denied. A readable collection silently includes only authorized members without exposing hidden identities or counts. Filters belong to the request; supported filters match contract ID, contract version, producer ID and scalar values at explicit payload paths. Conditions combine with AND, without type coercion. Missing fields never match null. This is exact filtering. query.text performs relevance-ranked text retrieval with source evidence when the search runtime is provisioned. Relevance search requires the parser and inference dependencies to be configured by the operator. File queries accept temporary bytes or accessible file references, with optional text. CLI --file and SDK files=[Path(...)] read explicit local files; MCP and HTTP accept bounded file bytes or references. Attachment evidence requires files.read independently of records.read. Pass next_cursor as cursor for deeper ranked results; expires_at gives the continuation deadline. New indexed content requires a fresh search. Cursor replay is stable while its context remains valid, and source/access changes require a restart. Relevance ordering is approximate across pages; incomplete coverage is reported as limited. Pending indexing is reported in coverage. If it prevents any useful result, search returns authority_unavailable with retry guidance. Exact requests do not load a model. Search returns compact coverage and per-result observations; feed retains its existing per-ledger coverage.
Cross-ledger search and feed work in the selected local store without an account or remote, or within one service tenant. They include accepted records held by authorities and completed replicas; pending contributions are excluded. No collection is required to search explicit ledger IDs.
client.records.search(ledger_ids=[first_ledger, second_ledger])client.records.search(collection_id=selection, filter={"payload": [{"path": ["reference_id"], "eq": "example-42"}]})client.records.feed(collection_id=selection, start="now")Search with files
Use text, a supported file, or both in the same search call. Temporary inputs do not create records or persistent files. Existing file references require files.read; attachment evidence is filtered by that permission before ranking.
Supported text extraction covers UTF-8 text/code, CSV/TSV, JSON/JSONL, YAML/XML, HTML/EPUB, text-bearing PDF/DOCX, PPTX and XLSX. Results retain file IDs and available page, slide, sheet/cell, row, line or field locations. No OCR, formula execution, transcription or chart understanding is implied. Up to eight files and 8 MiB total bytes; extraction and passage limits fail explicitly.
client.records.search(query={"text": "corrosion prevention"}, files=[Path("brief.pdf")])Keep scope and coverage explicit
Python search_pages and feed_pages iterate these ordinary operations with an explicit max_pages budget. They yield full pages, including empty pages and coverage; reaching the budget is not completion. Search stops at a null next_cursor; feed stops when caught_up and never polls indefinitely. Errors propagate without silently restarting.
Exact search returns a snapshot and next_cursor. Resume with only cursor; the original scope, filters and page size are restored. Feed returns a renewable checkpoint and caught_up and requires the original scope, filters and limit. An empty filtered page may still have a continuation. A changed collection or effective access invalidates continuation; start a fresh retrieval and reconcile coverage.
Search reports compact coverage.status and bounded reasons, with an observation on each result. It never reports hidden collection member counts. Feed retains included ledger IDs, excluded count, unavailable records and per-ledger observations. Store sequence orders retained entries; it is not a global acceptance order. A replica feed being caught_up describes retained data, not remote freshness. Collections never bypass ledger grants or raw-data restrictions. Treat unavailable history as incomplete coverage, not an empty ledger.
Complete examples, permissions and limits