---
title: "Import a Jira-style backlog CSV into the goal tree"
method: POST
path: "/api/goal/import"
tags: ["Goal"]
---

# Import a Jira-style backlog CSV into the goal tree

`POST /api/goal/import`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/goal/import`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

Builds objective -> phase milestones -> epics -> tasks -> FE/BE leaves, with implicit FE<->BE dependency inference within each task. See goal.service.ts `importCsv` for the full column contract.

## Request body

- object
  - `project_id` integer, nullable
  - `csv` string, required
  - `role_map` object

## Response `201`

Import result.

- object
  - `created` integer
  - `deps` integer
  - `nodes` GoalNode[]
    - `id` integer
    - `tenantId` integer
    - `projectId` integer, nullable
    - `parentId` integer, nullable
    - `kind` string: objective | milestone | goal | work_item | relay
    - `ownerRole` string, nullable
    - `status` string: draft | not_started | ready | in_progress | blocked | done | superseded
    - `origin` string, nullable: greenfield | leverage | migrate | unknown
    - `title` string
    - `contextId` integer, nullable
    - `verifyCmd` string, nullable
    - `evidence` string, nullable
    - `targetWeeks` integer, nullable
    - `startsAt` string, date-time, nullable
    - `endsAt` string, date-time, nullable
    - `size` string, nullable
    - `effortWeeks` number, nullable
    - `externalRef` object
    - `orderIndex` integer
    - `fromRole` string, nullable: Relay routing (kind='relay' only).
    - `toRole` string, nullable: Relay routing (kind='relay' only).
    - `claimedBySessionId` integer, nullable
    - `nudgeCount` integer
    - `lastNudgedAt` string, date-time, nullable
    - `nudgedBySessionId` integer, nullable
    - `payload` object
    - `doneAt` string, date-time, nullable
    - `archivedAt` string, date-time, nullable
    - `createdAt` string, date-time
    - `updatedAt` string, date-time
    - `syncOwned` boolean: Server-only marker set exclusively by POST /api/goal/sync.
    - `objectiveRunId` string, nullable

## Other responses

- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.

---

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