Skip to main content

Create a column

POST /projects/:projectid/databases/:dbid/tables/:tblid/columns

Add a column to a table.

Column types are the platform's abstract set, mapped onto Postgres for you: text, number, boolean, json, jsonb, vector, tsvector. Raw Postgres types are rejected.

Authentication

  • Project API key: The credential for everything external. Created in Project Settings, bound to one project, and limited to the scopes it was granted. Format: proj.<keyId>.<secret>.
  • Required permission: databases.schema on :dbid.

Path parameters

NameTypeRequiredDefaultDescription
projectidstringYes-The project id.
dbidstringYes-The database id.
tblidstringYes-The table name.

Request body

Content type: application/json

NameTypeRequiredDefaultDescription
colidstringYes-The column name. Must be lower snake case.
colTypestringYes-One of text, number, boolean, json, jsonb, vector, tsvector.
colTypeParamstring | numberNonullA parameter for the type, such as the dimension count for vector.
colIsUniquebooleanNofalseAdd a uniqueness constraint.
colIsIndexedbooleanNofalseBuild an index on the column.

Example

{
"colid": "total",
"colType": "number",
"colIsIndexed": true
}

Example request

curl -X POST \
-H "Authorization: proj.KEY_ID.SECRET" \
-H "Content-Type: application/json" \
-d '{"colid":"total","colType":"number","colIsIndexed":true}' \
{{BASE_URL}}/projects/{{PROJECT_ID}}/databases/DATABASE_ID/tables/orders/columns

Responses

201

Created.

{
"colid": "total"
}

400

The name is not a valid identifier, or the type is not one of the supported set.