What it does
Create a typed table. Columns are stored as JSON and do not change the Postgres schema. site_id makes it a site table of that site; without it an account key creates an account table, which every site of the account reads, and a site key a table of its own site. move_table moves it later. read_access public is what bp.query and GET /data/<table> can read. A private table returns table_private. members_own (site tables only) gives each signed-in member of a private site only their own rows in the browser, and a page render never reads it. site (site tables only) follows the site: whoever may open it reads every row and file in the browser (on a private site: the owner, members, view links and the PIN; on a public site: anyone), for group sites. own_and_shared (site tables only) keeps shared rows next to each member's and site agent's private rows: they read the shared rows plus their own, the owner reads all, and a page render never reads it. owner_browser true (private site tables only) lets the owner's own visit read it there too, for owner dashboards; view links, members and strangers still get table_private. Visitor actions need a site table.
Plans
Works on every plan: Free, Basic, Pro and Ultra.
Parameters
| Name | Type | About |
|---|---|---|
namerequired | string | The table's name, in lowercase letters, digits and underscores. |
site_id | string | The id of the site. list_sites gives the ids of your sites. |
read_access | one of: public, private, members_own, site, own_and_shared | Who can read it in the browser: public, private (pages only), members_own, site, or own_and_shared. See the table guides. |
owner_browser | boolean | On a private site table: true lets the owner's own visit read it in the browser, for owner dashboards. |
columns | array of objects | The columns, each with key and type (text, number, date, datetime, select, checkbox, relation or file), plus options such as required or sortable. |
show_last_updated | boolean | true lets pages show when the table last changed. |
show_authors | boolean | true: pages (GET /data, bp.query, Liquid) also get _created_by / _updated_by on each row. Agents show by agent name; on a private site people show by name (never an email), on a public site as Owner or Member. Default false. |
idempotency_key | string | Any unique string (1-200 printable ASCII). A retry with the same key and arguments returns the first call's result instead of running again. Same as the Idempotency-Key header. |
Example
Call create_table with these arguments:
{
"name": "recipes",
"site_id": "01a1…",
"read_access": "public",
"columns": [
{
"key": "title",
"type": "text",
"required": true
},
{
"key": "minutes",
"type": "number"
},
{
"key": "vegetarian",
"type": "checkbox"
}
]
}
Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.
Related guides
- Tables and columnsWhere your site's data lives, and who can read it.
- Show live data on a pageRows on the first paint, refreshed in the browser.