Runtype
Changelog
SDKAugust 4, 20261 min read

Typed records in the SDK, generated from your collection schemas

client.records.from("slug") returns records typed by that collection schema, generated with runtype records typegen from a new /v1/collections/types.d.ts endpoint.

sdkrecordscollectionscli

Record Collections gave your records a schema. Now that schema reaches your editor.

const orders = await client.records.from('orders').list()
orders.data[0].metadata.total // typed, not Record<string, unknown>
  • client.records.from(slug) pins the record type filter to the collection and types metadata from its schema, across list, get, create, and update.
  • runtype records typegen -o runtype-records.d.ts writes the declarations into your project, sourced from a new authenticated GET /v1/collections/types.d.ts endpoint that emits one interface per schematized collection. Without -o the command prints to stdout, so you can pipe it wherever you like.
  • Output is deterministic, so you can commit the file and re-run the command in CI to catch schema drift:
runtype records typegen -o runtype-records.d.ts && git diff --exit-code runtype-records.d.ts

Collections without a schema keep the untyped shape, so nothing breaks.