Skip to main content

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​

FieldTypeDescription
colidstring, requiredColumn name following the identifier rules.
colTypestring, requiredOne of the types below.
colTypeParamnumber, optionalVector dimensions, from 1 to 2000; default 1024. Only relevant to vector.
colIsUniqueboolean, optionalRequest a unique constraint. Defaults to false.
colIsIndexedboolean, optionalRequest an index. Defaults to false.
API typePostgreSQL type
textTEXT
numberNUMERIC
booleanBOOLEAN
jsonJSON
jsonbJSONB
vectorVECTOR(dimensions)
tsvectorTSVECTOR

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.