gtable
gtable.appOpen the Studio
REST APIFiltering and SQL

Filtering, views and SQL

Narrow a list with a saved view, a search, a filter tree or a where clause, and read or change many rows with gtable's SQL dialect. All of it through your permissions.

Every way of narrowing a list is AND-ed with your permissions: it can only narrow what you would see anyway.

Saved views

Ask for a saved view instead of rebuilding its filters. It is one parameter, it stays correct when someone edits the view, and it is usually a much smaller answer.

HTTP
GET /v1/tables/tbl_8fj3kq2wmv5d/records?viewId=viw_e4ks9mz2bh7w

A view belongs to whoever made it; you are handed your own views and nobody else’s.

Search, filters, sorts and where

ParameterTakes
searcha substring, matched over the text fields you can read
filtera filter tree as JSON, the same shape a saved view stores
sortsa JSON array of { "fieldId", "direction" } levels
wherea SQL-style condition, in the dialect below
HTTP
GET /v1/tables/tbl_8fj3kq2wmv5d/records?filter={"id":"root","kind":"group","mode":"and","children":[{"id":"c1","kind":"condition","fieldId":"fld_7qk2mv9xp4ht","op":"gt","value":50000}]}
GET /v1/tables/tbl_8fj3kq2wmv5d/records?where=Stage = 'won' AND Amount > 50000

URL-encode the values in real requests. A field in a filter, a sort or a grouping may be named by id or by exact name. One you cannot read is refused with a 422 that lists the fields you can, and never names the hidden one.

A field you can read on only some of your rows cannot be filtered or sorted on (403), because counting matches would reveal rows outside your scope. GET /v1/app lists those fields per table under constrained.

To turn a sentence into a filter tree, filters.suggest takes the sentence and returns a tree you can inspect before you use it.

SQL

POST /v1/sql/query reads; POST /v1/sql/execute changes many rows. Nothing you send is run as written: the statement is parsed, every column is checked against what you may read, every value becomes a bound parameter, and your permissions are added to the WHERE.

SQL
SELECT stage, COUNT(*) AS n, SUM(amount) AS total FROM Deals GROUP BY stage ORDER BY n DESC
SELECT name, amount FROM Deals WHERE "Expected close" > CURRENT_DATE LIMIT 20
UPDATE Deals SET probability = 100 WHERE stage = 'won'
DELETE FROM Deals WHERE stage = 'lost' AND amount < 1000

What the dialect covers:

  • one statement over one table, named by name, plural or id; fields by name or id, with double quotes around a name that has spaces;
  • AND OR NOT, comparisons, [NOT] LIKE, [NOT] IN (…), IS [NOT] NULL, [NOT] BETWEEN, both forms of CASE;
  • LENGTH LOWER UPPER TRIM ABS ROUND COALESCE SUBSTR DATE STRFTIME IFNULL INSTR REPLACE, and COUNT SUM AVG MIN MAX with GROUP BY;
  • on a link field, HAS ANY ('rec_…', …), HAS ALL (…) and IS EMPTY.

No JOIN, no subquery, no INSERT (use records.create). A SELECT returns at most 1,000 rows. A column you cannot read is “Unknown column”, the same as one that does not exist. A field you can read on only some rows reads as NULL on the others, inside sums and expressions too.

An UPDATE or DELETE touches up to 500 rows, each through the ordinary permission checks, and is one change in the history, undone in one step. Without a WHERE it is refused unless you send confirm: true. dryRun: true returns the count and the first ids and changes nothing. sql.query refuses a write and sql.execute refuses a SELECT, so a key holding only records:read gets exactly what its scope says.

Builders have the same two operations on any app, under /v1/apps/{appId}/sql/… on the Studio.

Use these docs with your AI tools

An AI agent can read this documentation directly. You do not need an account or an API key. Everything here is public and read-only.

Query these docs via MCP

Recommended

Add this server to Claude, Claude Code, Cursor, Mistral, or any tool that supports MCP. Your agent can then search gtable documentation and read it in full, instead of answering from memory.

https://gtable.app/docs/mcp
  • searchFind the passages that answer a question.
  • fetchRead one page in full, as Markdown.
  • list_pagesSee every page in this documentation.

Query these docs over HTTP

The same tools also work as plain web requests. Use this for scripts, or for any tool that does not support MCP. There is one endpoint per tool. Arguments go in the query string, and the answer comes back as JSON.

https://gtable.app/docs/api/docs/search?query=custom+domain

Read the OpenAPI description. It is built from the same definitions as the tools, so it always matches what the endpoints do.

Read these docs as Markdown

Add .md to any page URL to get its Markdown source. You can also send the headerAccept: text/markdown to the page URL itself.

To read the whole documentation in one file, open llms-full.txt. For a short index of every page, open llms.txt.