# Data tables

> Lookup tables the flows read and write: schema, rows and bulk import.

Lookup tables the flows read and write: schema, rows and bulk import.

## `datatable_get`

**Get a data table** · Read only · Listed to the agent from the start

Gets a data table: `schema` (columns, keySpec, version), `rowCount` and one page of `rows` (each with key, fields, updatedBy/updatedAt). Paginate with `cursor` = `nextCursor` of the previous response.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes |  |
| `cursor` | string | No |  |
| `limit` | integer | No | Default: `200`. |

## `datatable_list`

**List data tables** · Read only · Listed to the agent from the start

Lists the organization's data tables (name, description, rowCount). Use it first to know which tables exist before reading or writing rows.

No arguments.

## `datatable_row_get`

**Get a row of a data table** · Read only · Listed to the agent from the start

Reads one row by its key (parts joined with '~', for example 'CITY~METHOD'). If it does not exist it answers `ROW_NOT_FOUND`, which is data and not a failure.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | string | Yes |  |
| `name` | string | Yes |  |

## `datatable_usage`

**See which flows read a data table** · Read only · Listed to the agent from the start

Says which flows read a data table: `flows` with `flowId`, `nodes` (the dataTable nodes) and `environments` (draft, prod, testing), and `usedInProd`. What could not be read comes in `unavailable` and never counts as unused (`usedInProd` is null if prod could not be read). `notScanned` = flows left out by the cap. Tables chosen by expression are not detected. Use it to know the effect of changing the schema or deleting the table.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes |  |

## `datatable_create`

**Create a data table** · Changes data · can overwrite or remove · Reached with `dakso_explore`

Creates a data table. `name` in snake_case ([a-z0-9_]{1,48}); `columns` = [{name, type: string|number|boolean, required?}] (maximum 50); `key_spec` = string columns whose normalized value forms the key (for example ["ciudad", "metodo"]). Once rows are loaded, `key_spec` can no longer be changed, so choose it carefully.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `columns` | array | Yes |  |
| `key_spec` | array | Yes |  |
| `name` | string | Yes |  |
| `descripcion` | string | No | One short sentence: what this call changes and why (10-200 chars, no personal data). |
| `description` | string | No | Default: `""`. |

## `datatable_delete`

**Delete a data table** · Changes data · can overwrite or remove · Reached with `dakso_explore`

Deletes the entire table with all its rows. Destructive action; flows with dataTable nodes that use this table stop finding it. Check with `datatable_usage` first. For safety the agent does not run this action: the tool returns a link to the Dakso admin screen where a person confirms it. Give the user that link.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes |  |
| `descripcion` | string | No | One short sentence: what this call changes and why (10-200 chars, no personal data). |

## `datatable_row_delete`

**Delete a row of a data table** · Changes data · can overwrite or remove · Reached with `dakso_explore`

Deletes one row of a data table by its key. If a flow has a dataTable node pointing to that key, the lookup will fall to `onMissing`. For safety the agent does not run this action: the tool returns a link to the Dakso admin screen where a person confirms it. Give the user that link.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | string | Yes |  |
| `name` | string | Yes |  |
| `descripcion` | string | No | One short sentence: what this call changes and why (10-200 chars, no personal data). |

## `datatable_row_upsert`

**Save a row in a data table** · Changes data · can overwrite or remove · Reached with `dakso_explore`

Creates or edits a row. `key` = the key parts joined with '~' and it must match the values of the keySpec columns inside `fields` (otherwise it answers `KEY_MISMATCH`). To edit, pass `base_updated_at` = the `updatedAt` of the row you read (optimistic lock: answers `STALE_ROW` if someone changed it first). These tables often hold critical operational data (for example payment details per city): copy the exact values the user gave, never invent or complete a number, and show the final row for confirmation.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `fields` | object | Yes |  |
| `key` | string | Yes |  |
| `name` | string | Yes |  |
| `base_updated_at` | string | No |  |
| `descripcion` | string | No | One short sentence: what this call changes and why (10-200 chars, no personal data). |

## `datatable_rows_import`

**Load several rows into a data table** · Changes data · can overwrite or remove · Reached with `dakso_explore`

Loads several rows (up to 500 per call) into a data table. `rows` = objects with the column values; the key comes from the keySpec columns. By default it only validates (`dry_run` true) and writes nothing: show the result to the user and, with their approval, call again with `dry_run` false. It writes row by row (creates or replaces) and continues if one fails; it answers `results` per row and `usedInProd` if any production flow reads the table. Values go exactly as the user gave them, never completed.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes |  |
| `rows` | array | Yes |  |
| `descripcion` | string | No | One short sentence: what this call changes and why (10-200 chars, no personal data). |
| `dry_run` | boolean | No | Default: `true`. |

## `datatable_update_schema`

**Change the columns of a data table** · Changes data · can overwrite or remove · Reached with `dakso_explore`

Edits the schema of a data table (add or remove columns). Changing `key_spec` when rows exist answers `KEYSPEC_LOCKED`; in that case the table must be recreated. Check with `datatable_usage` which flows read the table before changing it.

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `columns` | array | Yes |  |
| `key_spec` | array | Yes |  |
| `name` | string | Yes |  |
| `descripcion` | string | No | One short sentence: what this call changes and why (10-200 chars, no personal data). |
