HTTP API
Use the HTTP API to read and manage your Leeway tasks from scripts and integrations. Requests and responses use JSON, with endpoints under https://leeway.sh/api/v1.
The examples below use paths beginning with /api/v1. For another deployment, replace https://leeway.sh with its origin.
Auth
Create keys in Settings → API keys while signed in. Scripts, agents, CLI, and other integrations then call /api/v1 with that secret as a Bearer token, not a session cookie:
Authorization: Bearer lee_live_…
OAuth access tokens use the same Authorization header for MCP browser clients. Create, list, rotate, and revoke for API keys are session-only. A personal access token or OAuth bearer cannot mint keys. Settings is the only place to create them.
Write endpoints require the write scope. A read-only token receives 403 with problem type insufficient_scope if it tries to make a change. Missing authentication returns 401 with { "error": "Unauthorized" }.
POST /api/v1/auth/token
Create a personal access token from Settings while signed in. GET /api/v1/auth/token lists keys without secrets.
Request JSON:
| Field | Notes |
|---|---|
name |
Required. Must be unique among your active keys. Leading and trailing spaces are removed. |
expires_at |
Optional ISO timestamp, or null. |
scopes |
Optional string array. Default ["read", "write"]. Write requires read. |
You can have up to 50 active tokens. Names must be unique among active keys. Reusing an active token name returns 400.
Returns 201 with the new token. Copy the token value now; it’s only returned once. New keys are stored as HMAC-SHA256 of the plaintext with the server secret (LEEWAY_TOKEN_SECRET, or API_TOKEN_PEPPER, at least 32 characters), not the secret itself, so the full value cannot be shown again:
{
"id": "01…",
"user_id": "…",
"name": "laptop",
"token": "lee_live_…",
"prefix": "lee_live",
"scopes": ["read", "write"],
"expires_at": null
}
Send it as Authorization: Bearer lee_live_… to authenticate with this API or MCP.
POST /api/v1/auth/token/:id/rotate
Mint a new secret for the same key while signed in. Name, scopes, and expiry stay the same. The previous secret stops working. Returns the new plaintext once.
DELETE /api/v1/auth/token/:id
Revoke a key while signed in. The secret stops working immediately.
Rotating LEEWAY_TOKEN_SECRET or API_TOKEN_PEPPER invalidates keys minted under the old secret (HMAC). Set that value to at least 32 characters; minting and rotating fail if it is missing or shorter. Legacy keys stored as unsalted sha256 from before this change keep working until you rotate or revoke them in Settings. After a secret compromise, rotate the server secret and revoke or rotate all keys in Settings.
POST /api/v1/auth/session
Check which user is authenticated. Send no request body. Returns { "userId": "…" } for a valid session, personal access token, or OAuth access token, and 401 otherwise.
Dates and timezones
Task creation and individual task updates use scheduled_on for a planned date and deadline_on for a deadline. Both accept YYYY-MM-DD, without a time of day. For example, to create a task planned for 8 October and due on 9 October, send this body to POST /api/v1/tasks:
{
"title": "Send the report",
"schedule_kind": "scheduled",
"scheduled_on": "2026-10-08",
"deadline_on": "2026-10-09"
}
These endpoints don’t accept MCP fields such as on: "friday". Use MCP for relative dates, or the MCP-style fields supported by the batch update endpoint.
Timezone behaviour currently varies by endpoint. Agenda and task-list requests with a view use your account’s timezone, as do MCP tools. Completion, skipping, snapshot, changes, and template creation with materialize_first calculate today’s date in Europe/London. This can affect which date is used near midnight if you’re in another timezone.
Errors
Some endpoints return RFC 9457 problem details with Content-Type: application/problem+json. These responses include type (under https://leeway.sh/problems/…), title, status, detail, and an error string. Other endpoints return a simpler { "error": "<message>" } response, including many validation errors. Handle both formats in your client.
Looking up a task that doesn’t exist returns 404. An ID prefix that matches more than one task returns 409.
Tasks
Tasks use these values:
| Field | Values |
|---|---|
status |
open, completed, skipped, cancelled, trashed |
schedule_kind |
inbox, anytime, scheduled, someday |
scheduled_slot |
day, evening |
Task IDs are ULIDs. GET /api/v1/tasks/:id also accepts a unique prefix of at least 8 characters.
GET /api/v1/tasks
List tasks, optionally filtered to a view:
Without view: Returns { "tasks": [ … ] } containing all non-trashed tasks, plus trashed tasks from the past 90 days, ordered by position. This includes completed tasks.
With view: Applies the same view rules as MCP list_tasks. Accepts these query parameters:
| Param | Notes |
|---|---|
view |
home, inbox, today, upcoming, anytime, someday, deadlines, logbook, area, project |
area |
Name or ID. Required for view=area. |
project |
Name or ID. Required for view=project. |
q |
Search within titles and notes. |
limit |
Default 50, cap 100. |
cursor |
Task ID to page after. |
With a view, the response is { today, tz, total, cursor, tasks }. Tasks use the compact keys described under MCP list_tasks: id, t, k, s, and optional on, by, a, r, c, p. An invalid view returns 400 problem details.
POST /api/v1/tasks
Create one task by sending an object, or several tasks by sending an array. Requires write scope and returns 201.
To retry a request without creating duplicate tasks, reuse the same Idempotency-Key header. For an array, each task uses {key}:{index}. An explicit client_ref on a task takes precedence over the header.
Each task accepts these fields:
| Field | Notes |
|---|---|
id |
Optional. Server generates a ULID if omitted. |
title |
Required. 1–500 characters. |
notes |
Optional. Up to 20,000 characters, or null. |
area_id |
Optional. Accepts null. |
project_id |
Optional. Accepts null. |
parent_id |
Optional. Accepts null. The parent must exist and can’t itself be a sub-task. A child inherits its parent’s area and project. |
schedule_kind |
Optional. Defaults to inbox. |
scheduled_on |
YYYY-MM-DD, or null. A scheduled task must have a planned date; other schedule kinds must not. |
scheduled_slot |
day or evening. |
deadline_on |
YYYY-MM-DD, or null. |
position |
Number or string. Default is max position + 1000. |
source |
web, cli, mcp, api, email, slack. |
source_ref |
Optional object. |
client_ref |
Optional idempotency key. |
For a single object, the response is the created task. For an array, it’s { "tasks": [ … ] }. Both return 201.
Validation errors return 400 with { "error": "…" }.
GET /api/v1/tasks/:id
Get the full task object. Returns 404 with problem type not-found if the task doesn’t exist, or 409 if an ID prefix matches more than one task.
PATCH /api/v1/tasks/:id
Update only the fields you supply. Requires write scope. Accepted fields are:
title, notes, area_id, project_id, parent_id, status, schedule_kind, scheduled_on, scheduled_slot, deadline_on, position, completed_at, trashed_at, template_id, instance_seq.
All fields are optional. Supply template_id and instance_seq together when linking a task to a template instance. Deleted tasks cannot be edited this way; restore them first, or send a non-trashed status (optionally with trashed_at: null) to clear trash. Clearing only trashed_at on a trashed row reopens it. Returns 404 if the task doesn’t exist and 400 for other errors.
Use the HTTP field names here, such as area_id and scheduled_on. The shorter MCP names (area, on) are supported by the batch update endpoint below.
DELETE /api/v1/tasks/:id
Move the task and its children to trash by setting status: "trashed" and trashed_at. This doesn’t permanently delete them. Requires write scope and returns { "success": true }. Trashed tasks remain in Logbook for 90 days.
POST /api/v1/tasks/:id/restore
Restore a trashed task. Requires write scope. With no body, clears trashed_at, sets status to open, and restores currently-trashed children. Send { "ids": ["…"], "prior": { "<id>": { "status": "completed", "completed_at": "…" } } } to restore only those ids (the URL id is included) in one transaction, keeping each row’s pre-trash status when prior is supplied, without cascading other trashed children. Invalid JSON or an empty/non-string ids list returns 400; it does not cascade. Restoring a sub-task fails with 400 while its parent is still deleted; restore the parent instead. Returns { "restored": <task>, "children": [ … ] }, 404 if it doesn’t exist, or 400 for other errors.
POST /api/v1/tasks/:id/complete
Complete the task as of today. Requires write scope. By default, this also completes open sub-tasks. To leave them open, send { "cascade": false }; only an explicit false disables the default.
Returns { "completed": <task>, "next": <task or null> }. For a repeating task, next contains the newly created instance, if any.
Returns 404 if the task doesn’t exist and 400 for other errors.
POST /api/v1/tasks/:id/reopen
Reopen a task. Requires write scope and no request body. Returns the reopened task, 404 if it doesn’t exist, or 400 for other errors.
POST /api/v1/tasks/:id/skip
Skip the current occurrence of a repeating task and advance the series. Requires write scope. Returns { "skipped": <task>, "next": <task or null> }.
POST /api/v1/tasks:batchUpdate
Update multiple tasks using the same fields as MCP update_tasks. Requires write scope. Send ids and a shared patch:
{ "ids": ["01…"], "patch": { "title": "New title" } }
Or use updates to edit each task individually:
{ "updates": [{ "id": "01…", "title": "New title" }] }
Accepted patch fields are: title, notes, area, project, kind, on, by, status (open or trashed), parent. Include confirm: true after obtaining approval to trash more than 20 tasks.
Invalid JSON or fields return 400 with problem type invalid. Trashing more than 20 tasks without confirmation returns 409 with problem type confirm-required and a count. A successful response includes the MCP update results, including updated, unchanged, and failed.
Areas
GET /api/v1/areas
List non-archived areas, ordered by position. Returns { "areas": [ … ] }.
Area object fields include id, user_id, name, color, position, archived_at, created_at, updated_at.
POST /api/v1/areas
Create an area. Requires write scope. For example: { "name": "Health", "color": "#16705C", "position": 1000 }.
Supply a name. The optional color defaults to #16705C, and position defaults to the highest existing position plus 1000. Returns 201 with the created area.
PATCH /api/v1/areas/:id
Update an area’s name, color, position, or archived_at. Omitted fields stay unchanged. Set archived_at to an ISO timestamp to archive the area, or null to unarchive it. Requires write scope.
DELETE /api/v1/areas/:id
Permanently delete an area and its projects. The tasks remain, with their area_id and project_id cleared. Requires write scope and returns { "success": true }.
To keep the area and its history, archive it with PATCH instead. MCP supports archiving only.
There is no GET /api/v1/areas/:id.
Projects
GET /api/v1/projects
List open projects. Returns { "projects": [ … ] }.
Project fields include id, user_id, area_id, name, notes, position, status, completed_at, created_at, updated_at.
POST /api/v1/projects
Create a project within an area. Requires write scope and an area_id. For example: { "name": "Migration", "area_id": "01…", "notes": "…", "position": 1000 }. Returns 201 with the created project.
PATCH /api/v1/projects/:id
Update a project’s name, notes, area_id, position, or status. Omitted fields stay unchanged. Requires write scope.
DELETE /api/v1/projects/:id
Permanently delete a project. Its tasks remain, with project_id cleared. Requires write scope and returns { "success": true }. MCP archives a project by setting its status to completed.
There is no GET /api/v1/projects/:id.
Templates
Templates store the rules for repeating tasks. See Templates and recurrence for how rules create task instances.
GET /api/v1/templates
List your templates, including ended templates. Returns { "templates": [ … ] }. To fetch only templates that are neither paused nor ended, use the snapshot endpoint.
POST /api/v1/templates
Create a repeat template. Requires write scope. Accepts these fields:
| Field | Notes |
|---|---|
title |
The task title to use for instances. |
notes |
Optional. |
area_id / project_id |
Optional. |
scheduled_slot |
Default day. |
subtask_titles |
Array of strings. Default []. |
freq |
daily, weekly, monthly_day, monthly_weekday, yearly. |
interval |
Default 1. |
byweekday |
Array of weekdays, using 1–7 for Monday–Sunday. |
bymonthday |
Day of the month (1–31), or -1 for the last day. |
bysetpos |
Occurrence of the chosen weekday (1–5), or -1 for the last. |
bymonth |
Month of the year (1–12). |
anchor |
Default schedule. |
rule_drives |
Default scheduled. |
deadline_offset_days |
Optional. |
lead_days |
Default 14. |
starts_on |
Start date in YYYY-MM-DD format. |
ends_on / max_occurrences |
Optional end date or maximum number of occurrences. |
To create the first task instance at the same time, include:
| Field | Notes |
|---|---|
materialize_first |
Set to true to generate the first instance after creating the template. |
first_instance.deadline_on |
Optional deadline to apply to the generated instance. |
Returns 201 with the template. If materialize_first is true, the response is { …template, instance } instead.
To change an existing repeat rule, use MCP’s set_repeat tool. HTTP template updates currently only support turning a repeat off.
PATCH /api/v1/templates/:id
End a repeating series by sending { "off": true }. Requires write scope. This records ended_reason: "user_off", detaches the open instance so it remains an ordinary task, and keeps the series history.
Other updates return 400 with { "error": "Only { off: true } is supported" }. A missing template returns 404.
There is no GET /api/v1/templates/:id and no DELETE.
Agenda and sync
GET /api/v1/agenda
Get a daily overview. Accepts these query parameters:
| Param | Notes |
|---|---|
days |
Number of upcoming days. Defaults to 7. Unlike MCP’s agenda tool, this endpoint doesn’t enforce a maximum of 30. |
area |
Name or ID. |
Returns the same overview as MCP agenda: { today, tz, overdue, due_today, slipped, today_scheduled, next, counts }, using compact task objects.
GET /api/v1/snapshot
Fetch the data needed to populate a client: user, tasks, areas, projects, templates, and today in YYYY-MM-DD format.
The snapshot includes all open tasks, completed children of open parents, and logbook entries from the past 90 days, including deleted (trashed) tasks. It excludes archived areas, non-open projects, paused or ended templates, and trashed tasks older than 90 days.
With write scope, this request also generates any repeat instances that are due to be created before returning the snapshot. With a read-only token, it returns the existing data without generating instances.
GET /api/v1/changes
Fetch changes since an ISO timestamp using the since query parameter. If omitted, it defaults to 1970-01-01T00:00:00.000Z.
Returns:
{
"today": "2026-09-30",
"cursor": "2026-09-30T12:00:00.000Z",
"tasks": [],
"areas": [],
"projects": [],
"templates": [],
"deleted": {
"taskIds": [],
"areaIds": [],
"projectIds": [],
"templateIds": []
}
}
deleted lists IDs that changed after since and are no longer visible: trashed tasks outside the 90-day Logbook window, archived areas, non-open projects, and paused or ended templates. Recent trashed tasks appear in tasks so Logbook can show and restore them. The cursor is the latest updated_at value in the results.
This endpoint generates due repeat instances before reading changes, including for read-only callers. Its behaviour differs from the snapshot endpoint, which only generates instances for callers with write scope.
Batch limits and confirmation
POST /api/v1/tasks:batchUpdate accepts up to 100 tasks. Trashing more than 20 requires confirm: true after approval. The other HTTP endpoints don’t use MCP’s bulk-change confirmation rules.
MCP’s shared write limit of 60 calls per minute per token applies to MCP tool calls, not these HTTP endpoints.
For assistant-friendly tools and relative dates, see MCP. For how dates, views, and repeating tasks work, see Concepts.