CapyDB/ docs
ReferenceApi

Schema

Database schema introspection and type generation.

Get database schema

GET
/v1/projects/{projectID}/schema

Authorization

headerAuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

Path Parameters

projectID*string

Project id.

Response Body

Database schema.

application/json
  1. response
schema*

Canonical schema document produced by one introspection pass; the contract behind capydb generate, the MCP get_schema tool and schema diffing.

curl -X GET 'https://capydb.dev/api/capydb/v1/projects/string/schema'
{  "schema": {    "database_name": "string",    "extensions": [      {        "name": "string",        "version": "string"      }    ],    "postgres_version": "string",    "schemas": [      {        "enums": [          {            "comment": "string",            "name": "string",            "values": [              "string"            ]          }        ],        "name": "string",        "tables": [          {            "columns": [              {                "array_dims": 0,                "comment": "string",                "data_type": "string",                "default": "string",                "generated": "stored",                "identity": "always",                "is_array": true,                "is_enum": true,                "is_generated": true,                "is_nullable": true,                "name": "string",                "position": 0,                "udt_name": "string",                "udt_schema": "string"              }            ],            "comment": "string",            "foreign_keys": [              {                "columns": [                  "string"                ],                "name": "string",                "on_delete": "string",                "on_update": "string",                "referenced_columns": [                  "string"                ],                "referenced_schema": "string",                "referenced_table": "string"              }            ],            "kind": "table",            "name": "string",            "primary_key": [              "string"            ],            "unique_constraints": [              {                "columns": [                  "string"                ],                "name": "string"              }            ]          }        ]      }    ]  }}
GET
/v1/projects/{projectID}/schema/types

Authorization

headerAuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

Path Parameters

projectID*string

Project id.

Query Parameters

language?string

Output language. Defaults to typescript.

Default"typescript"
Value in"typescript""zod""drizzle""go""python"
style?string

Output shape. For language=typescript: capydb (per-table interfaces, driver-accurate types, the default) or supabase (a Database generic compatible with supabase-js and ported projects). For language=python: dataclass (standard-library frozen dataclasses, the default) or pydantic (pydantic v2 models). Ignored by the other languages.

Value in"capydb""supabase""dataclass""pydantic"
package?string

Go package clause for language=go (default db). Must be a valid Go package name. Ignored by the other languages.

Default"db"

Response Body

Generated source file.

application/json
  1. response
types*
curl -X GET 'https://capydb.dev/api/capydb/v1/projects/string/schema/types'
{  "types": {    "content": "string",    "filename": "string",    "language": "typescript",    "style": "capydb"  }}
GET
/v1/projects/{projectID}/lint

Authorization

headerAuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

Path Parameters

projectID*string

Project id.

Response Body

Lint report.

application/json
  1. response
lint*
curl -X GET 'https://capydb.dev/api/capydb/v1/projects/string/lint'
{  "lint": {    "findings": [      {        "fix": "string",        "message": "string",        "object": "string",        "rule": "missing_primary_key",        "severity": "warning"      }    ],    "skipped": [      "string"    ]  }}
GET
/v1/preview-databases/{previewID}/schema

Authorization

headerAuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

Path Parameters

previewID*string

Preview database id.

Response Body

Database schema.

application/json
  1. response
schema*

Canonical schema document produced by one introspection pass; the contract behind capydb generate, the MCP get_schema tool and schema diffing.

curl -X GET 'https://capydb.dev/api/capydb/v1/preview-databases/string/schema'
{  "schema": {    "database_name": "string",    "extensions": [      {        "name": "string",        "version": "string"      }    ],    "postgres_version": "string",    "schemas": [      {        "enums": [          {            "comment": "string",            "name": "string",            "values": [              "string"            ]          }        ],        "name": "string",        "tables": [          {            "columns": [              {                "array_dims": 0,                "comment": "string",                "data_type": "string",                "default": "string",                "generated": "stored",                "identity": "always",                "is_array": true,                "is_enum": true,                "is_generated": true,                "is_nullable": true,                "name": "string",                "position": 0,                "udt_name": "string",                "udt_schema": "string"              }            ],            "comment": "string",            "foreign_keys": [              {                "columns": [                  "string"                ],                "name": "string",                "on_delete": "string",                "on_update": "string",                "referenced_columns": [                  "string"                ],                "referenced_schema": "string",                "referenced_table": "string"              }            ],            "kind": "table",            "name": "string",            "primary_key": [              "string"            ],            "unique_constraints": [              {                "columns": [                  "string"                ],                "name": "string"              }            ]          }        ]      }    ]  }}
GET
/v1/preview-databases/{previewID}/schema/types

Authorization

headerAuthorizationBearer <token>

Org or project-scoped API key, format capy_live_...; Clerk session tokens also accepted.

Path Parameters

previewID*string

Preview database id.

Query Parameters

language?string

Output language. Defaults to typescript.

Default"typescript"
Value in"typescript""zod""drizzle""go""python"
style?string

Output shape. For language=typescript: capydb (per-table interfaces, driver-accurate types, the default) or supabase (a Database generic compatible with supabase-js and ported projects). For language=python: dataclass (standard-library frozen dataclasses, the default) or pydantic (pydantic v2 models). Ignored by the other languages.

Value in"capydb""supabase""dataclass""pydantic"
package?string

Go package clause for language=go (default db). Must be a valid Go package name. Ignored by the other languages.

Default"db"

Response Body

Generated source file.

application/json
  1. response
types*
curl -X GET 'https://capydb.dev/api/capydb/v1/preview-databases/string/schema/types'
{  "types": {    "content": "string",    "filename": "string",    "language": "typescript",    "style": "capydb"  }}