Create Import Session
create_import_sessionStart a STAGED historical import for a large or file-based history — the scalable alternative to the inline import tools (which cap at 500 orders per call). Supports three kinds: "salesOrderHistory" (demand velocity), "purchaseOrderHistory" (lead-time observation + vendor graph) and "customerReturnHistory" (returns that net demand — the file form of import_customer_returns; storeId names the store whose warehouse the returns came back to). For PO history, storeId names the store whose warehouse the orders were bought into, so open POs show on its receiving and on-order views. Route large PO CSVs (>500 rows) through this session path instead of calling import_historical_purchase_orders in chunks — it removes the 500-call cap and lets the customer upload once. Returns an uploadUrl: give it to the customer and ask them to open it in a browser and drop their raw export (CSV or XLSX, one header row, up to 25 MB). Nothing else is needed from them — the server parses and profiles every row. Poll get_import_session to see the file arrive, then set_import_mapping → commit_import_session. Spark retains at most the latest 36 calendar months represented by the file; older rows are reported and omitted automatically.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "create_import_session"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | Import kind: "salesOrderHistory" (default), "purchaseOrderHistory" or "customerReturnHistory". | salesOrderHistory |
| storeId | No | Optional STORE id (GUID). Sales history is recorded on this store (the tenant's default store when omitted); returns and purchase orders land in this store's warehouse. Omitted on purchaseOrderHistory, the orders land in the tenant's only internal warehouse, or in none when it has several — pass a storeId then. Get store ids from list_warehouses (each warehouse row lists its stores with their storeId) — a warehouse id is not a store id, even though a warehouse's companion store shares its name. | |
| clientId | No | Operator (unpinned) credentials on 3PL tenants: the target client id (GUID) the imported history belongs to — get ids from list_clients. Client-pinned credentials omit this; the credential decides. | |
| createMissingEntities | No | Create items, customers, and UOMs the history references but the tenant doesn't have yet (default true). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| uploadUrl | No | ||
| instructions | No | ||
| importSessionId | No | ||
| sessionExpiresAt | No | ||
| uploadTokenExpiresAt | No |