Getting started

Quickstart

Create a project, define a table, expose the operations you want, sign up a user, and call the Data API. About ten minutes, all HTTP.

1 · Create a project

  1. Register in the Console

    Create a developer account and verify your email address. Project creation requires a verified email.

  2. Create a project

    Pick a name and a slug. The slug becomes the first label of your API host: {slug}.api.cubibase.com.

  3. Wait for provisioning

    Provisioning is queued. The project page shows the status; wait until it reports active before creating tables.

example-project Provisioning

Database example_project_db

Roles ddl · api · sql · auth

Schemas public · auth · vault · logs

Illustration of the state change. Creating a project queues the database; it exists when provisioning finishes.

2 · Define a table

In the Console, open your project and create a table. This guide uses a customers table:

customers — example schema
ColumnTypeNotes
iduuidPrimary key, default gen_random_uuid()
nametextRequired
emailtextRequired
plantextRequired
owner_idtextSet as the user column for row-level security

Setting owner_id as the user column at creation time makes every row belong to the user whose JWT subject matches it. The policy is created with the table — you cannot attach it later.

3 · Expose the operations you want

New tables are not exposed. On the table screen, switch on the operations your app needs — here, select and insert. Leave update and delete off until you need them.

customers · exposure illustration

Served at /rest/v1/customers for the operations you switched on.

Illustration. Toggles here do not change any real table.

4 · Sign up your first user

Copy the publishable key from the project’s API keys screen, then sign a user up. The response contains the accessToken your Data API calls need.

Sign up · request
POST https://example-project.api.cubibase.com/auth/v1/signup
apikey: cb_pub_EXAMPLE_ONLY
Content-Type: application/json

{
  "email": "mina@example.com",
  "password": "<USER_PASSWORD>"
}

5 · Call the Data API

Send the publishable key in the apikey header and the user’s access token as the bearer token. With the owner_id policy in place, this user only sees their own rows.

Request
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>
200 · response
{
  "data": [
    {
      "id": "8c1a0b2e-7d44-4a11-9c31-0b51a6e4d901",
      "name": "Mina Cho",
      "email": "mina@example.com",
      "plan": "pro",
      "owner_id": "user_mina"
    },
    {
      "id": "44ab91c3-0e55-4d72-b018-6f2c8a91bb70",
      "name": "Priya Shah",
      "email": "priya@example.org",
      "plan": "pro",
      "owner_id": "user_priya"
    }
  ]
}

Additional resources