Airtable bindings — the lightweight database half the world runs ops on. Records CRUD with formula filtering, batch upsert/delete, record comments, plus the metadata API for base schemas and token identity.
Setup — context variable airtable.token: a personal access
token (pat...) with the scopes and bases it needs. Every API function
also takes a trailing opts Map, so one run can use several tokens:
{token: "pat..."} replaces the context token for that call.
Quick start
::at ::airtable
base-id "appXyz123"
rows ::at/list-records(base-id, "Leads", {
filterByFormula: "AND({Status} = 'New', {Score} > 50)",
maxRecords: 20
})
::at/create-records(base-id, "Leads", [
{fields: {Name: "Ada Lovelace", Status: "New", Score: 99}}
])
Values
BASE_URL
BASE_URL: Str "https://api.airtable.com/v0"
Functions
create-comment
fn (base-id: Str, table: Str, record-id: Str, text: Str): Map
fn (base-id: Str, table: Str, record-id: Str, text: Str, opts: Map): Map
POST /{base}/{table}/{record}/comments - Comment on a record.
@[userId] mentions work inside text.
Example
comment ::airtable/create-comment(::airtable::apiASE, "Leads", "recAbc123", "Called and left a voicemail.")
comment.id
create-records
fn (base-id: Str, table: Str, records: Vec): Map
fn (base-id: Str, table: Str, records: Vec, opts: Map): Map
POST /{base}/{table} - Create up to 10 records: [{fields: {...}}].
typecast is enabled so string inputs coerce to the field types.
Example
created ::airtable/create-records(::airtable::apiASE, "Leads", [
{fields: {Name: "Ada Lovelace", Status: "New", Score: 99}}
])
first(created.records).id
delete-comment
fn (base-id: Str, table: Str, record-id: Str, comment-id: Str): Map
fn (base-id: Str, table: Str, record-id: Str, comment-id: Str, opts: Map): Map
DELETE /{base}/{table}/{record}/comments/{comment} - Delete a comment (author-owned comments only).
Example
::airtable/delete-comment(::airtable::apiASE, "Leads", "recAbc123", "comAbc123")
delete-record
fn (base-id: Str, table: Str, record-id: Str): Map
fn (base-id: Str, table: Str, record-id: Str, opts: Map): Map
DELETE /{base}/{table}/{id} - Delete one record.
Example
::airtable/delete-record(::airtable::apiASE, "Leads", "recAbc123")
delete-records
fn (base-id: Str, table: Str, record-ids: Vec): Map
fn (base-id: Str, table: Str, record-ids: Vec, opts: Map): Map
DELETE /{base}/{table}?records[]= - Delete up to 10 records in one call.
Returns {records: [{id, deleted}]}.
Example
out ::airtable/delete-records(::airtable::apiASE, "Leads", ["recAbc123", "recDef456"])
map(out.records, %.deleted)
escape-formula-value
fn (value: Str): Str
Escape a value for interpolation into an Airtable formula as a
single-quoted string literal (backslashes and quotes escaped, quotes
included). Always use this when building filterByFormula from
user or agent input — unescaped interpolation lets crafted input
rewrite the formula.
Example
::airtable/escape-formula-value("O'Brien") // "'O\\'Brien'"
// Pass this as `filterByFormula` to `list-records`
`{Last Name} = ${::airtable/escape-formula-value("O'Brien")}` // "{Last Name} = 'O\\'Brien'"
get-base-schema
fn (base-id: Str): Map
fn (base-id: Str, opts: Map): Map
GET /meta/bases/{base}/tables - The base's tables, fields, and views — what an agent reads before writing records.
Example
schema ::airtable/get-base-schema(::airtable::apiASE)
map(schema.tables, %.name)
get-record
fn (base-id: Str, table: Str, record-id: Str): Map
fn (base-id: Str, table: Str, record-id: Str, opts: Map): Map
GET /{base}/{table}/{id} - One record ({id, createdTime, fields}).
Example
record ::airtable/get-record(::airtable::apiASE, "Leads", "recAbc123")
record.fields.Status
list-bases
fn (): Map
fn (opts: Map): Map
GET /meta/bases - The bases the token can access.
Example
out ::airtable/list-bases()
map(out.bases, %.name)
list-comments
fn (base-id: Str, table: Str, record-id: Str): Map
fn (base-id: Str, table: Str, record-id: Str, params: Map): Map
fn (base-id: Str, table: Str, record-id: Str, params: Map, opts: Map): Map
GET /{base}/{table}/{record}/comments - A record's comments ({comments, offset?}). params (4-arity): pageSize (max 100), offset.
Example
page ::airtable/list-comments(::airtable::apiASE, "Leads", "recAbc123", {pageSize: 50})
map(page.comments, %.text)
list-records
fn (base-id: Str, table: Str): Map
fn (base-id: Str, table: Str, params: Map): Map
fn (base-id: Str, table: Str, params: Map, opts: Map): Map
GET /{base}/{table} - List records. params: filterByFormula
(Airtable formula), maxRecords, view, sort handled by formula,
offset (paging cursor from the previous page). Returns
{records, offset?}. To pass opts without filters, use {} for
params.
Example
page ::airtable/list-records(::airtable::apiASE, "Leads", {
filterByFormula: "{Status} = 'New'",
maxRecords: 20
})
map(page.records, %.fields.Name)
// The next page, with a per-call token
::airtable/list-records(::airtable::apiASE, "Leads", {offset: page.offset}, {token: ::hot::ctx/get("tenant.airtable.token")})
airtable.token
records-query
fn (record-ids: Vec): Str
Build the repeated records[]= query string batch deletion needs
(query-string can't express repeated keys). Exposed for testing;
delete-records uses it.
Example
::airtable/records-query(["recAbc123", "recDef456"]) // "?records[]=recAbc123&records[]=recDef456"
request
fn (method: Str, path: Str, body: Any): Any
fn (method: Str, path: Str, body: Any, opts: Map): Any
fn (method: Str, path: Str, body: Any, token: Str): Any
The authenticated request behind every function: opts ({token}),
then the airtable.token context variable. With no token from either
place, it returns an Err (see ::airtable::api/resolve).
Example
::airtable/request("GET", "/meta/whoami", "")
// Per-call token
tenant ::airtable/request("GET", "/meta/bases", "", {token: ::hot::ctx/get("tenant.airtable.token")})
tenant.bases
airtable.token
update-comment
fn (base-id: Str, table: Str, record-id: Str, comment-id: Str, text: Str): Map
fn (base-id: Str, table: Str, record-id: Str, comment-id: Str, text: Str, opts: Map): Map
PATCH /{base}/{table}/{record}/comments/{comment} - Edit a comment's text (author-owned comments only).
Example
::airtable/update-comment(::airtable::apiASE, "Leads", "recAbc123", "comAbc123", "Called and booked a demo.")
update-records
fn (base-id: Str, table: Str, records: Vec): Map
fn (base-id: Str, table: Str, records: Vec, opts: Map): Map
PATCH /{base}/{table} - Update up to 10 records: [{id, fields}] (only
the given fields change).
Example
::airtable/update-records(::airtable::apiASE, "Leads", [
{id: "recAbc123", fields: {Status: "Qualified"}}
])
upsert-records
fn (base-id: Str, table: Str, merge-fields: Vec, records: Vec): Map
fn (base-id: Str, table: Str, merge-fields: Vec, records: Vec, opts: Map): Map
PATCH /{base}/{table} with performUpsert - Create-or-update up to 10
records keyed on merge-fields (field names that uniquely identify a
record). Records are [{fields: {...}}] — no ids. Returns
{records, createdRecords, updatedRecords}.
Example
::airtable/upsert-records("appXyz123", "Leads", ["Email"], [
{fields: {Email: "ada@example.com", Status: "Customer"}}
])
whoami
fn (): Map
fn (opts: Map): Map
GET /meta/whoami - The token's own user id and granted scopes. The cheapest way to smoke-test a token.
Example
me ::airtable/whoami()
me.scopes