---
name: store-csv-import
description: Import CSV data into a NiftyImages Data Store via MCP or the v2 API. Use when a user wants to create a store from CSV or update an existing store from a spreadsheet.
---

# Store CSV Import

## Preferred path: MCP

MCP endpoint: `https://dev.niftyimages.com/store_mcp`

Use tool **`store_import_csv`**:

| Situation | Args |
| --- | --- |
| Create new store (account API key) | `storeName`, `csvText` or `csvFile`, optional `uniqueColumn` |
| Update existing store | `storeId` (or Store API Key alone), `csvText` or `csvFile` |

Then verify with **`store_query`** (`mode: count`) or **`store_get_record`**.

## Credential rules

- Prefer a **Store API Key** (`store-…`) for marketing: one store, no schema changes.
- Account keys can create stores. Store keys can only import into their assigned store.
- Call **`store_access`** first if scope is unknown.
- Never invent, log, or expose API keys.

## HTTP alternative (no MCP)

1. `GET /v2/stores/access` (or create with `POST /v2/stores` on account keys).
2. `POST /v2/stores/{storeId}/records/batch` in chunks of 100.
3. `POST /v2/stores/{storeId}/records/count` to confirm.

OpenAPI: `https://dev.niftyimages.com/openapi/v1.json`

## Rules

- Header row required.
- Existing-store import: CSV columns must match schema property names.
- Prefer a unique column (email, id, sku) so re-imports **update** instead of duplicate.
- Without a unique column, import is **append-only** (new ids each row). Valid for “list newest” stores; warn the user that re-import duplicates.
- Report succeeded / failed counts. Do not silently drop failures.
- MCP import caps at 500 rows; larger files should use REST batching.

## Do not

- Do not delete a store to “reload” data.
- Do not create a second store with a similar name when the user meant update.
- Do not use a Store API Key on other stores.
