packages/server/api/src/assets/prompts/guides/tables.md
Activepieces Tables are a lightweight database built into every project — no external database or connection needed. Use them to store and look up structured data across flow runs.
Reach for a Table whenever a flow needs to remember or look up data:
Prefer Tables over Google Sheets when the data lives inside Activepieces and doesn't need a spreadsheet UI — Tables are faster, typed, and need no connection/auth. Use Google Sheets only when the user already works in that sheet or needs to share/edit it as a spreadsheet. Use an external database piece (Postgres, MySQL, …) only for large or relational data.
TEXT, NUMBER, DATE, STATIC_DROPDOWN (a fixed list of options).Tables belong to a project, so a project must be selected before you create or write one — if none is selected yet, call ap_select_project first. Always start with ap_list_tables to discover existing tables, their field names/types, and row counts — never guess names. Create tables directly with ap_create_table; never fall back to raw HTTP / /api/v1/tables and never ship a placeholder table id.
| Tool | Use |
|---|---|
ap_list_tables | List all tables with their fields and row counts. Call this first. |
ap_create_table | Create a table with an initial set of fields. Types: TEXT, NUMBER, DATE, STATIC_DROPDOWN. |
ap_manage_fields | Add, rename, or delete fields (max 100 fields per table). |
ap_find_records | Query records with optional filters. |
ap_insert_records | Insert one or more records (max 50 per call). |
ap_update_record | Update specific cells of a single record. |
ap_delete_records | Delete records by id. |
ap_delete_table | Permanently delete a table and all its data. |
ap_find_records)eq, neq, gt, gte, lt, lte, co (contains), exists, not_exists.
The agent tools above are for setup and inspection. To read/write a Table from inside a running flow, add the built-in Tables piece as a step (create record, find records, update record) and map step/trigger outputs into the fields:
New email (trigger) → Tables: Create Record → map
{{trigger['output'].subject}}to theSubjectfield,{{trigger['output'].from}}toSender, etc.
The two-id rule (the #1 Tables failure). Every table and field has an internal id and an externalId — ap_list_tables / ap_create_table print both. They are not interchangeable:
table_id = the table's externalId, and the values object is keyed by field externalIds. An internal id fails at runtime with "Table with externalId not found" (and validation will NOT catch it).ap_list_tables first — don't assume a table or field exists.ap_create_table after confirming the table isn't already there.STATIC_DROPDOWN values must match one of the field's configured options.