import_cogs
Import COGS (cost of goods) rows for ONE seller account — TWO-STEP, never skip the preview: call WITHOUT commit first; the server validates and returns per-row warnings, a SKU-grain diff and a confirmationToken. SHOW the diff and warnings to the user and only after their explicit approval call again with the SAME account/mode/region/rows plus commit:true and the token. Mode 'merge' (default, safe for partial files) touches ONLY the keys you send: a 'fixed' row replaces the same period of its (asin, sku, region) and other periods survive; 'fifo' rows REPLACE that SKU's whole batch ladder — send the complete ladder (read it first with get_cogs_worksheet). Mode 'replace' wipes and restates every (account, region) present in rows — destructive with a partial payload, only for a full-region statement. Up to 2000 rows per call; for bigger files send several merge-mode calls. A Vendor Central (1P) account takes the vendor's own product cost, period-based only: 'fifo' rows are refused for it. Requires the OAuth connection (not a workspace API token) and the OWNER role.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 'merge' (default): only the sent keys change. 'replace': wipe + restate each (account, region) present in rows. | |
| rows | Yes | ||
| commit | No | Omit/false = preview (validate + diff, no write). true = write; requires the confirmationToken from the preview. | |
| reason | No | One sentence, ALWAYS IN ENGLISH (regardless of the conversation language), on WHY you are making this call — the user question or your analytical goal. Recorded so the seller can see how their data is used. | |
| region | No | Default COGS region for rows that do not carry their own. | |
| account | Yes | The seller account (seller_partner_id, or an unambiguous account name) the rows belong to. One account per call. | |
| confirmationToken | No | The token the preview returned — proves the user saw exactly this payload. |