Import data into branch
layerz_import_branchWrites values onto a branch of the model, creating the branch when branch.id names none (branch.display_name required then). Two sources, mutually exclusive: entries[] (one value per item and period, items resolved by item_uid or item_label, created as assumptions when absent; entry_uid / entry_label target one entry of a list-mode item) or file_id (an uploaded spreadsheet parsed server-side, rows classified with the source's mapping rules). A new version of a file already imported: file_id + replace_source_id, nothing else (refreshed in place on the branch it feeds, default included). A first file onto the base: file_id + branch.id: "default" (a new source, own rows only).A new file of a kind the model already has: file_id + rules_from_source_id (classified with that sibling's rules, copied onto the new source). An entry's timeline_ref equals the target item's grain or constant; on a formula / balance it is a per-period override; on a callup it lands on the source. replace: true (with branch.id) wipes the branch's rows before writing; replace_scope: 'import' wipes only this source's own rows; merge: true upserts cell by cell; dry_run: true returns the impact without persisting (purged_periods, overridden_items, validation_errors_new, suggested_replace_source). Returns counts, warnings and, on the file path, skipped, opening_entries, rules_copied, file_structure. Persists one version labelled with summary.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"summary": "<summary>",
"branch": "<branch>"
},
"name": "layerz_import_branch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| merge | No | ||
| branch | Yes | ||
| dry_run | No | ||
| entries | No | ||
| file_id | No | Upload id from layerz_create_upload_url ('f_' + 16 hex chars). Alternative to entries[]. | |
| replace | No | ||
| summary | Yes | Short note (3–100 chars) describing the change, stored as the label of the resulting version. Examples: "Renamed Revenue to Net Revenue", "Imported 2024 OPEX from Excel". | |
| model_id | No | Target model UUID. Required for user-scoped API keys; validated against the bound model for model-scoped keys. | |
| sheet_name | No | ||
| record_import | No | ||
| replace_scope | No | ||
| replace_source_id | No | file_id path only: refresh this existing file source in place (id from layerz_list_integrations) instead of creating a second one. The rows are classified with that source's own rules and replace its rows on the branch it feeds (the default branch included): `replace`, `replace_scope: 'import'` and `branch.id` are implied. | |
| structure_override | No | Override auto-detected columns for a long-format/ledger file (e.g. value_column chose "Débit" and dropped credit rows, or an account-code column won the label). Omitted fields stay auto-detected. | |
| rules_from_source_id | No | file_id path, new source only: classify this upload with the rules of that source of the model (id from layerz_list_integrations) and copy them onto the new source, existing rules kept — a second file of the same kind starts mapped. |