> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/RafaeltiMoreira/mais-habito-api/llms.txt
> Use this file to discover all available pages before exploring further.

# List tasks

> Retrieve all tasks belonging to the authenticated user.

<Info>
  This endpoint returns only the tasks that belong to the authenticated user. Tasks created by other users are never included in the response.
</Info>

## Response

**200 OK** — Returns an array of task objects, each paired with an all-time completion count. Tasks are ordered by `created_at` ascending.

<ResponseField name="[]" type="object[]" required>
  Array of task-with-count objects.

  <Expandable title="properties">
    <ResponseField name="task" type="object" required>
      The task object.

      <Expandable title="properties">
        <ResponseField name="id" type="number" required>
          Unique identifier for the task.
        </ResponseField>

        <ResponseField name="user_id" type="string" required>
          UUID of the user who owns the task.
        </ResponseField>

        <ResponseField name="challenge_template_id" type="number | null" required>
          ID of the associated challenge template, or `null`.
        </ResponseField>

        <ResponseField name="title" type="string" required>
          Display name of the task.
        </ResponseField>

        <ResponseField name="description" type="string | null" required>
          Optional description, or `null`.
        </ResponseField>

        <ResponseField name="points" type="number" required>
          Points awarded per completion.
        </ResponseField>

        <ResponseField name="is_daily_routine" type="boolean" required>
          Whether the task is flagged as a daily routine.
        </ResponseField>

        <ResponseField name="created_at" type="string" required>
          ISO 8601 creation timestamp.
        </ResponseField>

        <ResponseField name="updated_at" type="string" required>
          ISO 8601 last-updated timestamp.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="completion_count" type="number" required>
      Total number of times this task has been completed across all time.
    </ResponseField>
  </Expandable>
</ResponseField>

## Errors

| Status | Condition                                |
| ------ | ---------------------------------------- |
| `401`  | Missing or invalid authentication token. |

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url http://localhost:3000/api/tasks/me \
    --header 'Authorization: Bearer <token>'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  [
    {
      "task": {
        "id": 42,
        "user_id": "a3f1c2d4-0e5b-4a7f-b891-2c3d4e5f6a7b",
        "challenge_template_id": null,
        "title": "Meditate for 10 minutes",
        "description": "Morning meditation session",
        "points": 20,
        "is_daily_routine": true,
        "created_at": "2026-03-17T08:00:00.000Z",
        "updated_at": "2026-03-17T08:00:00.000Z"
      },
      "completion_count": 7
    },
    {
      "task": {
        "id": 43,
        "user_id": "a3f1c2d4-0e5b-4a7f-b891-2c3d4e5f6a7b",
        "challenge_template_id": null,
        "title": "Read 20 pages",
        "description": null,
        "points": 10,
        "is_daily_routine": false,
        "created_at": "2026-03-17T09:30:00.000Z",
        "updated_at": "2026-03-17T09:30:00.000Z"
      },
      "completion_count": 3
    }
  ]
  ```

  ```json 401 theme={null}
  {
    "error": "User not authenticated"
  }
  ```
</ResponseExample>
