Interact with the Coda REST API v1 to manage docs, tables, rows, pages, and automations.
Use this skill when the user wants to:
CODA_API_TOKEN with your Coda API tokenrequests library installedThe skill includes a Python CLI tool at scripts/coda_cli.py:
# Setup
export CODA_API_TOKEN="your_token_here"
# List docs
python scripts/coda_cli.py docs list --query "Project"
# Get doc info
python scripts/coda_cli.py docs get <doc-id>
# Create doc
python scripts/coda_cli.py docs create --title "My New Doc"
# List tables in doc
python scripts/coda_cli.py tables list <doc-id>
# List rows in table
python scripts/coda_cli.py rows list <doc-id> <table-id>
# Insert row
python scripts/coda_cli.py rows insert <doc-id> <table-id> --data '{"Name": "Task 1", "Status": "Done"}'
# Update row
python scripts/coda_cli.py rows update <doc-id> <table-id> <row-id> --data '{"Status": "In Progress"}'
# Delete row (requires confirmation)
python scripts/coda_cli.py rows delete <doc-id> <table-id> <row-id>
# List pages
python scripts/coda_cli.py pages list <doc-id>
# Trigger automation (push button)
python scripts/coda_cli.py automations trigger <doc-id> <button-id>
# Force delete without confirmation (use with caution)
python scripts/coda_cli.py docs delete <doc-id> --force
Coda doc IDs can be extracted from browser URLs:
https://coda.io/d/_dAbCDeFGH/Project-TrackerAbCDeFGH (remove _d prefix)The CLI tool accepts both full URLs and raw IDs.
The API has strict rate limits:
The CLI tool automatically implements exponential backoff for 429 responses.
Write operations return HTTP 202 with a requestId. The CLI tool optionally polls for completion using --wait flag.
Delete Operations (rows, docs, pages, folders):
--force flag only in automation/scriptsPublishing (docs publish):
--confirm-publish flag--forcePermissions (acl commands):
--confirm-permissions flag for any changesAutomation Triggers:
List commands support:
--limit: Maximum results (default 25, max varies by endpoint)--page-token: For fetching subsequent pages--all flag# Insert multiple rows from JSON file
python scripts/coda_cli.py rows insert-batch <doc-id> <table-id> --file rows.json
# Upsert rows (update if exists, insert if not) using key columns
python scripts/coda_cli.py rows upsert <doc-id> <table-id> --file rows.json --keys "Email"
# Export from source
python scripts/coda_cli.py rows list <source-doc> <table-id> --format json > export.json
# Import to destination
python scripts/coda_cli.py rows insert-batch <dest-doc> <table-id> --file export.json
# Get full doc structure
python scripts/coda_cli.py docs structure <doc-id>
# List all formulas
python scripts/coda_cli.py formulas list <doc-id>
# List all controls
python scripts/coda_cli.py controls list <doc-id>
Common HTTP status codes:
400: Bad request (invalid parameters)401: Invalid/expired API token403: Insufficient permissions (need Doc Maker role)404: Resource not found429: Rate limited (implement backoff)202: Accepted but not yet processed (async operation)CODA_API_TOKEN to version controlpython scripts/coda_cli.py docs list --is-owner --query "Project"
python scripts/coda_cli.py docs create --title "Q4 Planning" --source-doc "template-doc-id"
python scripts/coda_cli.py rows update AbCDeFGH grid-xyz row-123 \
--data '{"Status": "Complete", "Completed Date": "2024-01-15"}'
python scripts/coda_cli.py rows delete-batch AbCDeFGH grid-xyz \
--filter '{"Status": "Archived"}' \
--confirm "Delete all archived rows?"
python scripts/coda_cli.py rows list AbCDeFGH grid-xyz --format csv > export.csv
共 1 个版本