Skip to main content
GET/schema/collections

List Collections

Returns a paginated list of all user-defined collections in the project, sourced from the project's k9o_<proj_id> schema.

Each entry includes the collection name, approximate row count (from pg_class.reltuples — rowCountIsExact: false), column count, index count, and the slug and timestamp of the last migration that touched the collection.

Requires PROJECT_MEMBER role minimum; uses cursor-based pagination with a default page size of 50.

Parameters
limitquery

The most collections to return, 1 to 200.

Default 50.

A value outside the range is refused.

cursorquery

The meta.cursor.next of the previous page.

Omit it for the first page.

projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Responses
HTTPK9O CodeDescription
200Success
401K9O_SESSION_EXPIREDYour session has expired; re-authenticate and retry.
403K9O_ACCESS_DENIEDYour account does not have the required role (PROJECT_MEMBER or higher) to list schema collections for this project.
Response body (200)
data *object[]

One page of the project's collections, by name ascending.

Pass meta.cursor.next as cursor for the next page.

name *string

The collection (table) name.

rowCount *integer

The live row count (soft-deleted rows excluded), counted without row-level security, so it can exceed what your own reads return.

rowCountIsExact *true

Always true: rowCount is an exact count, not an estimate.

columnCount *integer

How many columns the collection has, platform-reserved columns included.

indexCount *integer

How many indexes the collection has, the primary key included.

lastMigrationSlug *any

The slug of the most recent migration that touched the collection; null when none did (for example a collection created outside migrations).

One of: string
or: null
lastMigrationAppliedAt *any

When that migration was applied; null when no migration touched the collection.

One of: string <date-time>
or: null
meta *any

Request metadata: cost, timing and correlation ids.

The list adds cursor (next, totalCount null, countMethod none); both routes add a K9O_ORG_CLAIM_UNBOUND entry to warnings when the token has no org claim.

TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.schema.collections.list()

Showing example in TypeScript

Response example (200)
{
  "data": [
    {
      "name": "string",
      "rowCount": 0,
      "rowCountIsExact": true,
      "columnCount": 0,
      "indexCount": 0,
      "lastMigrationSlug": "string",
      "lastMigrationAppliedAt": "string"
    }
  ]
}

More in Storage & Schema