Skip to main content
POST
/
v1
/
schemas
const schema = await client.schemas.create({
  name: "Electronics Catalog",
  description: "Schema for consumer electronics",
  columns: [
    { key: "product_name", label: "Product Name", type: "text", required: true },
    { key: "price", label: "Price", type: "number" },
    { key: "brand", label: "Brand", type: "text" },
    { key: "category", label: "Category", type: "enum", enum_values: ["phones", "laptops", "tablets"] },
    { key: "image_url", label: "Image", type: "image" },
    { key: "specs", label: "Specifications", type: "json" },
  ],
});

console.log(schema.id);
{
  "id": "schema_abc123",
  "name": "Electronics Catalog",
  "description": "Schema for consumer electronics",
  "is_default": false,
  "columns": [
    { "key": "product_name", "label": "Product Name", "type": "text", "required": true },
    { "key": "price", "label": "Price", "type": "number" }
  ],
  "created_at": "2025-03-01T10:00:00.000Z",
  "updated_at": "2025-03-01T10:00:00.000Z"
}

Request body

name
string
required
A name for the schema.
description
string
A description of what this schema is used for.
is_default
boolean
default:"false"
Whether this should be the default schema.
columns
array
required
Array of column definitions. Must be non-empty.

Response

id
string
Unique schema identifier.
name
string
Schema name.
description
string | null
Schema description.
is_default
boolean
Whether this is the default schema.
columns
array
The column definitions.
created_at
string
ISO 8601 timestamp.
updated_at
string
ISO 8601 timestamp.
const schema = await client.schemas.create({
  name: "Electronics Catalog",
  description: "Schema for consumer electronics",
  columns: [
    { key: "product_name", label: "Product Name", type: "text", required: true },
    { key: "price", label: "Price", type: "number" },
    { key: "brand", label: "Brand", type: "text" },
    { key: "category", label: "Category", type: "enum", enum_values: ["phones", "laptops", "tablets"] },
    { key: "image_url", label: "Image", type: "image" },
    { key: "specs", label: "Specifications", type: "json" },
  ],
});

console.log(schema.id);
{
  "id": "schema_abc123",
  "name": "Electronics Catalog",
  "description": "Schema for consumer electronics",
  "is_default": false,
  "columns": [
    { "key": "product_name", "label": "Product Name", "type": "text", "required": true },
    { "key": "price", "label": "Price", "type": "number" }
  ],
  "created_at": "2025-03-01T10:00:00.000Z",
  "updated_at": "2025-03-01T10:00:00.000Z"
}

Column types

TypeDescription
textPlain text string.
numberNumeric value (integer or float).
urlA valid URL.
emailAn email address.
dateA date or datetime string.
booleantrue or false.
richtextHTML or markdown formatted text.
enumOne of a predefined set of values (see enum_values).
tagsArray of string tags.
imageA single image URL.
imagesArray of image URLs.
jsonArbitrary JSON object.