Also available: Markdown version · llms.txt · full site content
Data API
Writing rows
POST inserts one row, PATCH updates one row by primary key, DELETE removes it. Each returns the affected row with every column.
Insert a row
POST /rest/v1/{table} with a JSON object of column values. Columns with defaults can be omitted. The response is 201 with the full inserted row.
POST https://example-project.api.cubibase.com/rest/v1/customers
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>
Content-Type: application/json
{
"name": "Mina Cho",
"email": "mina@example.com",
"plan": "pro",
"owner_id": "<USER_ID>"
}Update a row
PATCH /rest/v1/{table}/{id} with the fields to change. Only the listed columns are touched; the response is the full updated row.
PATCH https://example-project.api.cubibase.com/rest/v1/customers/8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>
Content-Type: application/json
{
"plan": "team"
}Delete a row
DELETE /rest/v1/{table}/{id} removes the row and returns it in data. A row that does not exist — or is hidden by the user’s policy — returns 404 not_found.
DELETE https://example-project.api.cubibase.com/rest/v1/customers/8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>Constraint errors
PostgreSQL constraints surface as stable error codes, so your app can react without parsing messages:
| Status | Code | Cause |
|---|---|---|
409 | conflict | Unique constraint violated (e.g. duplicate email) |
400 | not_null_violation | A required column was omitted |
409 | foreign_key_violation | A referenced row does not exist |
400 | check_violation | A value failed a check constraint |
400 | invalid_input | A value does not fit the column type |
403 | forbidden | The row policy rejected the write |