Airtable
Read bases, tables, and records directly via api.airtable.com.
Setup (one-time)
- 1. Go to https://airtable.com/create/tokens
- Click + Create new token, give it a name
- Add scopes:
-
data.records:read
-
schema.bases:read
- 4. Under Access, select which bases to grant access to (or all)
- Copy the token — it starts with INLINECODE3
- Set the environment variable:
CODEBLOCK0
Commands
List all accessible bases
CODEBLOCK1
List tables in a base
CODEBLOCK2
List records in a table
CODEBLOCK3
Filter records with a formula
CODEBLOCK4
Filter to specific fields only
CODEBLOCK5
Use a specific view
CODEBLOCK6
Get a specific record
CODEBLOCK7
Search records
CODEBLOCK8
Notes
- - Free plan: unlimited bases, 1,000 records per base. API reads work on free.
- Base IDs start with
app, record IDs start with rec. - Table names are case-sensitive and must match exactly. Use quotes if the name has spaces.
- Airtable deprecated old API keys in Feb 2024. Only Personal Access Tokens (PAT) work now.
Airtable
通过 api.airtable.com 直接读取基础、表格和记录。
设置(一次性)
- 1. 访问 https://airtable.com/create/tokens
- 点击 + 创建新令牌,为其命名
- 添加权限范围:
- data.records:read
- schema.bases:read
- 4. 在 访问权限 下,选择要授予访问权限的基础(或全部)
- 复制令牌——它以 pat 开头
- 设置环境变量:
AIRTABLEPAT=pat你的令牌
命令
列出所有可访问的基础
bash
python3 /mnt/skills/user/airtable/scripts/airtable.py list-bases
列出基础中的表格
bash
python3 /mnt/skills/user/airtable/scripts/airtable.py list-tables <基础ID>
列出表格中的记录
bash
python3 /mnt/skills/user/airtable/scripts/airtable.py list-records <基础ID> 表格名称
python3 /mnt/skills/user/airtable/scripts/airtable.py list-records <基础ID> 表格名称 --limit 50
使用公式筛选记录
bash
python3 /mnt/skills/user/airtable/scripts/airtable.py list-records <基础ID> 任务 --filter {状态}=已完成
python3 /mnt/skills/user/airtable/scripts/airtable.py list-records <基础ID> 联系人 --filter NOT({邮箱}=)
仅筛选特定字段
bash
python3 /mnt/skills/user/airtable/scripts/airtable.py list-records <基础ID> 人员 --fields 姓名,邮箱,公司
使用特定视图
bash
python3 /mnt/skills/user/airtable/scripts/airtable.py list-records <基础ID> 任务 --view 活跃任务
获取特定记录
bash
python3 /mnt/skills/user/airtable/scripts/airtable.py get-record <基础ID> 表格名称 <记录ID>
搜索记录
bash
python3 /mnt/skills/user/airtable/scripts/airtable.py search-records <基础ID> 联系人 史密斯
python3 /mnt/skills/user/airtable/scripts/airtable.py search-records <基础ID> 联系人 smith@acme.com --field 邮箱
备注
- - 免费计划:无限基础,每个基础 1000 条记录。API 读取在免费计划中可用。
- 基础 ID 以 app 开头,记录 ID 以 rec 开头。
- 表格名称区分大小写,必须完全匹配。如果名称包含空格,请使用引号。
- Airtable 于 2024 年 2 月弃用了旧版 API 密钥。现在仅支持个人访问令牌(PAT)。