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.schemaon :dbid.
Path parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
projectid | string | Yes | - | The project id. |
dbid | string | Yes | - | The database id. |
tblid | string | Yes | - | The table name. |
Request body
Content type: application/json
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
colid | string | Yes | - | The column name. Must be lower snake case. |
colType | string | Yes | - | One of text, number, boolean, json, jsonb, vector, tsvector. |
colTypeParam | string | number | No | null | A parameter for the type, such as the dimension count for vector. |
colIsUnique | boolean | No | false | Add a uniqueness constraint. |
colIsIndexed | boolean | No | false | Build 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.