Create a column
Add a column to an existing table.
POST /projects/:projectid/databases/:dbid/tables/:tblid/columns
Authentication
Send the project API key in the Authorization header, without a Bearer prefix. Requires databases.schema for the database in the URL.
Request
| Field | Type | Description |
|---|---|---|
colid | string, required | Column name following the identifier rules. |
colType | string, required | One of the types below. |
colTypeParam | number, optional | Vector dimensions, from 1 to 2000; default 1024. Only relevant to vector. |
colIsUnique | boolean, optional | Request a unique constraint. Defaults to false. |
colIsIndexed | boolean, optional | Request an index. Defaults to false. |
| API type | PostgreSQL type |
|---|---|
text | TEXT |
number | NUMERIC |
boolean | BOOLEAN |
json | JSON |
jsonb | JSONB |
vector | VECTOR(dimensions) |
tsvector | TSVECTOR |
Use JSON booleans for the flags, not strings. Constraints and indexes must be supported by the selected PostgreSQL type; for indexed JSON data, choose jsonb.
Example
Use the environment variables from the database overview. Replace example IDs with your own.
curl --include --request POST \
--header "Authorization: ${INTELLECTIBLE_PROJECT_API_KEY}" \
--header "Content-Type: application/json" \
--data '{
"colid": "status",
"colType": "text",
"colIsUnique": false,
"colIsIndexed": true
}' \
"${INTELLECTIBLE_PUBLIC_API_URL}/projects/${INTELLECTIBLE_PROJECT_ID}/databases/${INTELLECTIBLE_DATABASE_ID}/tables/${INTELLECTIBLE_TABLE_ID}/columns"
Response
201 Created
{
"colid": "status"
}
If the column already exists, this request does not change its type or add a unique constraint to it.
Index creation is attempted separately. A successful response confirms the column operation, but does not guarantee that a requested index was created; verify the index separately if your application depends on it.
See Errors and safe retries for shared failure handling.