# API routes

Source: https://cubibase.com/docs/reference/routes

Also available: [Markdown version](https://cubibase.com/docs/reference/routes.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt)

Every public route on the project host, plus the control paths the Console uses. Your application calls the project host — not the control API.

## Data API

Base: `https://{slug}.api.cubibase.com`. Every route needs the `apikey` header and an end-user bearer token.

**Data API · /rest/v1**

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/rest/v1/{table}` | List rows with filters, select, order, limit, offset |
| `GET` | `/rest/v1/{table}/{id}` | Read one row by primary key |
| `POST` | `/rest/v1/{table}` | Insert one row · 201 |
| `PATCH` | `/rest/v1/{table}/{id}` | Update one row |
| `DELETE` | `/rest/v1/{table}/{id}` | Delete one row |
| `POST` | `/rest/v1/rpc/{function}` | Call a function granted to the api role · named JSON arguments |

## Auth API

Same host, under `/auth/v1`, with the same `apikey` header. Signup, sign-in, refresh, logout, and the Google flow do not need a bearer token; the user and factor routes do. A bearer token on authorize or the id_token grant links the Google identity to that user.

**Auth API · /auth/v1**

| Method | Path | Purpose |
| --- | --- | --- |
| `POST` | `/auth/v1/signup` | Create a user · 201 |
| `POST` | `/auth/v1/signup/anonymous` | Create an anonymous session · 201 |
| `POST` | `/auth/v1/token?grant_type=password` | Sign in (or an MFA challenge) |
| `POST` | `/auth/v1/token?grant_type=refresh_token` | Refresh the session |
| `POST` | `/auth/v1/token?grant_type=mfa` | Complete an MFA challenge |
| `POST` | `/auth/v1/token?grant_type=id_token` | Verify a Google ID token |
| `GET` | `/auth/v1/authorize?provider=google` | Start the Google redirect flow |
| `GET` | `/auth/v1/callback` | Google redirects back here · 302 to your app |
| `POST` | `/auth/v1/logout` | Revoke the session · 204 |
| `GET` | `/auth/v1/user` | Read the signed-in user |
| `PATCH` | `/auth/v1/user` | Update the user; convert anonymous users |
| `POST` | `/auth/v1/factors` | Enroll a TOTP factor · 201 |
| `POST` | `/auth/v1/factors/verify` | Confirm the first TOTP code |
| `DELETE` | `/auth/v1/factors/{factorId}` | Remove a factor · 204 |

## Storage API

Same host, under `/storage/v1`, with the same `apikey` header. Writes and private reads need a bearer token (end-user JWT or secret API key); public-bucket reads need only the key. Every download is metered against the account’s monthly bandwidth.

**Storage API · /storage/v1**

| Method | Path | Purpose |
| --- | --- | --- |
| `POST` | `/storage/v1/buckets` | Create a bucket · 201 |
| `GET` | `/storage/v1/buckets` | List buckets |
| `GET` | `/storage/v1/buckets/{bucket}` | Bucket configuration |
| `PATCH` | `/storage/v1/buckets/{bucket}` | Update visibility, size cap, MIME allowlist |
| `DELETE` | `/storage/v1/buckets/{bucket}` | Delete the bucket and its objects |
| `POST` | `/storage/v1/objects/upload` | Start an upload · reserves quota, returns the S3 policy · 201 |
| `POST` | `/storage/v1/uploads/{id}/complete` | Verify and finalize the uploaded object |
| `GET` | `/storage/v1/uploads/{id}` | Upload session status |
| `GET` | `/storage/v1/objects` | List objects · bucket, prefix, delimiter, search, limit, offset |
| `GET` | `/storage/v1/objects/{id}` | Object metadata |
| `GET` | `/storage/v1/objects/{id}/content` | Download · metered, Range supported |
| `HEAD` | `/storage/v1/objects/{id}/content` | Download headers without bytes |
| `POST` | `/storage/v1/objects/{id}/sign` | Short-lived signed download link |
| `GET` | `/storage/v1/public/{bucket}/{path}` | Anonymous public-bucket read · metered |
| `DELETE` | `/storage/v1/objects/{id}` | Delete an object |
| `GET` | `/storage/v1/usage` | Project storage and bandwidth consumption |

## Functions API

Same host, under `/functions/{name}`. Authentication depends on the function’s configured mode: JWT bearer token (default), secret API key, public, or internal-only (404 externally). Payload signature headers are independent — see the Signed payloads docs page.

**Functions API · /functions**

| Method | Path | Purpose |
| --- | --- | --- |
| `ALL` | `/functions/{name}` | Invoke a deployed HTTP function · GET, POST, PUT, PATCH, DELETE, OPTIONS |
| `ALL` | `/functions/{name}/{path...}` | Extra path segments reach the handler unchanged |

## Control API paths (Console)

These are the paths the Console uses for accounts, projects, schema, rows, SQL, keys, the auth user directory, the Database menu managers (policies, SQL functions, triggers, indexes, types, views), storage, and CubiBase Functions management. They are listed for completeness; this guide does not publish a separate public base URL for them, and your application should not call them.

**Control API paths**

| Method | Path |
| --- | --- |
| `POST` | `/v1/auth/register` |
| `POST` | `/v1/auth/verify-email` |
| `POST` | `/v1/auth/login` |
| `POST` | `/v1/projects` |
| `GET` | `/v1/projects/:id/provisioning` |
| `POST` | `/v1/projects/:id/tables` |
| `POST` | `/v1/projects/:id/tables/:table/exposure` |
| `GET` | `/v1/projects/:id/tables/:table/rows` |
| `POST` | `/v1/projects/:id/sql` |
| `POST` | `/v1/projects/:id/api-keys` |
| `PATCH` | `/v1/projects/:id/auth` |
| `GET` | `/v1/projects/:id/auth/settings` |
| `PATCH` | `/v1/projects/:id/auth/settings` |
| `GET` | `/v1/projects/:id/auth/users` |
| `GET` | `/v1/projects/:id/auth/sessions` |
| `DELETE` | `/v1/projects/:id/auth/sessions/:sessionId` |
| `GET` | `/v1/projects/:id/lifecycle` |
| `POST` | `/v1/projects/:id/resume` |
| `GET` | `/v1/projects/:id/backup/download` |
| `GET` | `/v1/projects/:id/policies` |
| `POST` | `/v1/projects/:id/policies` |
| `POST` | `/v1/projects/:id/tables/:table/rls` |
| `POST` | `/v1/projects/:id/tables/:table/policies/:policy` |
| `DELETE` | `/v1/projects/:id/tables/:table/policies/:policy` |
| `GET` | `/v1/projects/:id/sql-functions` |
| `POST` | `/v1/projects/:id/sql-functions` |
| `POST` | `/v1/projects/:id/sql-functions/:name/api-access` |
| `DELETE` | `/v1/projects/:id/sql-functions/:name` |
| `GET` | `/v1/projects/:id/db-triggers` |
| `POST` | `/v1/projects/:id/db-triggers` |
| `POST` | `/v1/projects/:id/tables/:table/triggers/:trigger/enabled` |
| `DELETE` | `/v1/projects/:id/tables/:table/triggers/:trigger` |
| `GET` | `/v1/projects/:id/indexes` |
| `POST` | `/v1/projects/:id/indexes` |
| `DELETE` | `/v1/projects/:id/indexes/:name` |
| `GET` | `/v1/projects/:id/types` |
| `POST` | `/v1/projects/:id/types/enum` |
| `POST` | `/v1/projects/:id/types/composite` |
| `POST` | `/v1/projects/:id/types/:name/labels` |
| `POST` | `/v1/projects/:id/types/:name/labels/rename` |
| `DELETE` | `/v1/projects/:id/types/:name` |
| `GET` | `/v1/projects/:id/views` |
| `POST` | `/v1/projects/:id/views` |
| `POST` | `/v1/projects/:id/views/:name/api-access` |
| `POST` | `/v1/projects/:id/views/:name/refresh` |
| `DELETE` | `/v1/projects/:id/views/:name` |
| `GET` | `/v1/storage/usage` |
| `GET` | `/v1/projects/:id/storage/usage` |
| `GET` | `/v1/projects/:id/storage/buckets` |
| `POST` | `/v1/projects/:id/storage/buckets` |
| `PATCH` | `/v1/projects/:id/storage/buckets/:bucket` |
| `DELETE` | `/v1/projects/:id/storage/buckets/:bucket` |
| `GET` | `/v1/projects/:id/storage/objects` |
| `POST` | `/v1/projects/:id/storage/uploads` |
| `POST` | `/v1/projects/:id/storage/uploads/:uploadId/complete` |
| `GET` | `/v1/projects/:id/storage/objects/:objectId/content` |
| `POST` | `/v1/projects/:id/storage/objects/:objectId/sign` |
| `DELETE` | `/v1/projects/:id/storage/objects/:objectId` |
| `GET` | `/v1/function-templates` |
| `GET` | `/v1/projects/:id/functions` |
| `POST` | `/v1/projects/:id/functions` |
| `GET` | `/v1/projects/:id/functions/:name` |
| `PATCH` | `/v1/projects/:id/functions/:name` |
| `DELETE` | `/v1/projects/:id/functions/:name` |
| `POST` | `/v1/projects/:id/functions/:name/deployments` |
| `GET` | `/v1/projects/:id/functions/:name/deployments` |
| `POST` | `/v1/projects/:id/functions/:name/deployments/:deploymentId/activate` |
| `POST` | `/v1/projects/:id/functions/:name/secrets` |
| `DELETE` | `/v1/projects/:id/functions/:name/secrets/:secretName` |
| `POST` | `/v1/projects/:id/functions/:name/signature/rotate` |
| `POST` | `/v1/projects/:id/functions/:name/triggers` |
| `PATCH` | `/v1/projects/:id/functions/:name/triggers/:triggerId` |
| `DELETE` | `/v1/projects/:id/functions/:name/triggers/:triggerId` |
| `POST` | `/v1/projects/:id/functions/:name/test` |
| `GET` | `/v1/projects/:id/functions/executions` |
| `GET` | `/v1/projects/:id/functions/executions/:executionId` |
| `GET` | `/v1/projects/:id/functions/queue` |
| `GET` | `/v1/projects/:id/functions/usage` |

> **note**: The server resolves the project from the Host header and never trusts X-Forwarded-Host. Additional control routes exist for login refresh, password reset, and row updates; they will be documented with the full reference.

## Additional resources

- [Data API overview](https://cubibase.com/docs/data-api) Headers, envelopes, and examples.
- [Authentication overview](https://cubibase.com/docs/auth) What each auth route returns.
- [Error codes](https://cubibase.com/docs/reference/errors) What these routes return when something fails.
