Schemas API

Define and manage schemas via REST.

List schemas

GET /api/v1/projects/{project}/schemas

Get a schema

GET /api/v1/projects/{project}/schemas/{slug}
{
  "id": "...",
  "slug": "enemy",
  "name": "Enemy",
  "fields": [
    { "slug": "name",   "type": "text",   "config": { "required": true } },
    { "slug": "hp",     "type": "number", "config": { "integer": true } },
    { "slug": "attack", "type": "number", "config": { "integer": true } }
  ]
}

Create a schema

POST /api/v1/projects/{project}/schemas
Content-Type: application/json

{
  "slug": "enemy",
  "name": "Enemy",
  "fields": [
    { "slug": "name", "name": "Name", "type": "text", "config": { "required": true } }
  ]
}

Update a schema

PATCH /api/v1/projects/{project}/schemas/{slug}
Content-Type: application/json

{
  "name": "New Name",
  "fields": [ /* new fields array */ ]
}

Adding fields is safe. Removing fields or changing types is destructive — existing records' data for removed/changed fields will be lost or coerced. Migrate explicitly.

Delete a schema

DELETE /api/v1/projects/{project}/schemas/{slug}

Deletes the schema and all records of that type. Irreversible.

Get schema fields only

GET /api/v1/projects/{project}/schemas/{slug}/fields

Returns just the fields array — useful for codegen tooling.