# Import tasks from CSV

`POST /api/project/{projectId}/task/import-csv`

URL: https://repsona.com/api/post-project-projectid-task-import-csv

Imports tasks from a CSV file into the project and returns the number of rows imported.
Send `multipart/form-data` with the CSV in a part named `file` (up to 10 MB and 10,000 rows, UTF-8; a BOM is fine).
The first row is a header and is skipped. Each row has these 14 columns in this order — the same layout as the CSV export, so you can edit an exported file and import it again:
`id`, `name`, `description`, `responsibleUser`, `ballHoldingUser`, `startDate`, `dueDate`, `status`, `milestone`, `parent`, `tags`, `planned`, `actual`, `sortOrder`
• `id`: the ID of a task in this project updates that task. Empty or any other value creates a new task (other rows can refer to the value in `parent`).
• `name` is required. `description` is Markdown.
• `responsibleUser`, `ballHoldingUser`: a user name or full name. Names that match no one are ignored.
• `startDate`, `dueDate`: `YYYY-MM-DD`.
• `status`, `milestone`: a status or milestone name in this project. Names that match nothing are left empty.
• `parent`: a parent task ID, or an `id` value from the same file. Empty makes it a top-level task.
• `tags`: comma-separated tag names. Missing tags are created.
• `planned`, `actual`, `sortOrder`: numbers (planned, actual, sort order).
When a row updates a task, empty cells clear those fields.

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `projectId` | path | integer | required | ID of the project. |

## Request body

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `file` | body | file | required | The CSV file to import. |

## Request

```sh
curl -X POST "https://<space>.repsona.com/api/project/{projectId}/task/import-csv" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -F "file=@tasks.csv"
```

## Responses

- 200: Import result (count)
- 400: Invalid CSV, column count mismatch, row limit exceeded, or task limit exceeded
- 401: Authentication is required
- 403: Not a project member
- 404: Project not found

## Example response

```json
{
  "count": 2
}
```
