GET https://example-project.api.cubibase.com/rest/v1/customers?plan=eq.pro&order=name.asc&limit=20
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT>{
"data": [
{
"id": "8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901",
"name": "Mina Cho",
"email": "[email protected]",
"plan": "pro",
"owner_id": "user_mina"
},
{
"id": "44ab91c3-0e55-4d72-b018-6f2c8a91bb70",
"name": "Priya Shah",
"email": "[email protected]",
"plan": "pro",
"owner_id": "user_priya"
}
]
}The request CubiBase actually accepts
The host selects the project. The path selects the table. The apikey header must be an active publishable key for that project. Authorization must be a bearer JWT whose subject CubiBase can verify.
- GET /rest/v1/customers lists rows. GET /rest/v1/customers/{id} reads one row.
- POST creates a row and returns 201. PATCH and DELETE address one primary key.
- Filters use column=op.value. Operators are eq, neq, gt, gte, lt, lte, like, ilike, and is.
- order is column.asc or column.desc, with at most three columns. limit defaults to 20 and cannot exceed 100.
- A list response is an object with a data array. A single row is an object with a data value.
Exposure is explicit
Select, insert, update, and delete are separate switches. If select is off, GET is not offered for that table. The API role receives only the grants you turn on. Turning a switch off revokes that privilege.
This is the sense in which the API is automatic. CubiBase maps the exposed table to HTTP. It does not publish every table you create, and it does not invent relationships or nested resources.
Errors worth handling
- 401 missing_api_key or invalid_api_key when the publishable key is absent or wrong.
- 401 missing_end_user_token when the bearer token is absent.
- 404 when the host is not an active project, or the table is not available for that call.
- 405 method_not_allowed when that operation is not exposed.
Questions
Is the path /v1/customers or /rest/v1/customers?
The Data API path is /rest/v1/{table}. The control API used by the Console is a different surface and is not what your application calls.
Can I select a subset of columns?
Yes. The select query parameter takes a comma-separated list of one to 64 columns.