---
title: "Import user principals from a canonical CSV"
method: POST
path: "/v2/directories/{directoryId}/org-chart/import"
tags: ["KongPrincipal"]
---

# Import user principals from a canonical CSV

`POST /v2/directories/{directoryId}/org-chart/import`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v2/directories/{directoryId}/org-chart/import`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Imports user principals in bulk from a canonical CSV file. Each row
creates one user principal — tagged hris_import, stamped with the
row's external_id — plus its email custom identity. The optional
cost_center column is stored in the principal's metadata as
cost_center; rows matched to existing principals adopt the file's
value, and a blank cell clears the stored one, while a file without
the column leaves existing cost centers untouched. The file is
validated in full before anything is written; the response is a
report of counts and per-row errors, never the created rows.

## Path parameters

- `directoryId` string, uuid, required

## Request body `multipart/form-data`

- ImportPrincipalsRequest
  - `file` string, binary, required: The canonical CSV file (UTF-8, comma-separated, RFC 4180 quoting)
  - `dry_run` boolean: Validate the file and return the report without applying anything — no principals created, updated, or made inactive. Defaults to true; pass false to apply the import.

## Response `200`

Import report — counts, warnings, and per-row errors

- KongImportReport: Result of an import run.
  - `counts` object, required
    - `users` object, required
      - `created` integer, required: Number of user principals created by the run.
      - `updated` integer, required: Number of matched user principals updated by the run.
      - `unchanged` integer, required: Number of matched user principals that required no change.
      - `adopted` integer: Number of existing principals adopted by email instead of created.
      - `inactive` integer, required: Number of previously imported principals made inactive because the file no longer carries them.
    - `teams` object, required
      - `created` integer, required: Number of teams created by the run.
      - `deleted` integer, required: Number of importer-created teams deleted by the run after their rosters emptied.
    - `memberships` object, required
      - `added` integer, required: Number of team memberships the run added.
      - `removed` integer, required: Number of team memberships the run removed (manager changes, departures).
  - `warnings` KongImportWarning[], required: The run succeeded, but a human should look at these rows.
    - `row` integer, nullable: 1-based data-row number within the uploaded file; null for run-level warnings.
    - `type` string, required: The warning kind (for example, email_changed or quota_shortfall).
    - `detail` string, required
  - `errors` KongImportRowError[], required
    - `row` integer, required: 1-based data-row number within the uploaded file.
    - `field` string, nullable: The column the row failed on, when the failure is column-specific.
    - `reason` string, required

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found

## Changes

- **2026-11-05** `ff8439091e5f`: 1 info
  - the `dry_run` request property default value `true` was added
- **2026-11-04** `32ab5efbbb23`: 1 info
  - added the optional property `counts/users/adopted` to the response with the `200` status
- **2026-11-03** `72599e2b1b09`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/konnect-api-go-sdk/changes/v2/directories/:directoryId/org-chart/import/post.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api-go-sdk.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api-go-sdk/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4?raw)
