Home Docs Schema Formats Errors
Conduit

Schema API

Schema API

The Schema API allows you to inspect, create, and delete database tables through /v1/schema. Conduit automatically translates schema definitions into SQL for the configured driver.

Schema API

The following endpoints are available:

GET    /v1/schema
GET    /v1/schema/<table>
POST   /v1/schema/<table>
DELETE /v1/schema/<table>

GET /v1/schema

Returns a list of all tables in the database along with their column definitions. The response format depends on the Accept header or the ?format= query parameter.

GET /v1/schema?format=json
GET /v1/schema?format=yaml
GET /v1/schema?format=toml
GET /v1/schema?format=xml
GET /v1/schema?format=csv

This endpoint is useful for introspection, tooling, and dynamic API clients.

GET /v1/schema/<table>

Returns the schema for a single table, including column names, types, nullability, and driver-specific metadata.

GET /v1/schema/users

If the table does not exist, Conduit returns a 404 error.

POST /v1/schema/<table>

Creates a new table using the schema definition provided in the request body. Conduit accepts JSON, YAML, TOML, or XML input and automatically compiles the schema into SQL for the configured database driver.

POST /v1/schema/products
Content-Type: application/json

{
  "columns": [
    { "name": "id", "type": "integer", "nullable": false },
    { "name": "name", "type": "text", "nullable": false },
    { "name": "price", "type": "real", "nullable": false }
  ]
}

If the table already exists, Conduit returns the existing schema instead of creating a new table.

SQL generation supports:

  • Literal defaults
  • SQL expression defaults
  • Nullable and non-nullable columns
  • Unique constraints

DELETE /v1/schema/<table>

Drops the specified table from the database. This operation is only allowed when schema mutation is enabled in the policy configuration.

DELETE /v1/schema/logs

If the table does not exist, Conduit returns a 404 error.

Notes

  • Schema operations respect authorization and policy settings.
  • Schema creation and deletion require mutation permissions.
  • All formats (JSON, YAML, TOML, XML, CSV) are supported for both input and output.