> ## 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.

# Get challenge template

> Retrieve a single challenge template by its ID.

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

Requires authentication.

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

## Path parameters

<ParamField path="id" type="number" required>
  The numeric ID of the challenge template to retrieve.
</ParamField>

## Example

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

## Response

**200 OK**

<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": 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"
}
```

## Errors

| Status | Description                                   |
| ------ | --------------------------------------------- |
| `401`  | Missing, invalid, or expired token.           |
| `404`  | No challenge template found for the given ID. |
