records
The records router: 17 methods of the records capability, with tier, scope, input and output.
Capability records · scope system · mode singleton · source packages/types/src/capabilities/records.cap.ts:157.
Every method is called at /trpc/records.<method> — queries with GET, mutations with POST. See How to call and Authorization.
| Method | Kind | Tier | Token scope | Viewer |
|---|---|---|---|---|
declareKinds | mutation | admin | admin only | no |
get | query | admin | admin only | no |
getMany | query | admin | admin only | no |
secretRefs | query | admin | admin only | no |
put | mutation | admin | admin only | no |
putMany | mutation | admin | admin only | no |
patch | mutation | admin | admin only | no |
delete | mutation | admin | admin only | no |
deleteMany | mutation | admin | admin only | no |
query | query | admin | admin only | no |
count | query | admin | admin only | no |
histogram | query | admin | admin only | no |
aggregate | query | admin | admin only | no |
deleteWhere | mutation | admin | admin only | no |
transact | mutation | admin | admin only | no |
deleteDevice | mutation | admin | admin only | no |
allocateId | mutation | admin | admin only | no |
records.declareKinds
- Kind: mutation —
POST /trpc/records.declareKinds - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.declareKindson your hub
Input
{ kinds: Record<string, { database?: "settings" | "events" = "settings"; class: "config" | "ledger" | "audit" | "mirror" | "ephemeral"; writeTrigger: string; device?: "required" | "optional" | "none" = "none"; at?: "required" | "none" = "none"; indexes?: ({ name: string; fields: string[]; unique?: boolean })[] = []; retention: { ttlMs: number; from: "at" | "write" } | { maxRows?: number; maxRowsPerDevice?: number } | { owner: string; reason: string } | { none: string }; deviceRemoval?: "delete" | "none" = "none"; maxDataBytes?: number = 65536; secretPaths?: string[] = []; secretArrayKeys?: Record<string, string> = {}; transactFamily?: string; entry?: { title: string; nameField: string; fields: Record<string, unknown> } }> }Output
{ kinds: Record<string, DeclareKindResultSchema> }Shapes: DeclareKindResultSchema
records.get
- Kind: query —
GET /trpc/records.get - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.geton your hub
Input
{ kind: string; id: string }Output
RecordViewSchema | nullShapes: RecordViewSchema
records.getMany
- Kind: query —
GET /trpc/records.getMany - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.getManyon your hub
Input
{ kind: string; ids: string[] }Output
RecordViewSchema[]Shapes: RecordViewSchema
records.secretRefs
- Kind: query —
GET /trpc/records.secretRefs - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.secretRefson your hub
Input
{ kind: string; ids: string[] }Output
RecordSecretRefsSchemaShapes: RecordSecretRefsSchema
records.put
- Kind: mutation —
POST /trpc/records.put - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.puton your hub
Input
{ kind: string; record: RecordInputSchema; ifRev?: number }Output
{ rev: number; releasedRefs: string[] }Shapes: RecordInputSchema
records.putMany
- Kind: mutation —
POST /trpc/records.putMany - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.putManyon your hub
Input
{ kind: string; records: RecordInputSchema[] }Output
{ count: number; releasedRefs: string[] }Shapes: RecordInputSchema
records.patch
- Kind: mutation —
POST /trpc/records.patch - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.patchon your hub
Input
{ kind: string; id: string; data: RecordBodySchema; at?: number | null; expiresAt?: number | null; ifRev?: number }Output
{ rev: number; releasedRefs: string[] }Shapes: RecordBodySchema
records.delete
- Kind: mutation —
POST /trpc/records.delete - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.deleteon your hub
Input
{ kind: string; id: string }Output
{ deleted: boolean; secretRefs: string[] }records.deleteMany
- Kind: mutation —
POST /trpc/records.deleteMany - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.deleteManyon your hub
Input
{ kind: string; ids: string[] }Output
{ deleted: number; secretRefs: string[] }records.query
- Kind: query —
GET /trpc/records.query - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.queryon your hub
Input
RecordQueryInputSchemaOutput
RecordQueryResultSchemaShapes: RecordQueryInputSchema · RecordQueryResultSchema
records.count
- Kind: query —
GET /trpc/records.count - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.counton your hub
Input
{ kind: string; deviceId?: number; atFrom?: number; atTo?: number; where?: RecordWhereSchema }Output
{ count: number }Shapes: RecordWhereSchema
records.histogram
- Kind: query —
GET /trpc/records.histogram - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.histogramon your hub
Input
{ kind: string; deviceId?: number; from: number; to: number; bucketMs: number }Output
{ buckets: ({ bucketStart: number; count: number })[] }records.aggregate
- Kind: query —
GET /trpc/records.aggregate - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.aggregateon your hub
Input
{ kind: string; op: "sum" | "min" | "max" | "count"; field?: string; groupBy?: string; where?: RecordWhereSchema }Output
{ rows: ({ group: string | number | null; value: number | null })[] }Shapes: RecordWhereSchema
records.deleteWhere
- Kind: mutation —
POST /trpc/records.deleteWhere - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.deleteWhereon your hub
Input
{ kind: string; deviceId?: number; atBefore?: number; where?: RecordWhereSchema }Output
{ deleted: number; secretRefs: string[] }Shapes: RecordWhereSchema
records.transact
- Kind: mutation —
POST /trpc/records.transact - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.transacton your hub
Input
{ ops: RecordTransactOpSchema[] }Output
{ results: ({ rev: number | null; deleted: boolean })[]; releasedRefs: string[]; secretRefs: string[] }Shapes: RecordTransactOpSchema
records.deleteDevice
- Kind: mutation —
POST /trpc/records.deleteDevice - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.deleteDeviceon your hub
Input
{ deviceId: number; kinds?: string[] }Output
{ deleted: Record<string, number>; secretRefs: string[] }records.allocateId
- Kind: mutation —
POST /trpc/records.allocateId - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=records.allocateIdon your hub
Input
{ kind: string }Output
{ id: number }