Templates API
Life templates are pre-built task sets for common life events (e.g. "New Baby Checklist", "Moving House"). Templates are defined in code (not database-backed) via the LifeTemplate model.
GET /templates
List all available templates.
Auth required: No
Response (200):
{
"templates": [
{
"id": "new_baby",
"name": "New Baby Checklist",
"description": "Essential tasks for the first year",
"task_count": 12,
"icon": "baby"
},
{
"id": "moving_house",
"name": "Moving House",
"description": "Everything you need for a smooth move",
"task_count": 8,
"icon": "home"
}
]
}curl http://localhost:3000/api/v1/templatesGET /templates/:id
Preview a template with computed due dates. Dates are anchored to the provided anchor_date (or today if not specified).
Auth required: No
Query parameters:
| Param | Type | Description |
|---|---|---|
anchor_date | string | Base date for computing due dates (YYYY-MM-DD). Default: today |
Response (200):
{
"template": {
"id": "new_baby",
"name": "New Baby Checklist",
"description": "Essential tasks for the first year",
"tasks": [
{
"index": 0,
"title": "Register birth",
"due_date": "2026-06-09",
"category": "Documents",
"repeat_interval_months": null,
"reminder_days": [1]
},
{
"index": 1,
"title": "Schedule first pediatrician visit",
"due_date": "2026-06-02",
"category": "Health",
"repeat_interval_months": null,
"reminder_days": [1]
}
]
}
}Errors:
| Status | Cause |
|---|---|
| 404 | Template not found |
curl "http://localhost:3000/api/v1/templates/new_baby?anchor_date=2026-05-26"POST /templates/:id/apply
Apply a template, creating tasks for the current user. Individual tasks can be excluded or have their due dates overridden.
Auth required: Yes
Request body:
{
"anchor_date": "2026-05-26",
"tasks": [
{ "index": 0, "due_date": "2026-06-10" },
{ "index": 2, "excluded": true }
]
}The tasks array is optional. Each entry references a task by its index in the template. You can:
- Override
due_datefor any task - Set
excluded: trueto skip a task
Tasks not mentioned in the array are created with their default computed dates.
Response (201):
{
"tasks": [
{
"id": 42,
"title": "Register birth",
"due_date": "2026-06-10",
"completed": false,
"recurring": false,
"repeat_interval_months": null,
"reminder_days": [1],
"category": {
"id": 1,
"name": "Documents",
"icon_key": "file-text"
},
"created_at": "2026-05-26T10:00:00Z"
}
],
"message": "11 tasks created"
}Errors:
| Status | Cause |
|---|---|
| 404 | Template not found |
curl -X POST http://localhost:3000/api/v1/templates/new_baby/apply \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"anchor_date":"2026-05-26","tasks":[{"index":2,"excluded":true}]}'