> ## 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 challenge templates

> Retrieve all available challenge templates.

<Badge color="blue">GET</Badge> `/api/challenge-templates`

Requires authentication.

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from `/api/auth/login` or `/api/auth/signup`. Format: `Bearer <token>`.
</ParamField>

<Info>
  The API is pre-seeded with 7 built-in challenge templates ranging from 1 to 60 days. They are
  available to all authenticated users immediately after the service starts.
</Info>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url http://localhost:3000/api/challenge-templates \
    --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
  ```
</CodeGroup>

## Response

**200 OK**

Returns an array of challenge template objects ordered by creation date, most recent first.

<ResponseField name="id" type="number" required>
  Unique numeric identifier for the template.
</ResponseField>

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

<ResponseField name="description" type="string" required>
  Full description of the challenge goal and instructions.
</ResponseField>

<ResponseField name="duration_days" type="number" required>
  Number of consecutive days the challenge runs.
</ResponseField>

<ResponseField name="created_at" type="string" required>
  ISO 8601 timestamp of when the template was created.
</ResponseField>

<ResponseField name="updated_at" type="string" required>
  ISO 8601 timestamp of the last update to the template.
</ResponseField>

```json Example response theme={null}
[
  {
    "id": 7,
    "title": "Semestre de Disciplina",
    "description": "O desafio supremo: 60 dias de consistência. Apenas para os mais dedicados!",
    "duration_days": 60,
    "created_at": "2026-03-14T00:10:00.000Z",
    "updated_at": "2026-03-14T00:10:00.000Z"
  },
  {
    "id": 6,
    "title": "Desafio Relâmpago",
    "description": "Apenas 1 dia! Complete todas as suas tarefas hoje e ganhe o selo de conclusão.",
    "duration_days": 1,
    "created_at": "2026-03-14T00:10:00.000Z",
    "updated_at": "2026-03-14T00:10:00.000Z"
  },
  {
    "id": 5,
    "title": "Quinzena Produtiva",
    "description": "Duas semanas de produtividade máxima. 14 dias para transformar sua rotina.",
    "duration_days": 14,
    "created_at": "2026-03-14T00:10:00.000Z",
    "updated_at": "2026-03-14T00:10:00.000Z"
  },
  {
    "id": 4,
    "title": "Sprint de 3 Dias",
    "description": "Um desafio rápido para começar. Mantenha sua rotina por 3 dias seguidos.",
    "duration_days": 3,
    "created_at": "2026-03-14T00:10:00.000Z",
    "updated_at": "2026-03-14T00:10:00.000Z"
  },
  {
    "id": 3,
    "title": "Maratona de 30 Dias",
    "description": "Um mês inteiro de dedicação. Complete suas tarefas todos os dias por 30 dias.",
    "duration_days": 30,
    "created_at": "2026-03-14T00:10:00.000Z",
    "updated_at": "2026-03-14T00:10:00.000Z"
  },
  {
    "id": 2,
    "title": "21 Dias de Hábito",
    "description": "Dizem que 21 dias formam um hábito. Aceite este desafio e prove para si mesmo!",
    "duration_days": 21,
    "created_at": "2026-03-14T00:10:00.000Z",
    "updated_at": "2026-03-14T00:10:00.000Z"
  },
  {
    "id": 1,
    "title": "7 Dias de Foco Total",
    "description": "Complete todas as suas tarefas diárias por 7 dias consecutivos. Mantenha o foco e a disciplina!",
    "duration_days": 7,
    "created_at": "2026-03-14T00:10:00.000Z",
    "updated_at": "2026-03-14T00:10:00.000Z"
  }
]
```

## Errors

| Status | Description                         |
| ------ | ----------------------------------- |
| `401`  | Missing, invalid, or expired token. |
