Discover spaces, metadata keys, and record types, then query records and read one page in both API shapes. A simple inventory of visible spaces, metadata keys, record types, typed records, markdown, and page links.
View source
Pull records
Discover spaces, metadata keys, and record types, then query records and read one page in both API shapes. A simple inventory of visible spaces, metadata keys, record types, typed records, markdown, and page links.
Read the codeBefore you run it
Run Write back first if the space does not have deal records yet.
Use a credential that can read the target space.
Keep COCO_SPACE and COCO_TEMPLATE aligned with the records you want to query.
What it does
List spaces with stats to understand what the credential can see.
Inspect the org-wide metadata key namespace.
List record types inside the space.
Query typed records ordered by a metadata field.
Read one page as JSON, markdown, and links.
Core SDK calls
These are intentionally smaller than the source files. They show the backend shape to copy first.
Discover and query
const spaces = await coco.spaces.list({ includeStats: true });
const keys = await coco.search.metadataKeys({ limit: 10 });
const types = await coco.records.types("demo");
const records = await coco.records.query("demo", "deal-memo", {
orderBy: "conviction-score",
order: "desc",
});Read one page fully
const first = records.items[0];
if (first) {
const page = await coco.pages.get(first.path);
const markdown = await coco.pages.getMarkdown(first.path);
const links = await coco.pages.links(first.path);
}CLI companion
Use the CLI to inspect or exercise the same backend surface from a terminal while your app code uses the SDK.
coco spaces list --stats
coco records types demo
coco records list demo deal-memo --order-by conviction-score --desc
coco page get demo/deals/acme