# Exposing tables

Source: https://cubibase.com/docs/database/exposure

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

A table is private until you expose it. Select, insert, update, and delete are separate switches, and each one maps to a real PostgreSQL grant.

## One switch per operation

**customers · exposure illustration.** Operation switches: select (GET) on, insert (POST) on, update (PATCH) off, delete (DELETE) off.

Served at /rest/v1/customers for the operations you switched on. With everything off: The Data API treats this table as not found. Nothing is exposed.

Illustration. Toggles here do not change any real table.

| Switch | HTTP | PostgreSQL grant to the API role |
| --- | --- | --- |
| `select` | `GET /rest/v1/{table}` | `GRANT SELECT` |
| `insert` | `POST /rest/v1/{table}` | `GRANT INSERT` |
| `update` | `PATCH /rest/v1/{table}/{id}` | `GRANT UPDATE` |
| `delete` | `DELETE /rest/v1/{table}/{id}` | `GRANT DELETE` |

Turning a switch off revokes the grant immediately. A request for an operation that is not exposed returns `405 method_not_allowed`.

## Choosing what to expose

- Start with `select` only, and add write operations when a screen needs them.
- A shared catalog might expose `select` to everyone; a per-user table pairs writes with a user column.
- Exposure is not authorization by itself: every request still needs a publishable key and an end-user JWT.
- The Console row browser is unaffected — it uses the SQL role, not the API role.

> **warning**: Exposing a table without a user column means every signed-in user can use the exposed operations on every row. Add the policy unless the data is meant to be shared.

## Additional resources

- [Row-level security](https://cubibase.com/docs/database/row-level-security) Limit rows per user, not just operations per table.
- [Data API overview](https://cubibase.com/docs/data-api) The request shape behind every switch.
