# List tasks in a project

`GET /api/project/{projectId}/task`

URL: https://repsona.com/api/get-project-projectid-task

Returns tasks of the project page by page. Use parent_id to list subtasks (a task id) or only top-level tasks (root). Ordered by tree order (sortOrder) when parent_id is given, otherwise by id. Comma-separated id filters match any of the ids.

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `projectId` | path | integer | required | ID of the project. |
| `page` | query | integer |  | Page number, starting at 1. |
| `limit` | query | integer |  | Items per page (up to 500). |
| `parent_id` | query | "root" \| integer |  | Task id, or "root" for top-level tasks only |
| `closed` | query | true \| false |  | `true` to return only completed tasks, `false` to return only open tasks. Omit to return both. |
| `status_ids` | query | string |  | Comma-separated ids |
| `milestone_ids` | query | string |  | Comma-separated ids |
| `tag_ids` | query | string |  | Comma-separated ids |
| `responsible_user_ids` | query | string |  | Comma-separated ids |
| `ball_holder_ids` | query | string |  | Comma-separated ids |

## Request

```sh
curl -X GET "https://<space>.repsona.com/api/project/{projectId}/task" \
  -H "Authorization: Bearer $REPSONA_API_KEY"
```

## Responses

- 200: { tasks, page, limit, hasMore }
- 400: Invalid query parameters
- 401: Authentication is required
- 403: Not a project member
- 404: Project not found

## Example response

```json
{
  "tasks": [
    {
      "id": 100442,
      "parentId": null,
      "projectId": 296,
      "responsibleUserId": 1127,
      "ballHoldingUserId": 1127,
      "statusId": 196,
      "milestoneId": 38,
      "sortOrder": null,
      "statusBoardSortOrder": null,
      "priorityBoardSortOrder": null,
      "responsibleUserBoardSortOrder": null,
      "ballHoldingUserBoardSortOrder": null,
      "milestoneBoardSortOrder": null,
      "name": "Write release notes for v2.0",
      "planned": null,
      "actual": null,
      "priority": 2,
      "extra": null,
      "startDate": 1794182400000,
      "dueDate": 1794614400000,
      "createdAt": 1793662651065,
      "updatedAt": 1793662651113,
      "deletedAt": null,
      "tagIds": [
        90
      ],
      "description": "Summarize the changes in the new website for the **launch announcement**."
    }
  ],
  "page": 1,
  "limit": 20,
  "hasMore": false
}
```
