Skip to content

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):

json
{
  "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"
    }
  ]
}
bash
curl http://localhost:3000/api/v1/templates

GET /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:

ParamTypeDescription
anchor_datestringBase date for computing due dates (YYYY-MM-DD). Default: today

Response (200):

json
{
  "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:

StatusCause
404Template not found
bash
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:

json
{
  "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_date for any task
  • Set excluded: true to skip a task

Tasks not mentioned in the array are created with their default computed dates.

Response (201):

json
{
  "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:

StatusCause
404Template not found
bash
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}]}'

Internal documentation — not for public distribution