---
title: "Portfolio CSV Import"
method: POST
path: "/portfolio/import-csv"
tags: ["Widgets"]
---

# Portfolio CSV Import

`POST /portfolio/import-csv`

## Request

- Base URL: `https://nzxplorer.co.nz/api/v1`
- URL: `https://nzxplorer.co.nz/api/v1/portfolio/import-csv`
- Auth: one of:
  - API key in header `X-API-Key`
  - API key in query parameter `api_key`

Import portfolio holdings from a broker CSV export. Auto-detects Sharesies, Sharesight, and Hatch formats. Cleans tickers (.NZ suffix, NZX: prefix), validates 2-5 char codes. Use merge=true to add new tickers without replacing existing holdings.

## Request body

- object
  - `csv` string, required: CSV file contents as a string (header + data rows)
  - `platform` string: Force platform: sharesies, sharesight, hatch, auto (default: auto-detect from headers)
  - `merge` 'true' | 'false': If true, add new tickers only (skip existing). Default: false (replace all)

## Response `200`

Portfolio CSV Import

- Envelope: Standard API response envelope
  - `data` unknown
  - `meta` object
    - `api_version` string
    - `timestamp` string, date-time
    - `format` 'standard' | 'llm' | 'fdc3' | 'toon'
    - `endpoint` string

## Other responses

- `401`: Missing or invalid API key
- `429`: Rate limit exceeded
- `500`: Internal server error

---

[API](https://skmtc.dev/nzxplorer/apis/nzxplorer-api.md) · [All operations](https://skmtc.dev/nzxplorer/apis/nzxplorer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/nzxplorer/apis/nzxplorer-api/revisions/f3b95341783a?raw)
