Skip to main content
Glama

Things API

CI Release Docker things-sdk on PyPI

RESTful API over Things3 data. Syncs bidirectionally with Things Cloud via the reverse-engineered sync protocol and exposes your tasks, projects, areas, and tags over HTTP/HTTPS.

This repository ships three related products:

  • things-api — a ready-to-run HTTP/HTTPS service

  • things-sdk — a standalone Python SDK for scripts, CLIs, workers, and integrations

  • things-cloud-mcp — an MCP server that gives AI agents (Claude, Codex, etc.) read/write access to your tasks

Looking for the Python library instead of the HTTP service? See packages/things-sdk/README.md. Want to connect your AI agent? See packages/things-mcp/README.md.

Which package should I use?

Use case

What to use

You want a hosted/self-hosted HTTP/HTTPS API

things-api

You want to build a CLI, script, worker, or integration in Python

things-sdk

You want AI agents to read/write your tasks

things-cloud-mcp (requires a running things-api)

If you just want to run a server and call it over HTTP/HTTPS, continue with the API docs below. If you want to embed the core functionality directly in Python, jump to the SDK README.

Related MCP server: Things MCP

Quick Start

cp .env.example .env
# Edit .env with your Things Cloud credentials and a strong API key

docker compose up -d

The API is available at http://localhost:3117. Interactive docs at http://localhost:3117/docs.

Configuration

All settings are configured via environment variables (or a .env file):

Variable

Required

Default

Description

API_KEY

Yes

—

Primary API key for authentication. Must be at least 32 characters. Passed via X-API-Key header.

API_KEY_NEXT

No

—

Optional secondary API key for zero-downtime key rotation.

THINGS_EMAIL

Yes

—

Your Things Cloud account email

THINGS_PASSWORD

Yes

—

Your Things Cloud account password

SYNC_INTERVAL_SECONDS

No

0

Background sync interval in seconds. 0 disables background sync. Recommended: 60.

ENABLE_SCHEDULER

No

true

Enable background scheduler in this process.

SCHEDULER_LOCK_SECONDS

No

30

Distributed scheduler leadership lease duration. Only the lock owner runs background sync.

SCHEDULER_HEARTBEAT_SECONDS

No

10

Lease renewal interval for scheduler leadership.

MANUAL_SYNC_LOCK_SECONDS

No

120

Lease duration for manual sync lock to prevent overlapping POST /api/sync runs.

SYNC_RETRY_ATTEMPTS

No

3

Number of retry attempts for transient cloud pull/push failures.

SYNC_RETRY_BASE_SECONDS

No

0.25

Exponential backoff base delay for retries.

SYNC_CIRCUIT_BREAKER_FAILURES

No

3

Consecutive sync failures required to open the circuit breaker.

SYNC_CIRCUIT_BREAKER_COOLDOWN_SECONDS

No

60

Cooldown period while breaker is open before a half-open probe is allowed.

READINESS_MAX_SYNC_ERRORS

No

5

Degrade /ready when total sync errors exceed this threshold.

LOG_FORMAT

No

text

Set to json to enable structured JSON logging.

ENABLE_METRICS

No

false

Set to true to expose GET /metrics (Prometheus-compatible counters).

DATABASE_URL

No

sqlite+aiosqlite:///./data/things.db

SQLAlchemy database URL

API Endpoints

All /api/* endpoints require the X-API-Key header.

Tasks

GET    /api/tasks          # List all non-trashed tasks
GET    /api/tasks/{uuid}   # Get a single task
POST   /api/tasks          # Create a task
PATCH  /api/tasks/{uuid}   # Update a task
DELETE /api/tasks/{uuid}   # Soft-delete (trash) a task

Smart Lists

GET    /api/tasks/inbox     # Unscheduled tasks
GET    /api/tasks/today     # Tasks for today or earlier
GET    /api/tasks/upcoming  # Tasks scheduled for the future
GET    /api/tasks/anytime   # Tasks available anytime
GET    /api/tasks/someday   # Low-priority ideas
GET    /api/tasks/logbook   # Completed tasks (default: last 30 days, ?since=<epoch>)
GET    /api/tasks/trash     # Trashed tasks
GET    /api/tasks/search?q=<text>           # Full-text search (title, notes, checklist items)
GET    /api/tasks/search/advanced?...       # Multi-predicate filter (status, type, schedule, area, project, tag, date ranges, modified/completed since)

Projects

GET    /api/projects                        # List active projects (?include_completed=true to include completed)
POST   /api/projects                        # Create a project
PATCH  /api/projects/{uuid}                 # Update a project
POST   /api/projects/{uuid}/complete        # Mark a project as completed
DELETE /api/projects/{uuid}                 # Soft-delete (trash) a project

All smart lists, GET /api/tasks, and GET /api/tasks/by-tag/{tag} accept optional ?limit=<int>&offset=<int> query params. Pagination is opt-in: omit both to fetch the complete result set in a single response, which is the recommended path for agents and scripts that need every task. To page through a very large list, increment offset by limit and stop when the returned array is shorter than limit.

Tags

GET    /api/tags            # List all tags
POST   /api/tags            # Create a tag
PATCH  /api/tags/{uuid}     # Update a tag
DELETE /api/tags/{uuid}     # Delete a tag
GET    /api/tasks/by-tag/{tag}  # List tasks by tag UUID or name (?include_descendants=true&limit=&offset=)

Tasks now include a tags field in all responses. Pass tags: ["uuid-or-name", ...] when creating or updating tasks.

Areas

GET    /api/areas           # List all areas

Sync

GET    /api/sync/status     # Current sync state (status, head index, last sync time, errors)
POST   /api/sync            # Manually trigger a full pull + push cycle (rate limited; overlap protected by lock)

Health

GET    /health              # Liveness check (no auth required)
GET    /ready               # Readiness check (DB + sync degradation/circuit state)
GET    /metrics             # Prometheus-compatible counters (disabled by default, set ENABLE_METRICS=true)

Create a task

curl -X POST http://localhost:3117/api/tasks \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"title": "Buy milk", "schedule": 1}'

Update a task

curl -X PATCH http://localhost:3117/api/tasks/{uuid} \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"status": 3}'

Status values: 0 = pending, 2 = cancelled, 3 = completed. Schedule values: 0 = inbox, 1 = anytime, 2 = someday. Type values: 0 = task, 1 = project.

How Sync Works

The sync mechanism mirrors how Things3 itself operates:

Trigger

Behavior

API write (create/update/delete)

Task is flagged for push. Next sync cycle sends it to Things Cloud.

Background interval

Pulls remote changes, then pushes local changes. Configurable via SYNC_INTERVAL_SECONDS.

Manual trigger

POST /api/sync runs an immediate pull + push cycle.

Things Cloud uses an event-sourced model with a monotonically increasing index. Each sync pulls all changes since the last known index and applies them locally. Conflicts are resolved with remote-wins semantics.

Local Development

The repository uses a uv workspace:

  • root package: things-api

  • workspace packages: things-sdk, things-cloud-mcp

# Install both packages in editable mode
uv sync

You can then run the API or import things_sdk directly in local scripts/tests.

Requires Python 3.12+ and uv.

# Install dependencies
uv sync

# Run the dev server
uv run uvicorn things_api.main:app --reload

# Run tests
uv run pytest -v

# Run type checks (current typed foundation)
uv run pyright

# Run migrations
uv run alembic upgrade head

Deploying with Docker

docker compose up -d

The Docker setup uses a named volume (things-data) to persist the SQLite database across container restarts. The docker-compose.yml pulls the published image from ghcr.io/nkootstra/things.

For local development, build from source instead:

docker compose -f docker-compose.dev.yml up -d

For production, put a reverse proxy (Caddy, nginx, Traefik) in front for TLS termination:

                   ┌──────────┐      ┌──────────────┐
  HTTPS :443  ───▶ │  Caddy   │ ───▶ │  Things API  │
                   │  (TLS)   │      │  :8000       │
                   └──────────┘      └──────────────┘

CI / Release smoke checks

The automation now verifies both build artifacts and published artifacts:

  • SDK smoke test: build wheel, install it into a clean virtualenv, import things_sdk, and verify basic engine creation

  • Docker smoke test: build image, boot container, and verify /health, /ready, and authenticated GET /api/tasks

  • Post-release verification: after publication, install things-sdk==<version> from PyPI and pull ghcr.io/nkootstra/things:<version> from GHCR, then run the same basic checks against the published artifacts

This means a green release is not just "built" — it is also verified as installable from PyPI and runnable from GHCR.

Releasing a New Version

Releases are fully automated via GitHub Actions. Pushing a version tag triggers the pipeline:

preflight (tests) ─┬─▶ build (Docker image) ─▶ release (GitHub release)
                   ├─▶ publish-sdk (PyPI)
                   └─▶ verify-published-artifacts

To release:

./scripts/release.sh 0.2.1

The script will:

  1. update versions in both pyproject.toml files

  2. run uv sync --dev

  3. run the full test suite

  4. commit release: vX.Y.Z

  5. create tag vX.Y.Z

  6. push the commit and tag

Useful flags:

./scripts/release.sh 0.2.1 --no-push
./scripts/release.sh 0.2.1 --skip-tests

Manual fallback:

git add pyproject.toml packages/things-sdk/pyproject.toml
git commit -m "release: v0.2.1"
git tag v0.2.1
git push && git push --tags

This will:

  • Run all tests (preflight gate)

  • Build and push the Docker image to ghcr.io/nkootstra/things with tags 0.2.0, 0.2, and latest

  • Publish things-sdk to PyPI

  • Create a GitHub release with auto-generated release notes

Note: PyPI publishing uses trusted publishers. You must configure the GitHub Actions publisher for things-sdk on PyPI before the first publish.

Project Structure

This project is a monorepo with two packages:

Package

Path

Description

things-sdk

packages/things-sdk/

Reusable core library — models, cloud client, sync engine, task operations

things-api

root

FastAPI HTTP service built on top of the SDK

things-cloud-mcp

packages/things-mcp/

MCP server for AI agents (Claude, Codex, etc.)

You can use them together (run the API) or install only the SDK for scripts, CLIs, or other integrations.

SDK standalone usage

from things_sdk import ThingsClient, TaskService, configure_sync, create_engine_and_session, init_db, pull_sync

engine, session_factory = create_engine_and_session("sqlite+aiosqlite:///data/things.db")
await init_db(engine)
configure_sync(my_config)

client = ThingsClient(email="...", password="...")
async with session_factory() as session:
    await pull_sync(client, session)
    tasks = await TaskService().list_tasks(session)
await client.close()

See packages/things-sdk/README.md for full SDK documentation.

Directory layout

packages/things-sdk/src/things_sdk/   # SDK (reusable core)
├── __init__.py              # Public API exports
├── protocols.py             # CloudClientProtocol, SyncConfig
├── tasks.py                 # TaskService (CRUD + smart lists)
├── tags.py                  # TagService (CRUD + hierarchy resolution)
├── cloud/
│   ├── client.py            # ThingsCloudClient
│   ├── handlers.py          # Entity handler strategy pattern
│   ├── schema.py            # Wire format Pydantic models
│   └── sync.py              # Sync engine + circuit breaker
└── db/
    ├── engine.py            # Engine factory
    └── models.py            # Domain models (Task, Tag, TaskTag, Area, etc.)

src/things_api/                       # API (HTTP adapter)
├── main.py                  # FastAPI app, lifespan, scheduler
├── config.py                # pydantic-settings configuration
├── auth.py                  # API key authentication
├── api/
│   └── routes.py            # HTTP endpoints (tasks, smart lists, tags)
├── cloud/
│   └── scheduler.py         # Background sync loop
└── services/
    ├── contracts.py          # API-layer service protocols
    ├── health_service.py     # Readiness checks
    ├── sync_service.py       # Manual sync orchestration
    ├── task_service.py       # Re-exports SDK TaskService
    ├── tag_service.py        # Re-exports SDK TagService
    ├── task_command_mapper.py# Request DTO mapping
    ├── scheduler_leadership.py # Distributed lock
    └── scheduler_runtime.py  # Scheduler lifecycle

packages/things-mcp/src/things_mcp/   # MCP server
├── __init__.py              # Entry point
├── server.py                # FastMCP tools (22 tools)
├── client.py                # HTTP client for things-api
└── __main__.py              # python -m things_mcp

Available Tools

32 tools
add_checklist_itemB

Add a checklist item (sub-task) to a task.

Args: task_uuid: UUID of the parent task. title: Checklist item text.

Inputs: task_uuid (required), title (required). Returns: result

assign_tagsA

Replace the tags on a task.

Args: uuid: Task UUID. tags: List of tag UUIDs or names. Pass empty list to remove all tags.

Inputs: uuid (required), tags (required). Returns: result

cancel_taskC

Cancel a task (mark as cancelled, not deleted).

Args: uuid: Task UUID.

Inputs: uuid (required). Returns: result

complete_checklist_itemC

Check off a checklist item.

Args: uuid: Checklist item UUID.

Inputs: uuid (required). Returns: result

complete_projectC

Mark a project as completed.

Args: uuid: Project UUID.

Inputs: uuid (required). Returns: result

complete_taskC

Mark a task as completed.

Args: uuid: Task UUID.

Inputs: uuid (required). Returns: result

create_projectB

Create a new project. Projects are multi-step tasks that hold sub-tasks.

Args: title: Project title (required). notes: Optional notes/description. schedule: 'inbox', 'anytime' (default), or 'someday'. area_uuid: Optional area to assign the project to. deadline: Unix timestamp deadline. start_date: Unix timestamp for the project's start date. tags: Optional list of tag UUIDs or names.

Inputs: title (required), notes, schedule, area_uuid, +3 more. Returns: result

create_tagB

Create a new tag.

Args: title: Tag name. parent: Optional parent tag UUID or name for hierarchy (e.g., creates 'errands' under 'work'). shortcut: Optional single-character keyboard shortcut.

Inputs: title (required), parent, shortcut. Returns: result

create_taskA

Create a new task in Things3.

Args: title: Task title (required). notes: Optional notes/description. schedule: One of 'inbox', 'anytime', or 'someday'. Default: 'inbox'. tags: Optional list of tag UUIDs or names to assign. project_uuid: UUID of the project to add this task to. area_uuid: UUID of the area to assign this task to. deadline: Unix timestamp for the deadline. start_date: Unix timestamp for the start date (schedules for a specific day). evening: If True, schedule for 'This Evening' instead of morning.

Inputs: title (required), notes, schedule, tags, +5 more. Returns: result

delete_projectA

Move a project to the trash.

Args: uuid: Project UUID.

Inputs: uuid (required). Returns: result

delete_taskC

Move a task to the trash.

Args: uuid: Task UUID.

Inputs: uuid (required). Returns: result

get_taskA

Get a single task by its UUID. Returns full task details including tags.

Inputs: uuid (required). Returns: result

list_all_tasksA

List every non-trashed task across the entire library.

Returns all tasks regardless of schedule, area, or project. By default fetches the full set in a single request — agents that need every task should call this without limit and offset. To page through a very large library, increment offset by limit until the response is shorter than limit.

Args: limit: Optional max number of tasks. Omit to fetch all tasks. offset: Optional pagination offset.

Inputs: limit, offset. Returns: result

list_anytimeA

List tasks in the Anytime list — available to work on, no specific date.

Anytime = schedule is 'anytime', not completed, not trashed.

Inputs: limit, offset. Returns: result

list_areasB

List all areas. Areas are high-level life categories (e.g., Work, Personal).

Inputs: no named parameters. Returns: result

list_inboxA

List tasks in the Inbox — tasks not yet scheduled or assigned to a list.

Inbox = schedule is 'inbox', not completed, not trashed.

Inputs: limit, offset. Returns: result

list_logbookA

List completed tasks from the Logbook.

Shows tasks completed within the last since_days days (default 30). Ordered by completion date, newest first.

Inputs: since_days, limit. Returns: result

list_projectsA

List all projects. Projects are multi-step tasks that contain sub-tasks.

Args: include_completed: If True, also include completed/cancelled projects. Default False (active projects only). limit: Optional max number of projects. offset: Optional pagination offset.

Inputs: include_completed, limit, offset. Returns: result

list_somedayA

List tasks in the Someday list — ideas and tasks without urgency.

Someday = schedule is 'someday', not completed, not trashed.

Inputs: limit, offset. Returns: result

list_tagsA

List all tags. Tags can be hierarchical (e.g., work/errands).

Inputs: no named parameters. Returns: result

list_tasks_by_tagA

List tasks with a specific tag.

Args: tag: Tag UUID or name (e.g., 'work' or 'work/errands'). include_descendants: If True (default), also matches child tags. limit: Optional max number of tasks to return. Omit to fetch every matching task in one call (typical for agent workflows). offset: Optional pagination offset. Page by setting offset += limit until the response is shorter than limit.

Inputs: tag (required), include_descendants, limit, offset. Returns: result

list_todayB

List tasks scheduled for today or earlier that aren't completed.

Today = start date is today or before, not completed, not trashed. Ordered by today_index then index.

Inputs: limit, offset. Returns: result

list_trashB

List trashed tasks. Ordered by modification date, newest first.

Inputs: limit. Returns: result

list_upcomingA

List tasks scheduled for a future date.

Upcoming = start date is after today, not completed, not trashed. Ordered by start date, then deadline.

Inputs: limit, offset. Returns: result

move_to_projectC

Move a task into a project.

Args: uuid: Task UUID. project_uuid: Target project UUID.

Inputs: uuid (required), project_uuid (required). Returns: result

schedule_taskA

Schedule a task for today, anytime, someday, or a specific date.

Args: uuid: Task UUID. schedule: 'inbox', 'anytime', or 'someday'. start_date: Optional Unix timestamp to schedule for a specific day. evening: If True, schedule for "This Evening" instead of morning.

Inputs: uuid (required), schedule (required), start_date, evening. Returns: result

search_advancedA

Multi-predicate search. Every filter is optional and AND-combined.

Use this for GTD reviews ("what's overdue?"), area sweeps, or finding tasks modified recently.

Args: status: 'pending', 'cancelled', or 'completed'. type: 'task', 'project', or 'heading'. schedule: 'inbox', 'anytime', or 'someday'. area_uuid: Filter by area. project_uuid: Filter by parent project. tag: Tag UUID or name to filter by. include_descendants: When tag is set, also match descendant tags. start_date_from, start_date_to: Unix-timestamp range for start date. deadline_from, deadline_to: Unix-timestamp range for deadline. modified_since: Only tasks modified at or after this timestamp. completed_since: Only tasks completed at or after this timestamp. include_trashed: If True, also include trashed tasks. limit: Optional max number of tasks. offset: Optional pagination offset.

Inputs: status, type, schedule, area_uuid, +12 more. Returns: result

search_tasksA

Full-text search across task titles, notes, and checklist items.

Case-insensitive substring match. Trashed tasks are excluded by default.

Args: query: Search string. Returns empty list when blank. include_trashed: If True, also search trashed tasks. include_checklists: If True (default), also match tasks whose checklist items contain the query. limit: Optional max number of tasks. offset: Optional pagination offset.

Inputs: query (required), include_trashed, include_checklists, limit, +1 more. Returns: result

trigger_syncA

Trigger a full pull + push sync with Things Cloud.

Call this after making changes so they appear on all your devices.

Inputs: no named parameters. Returns: result

uncomplete_checklist_itemC

Uncheck a checklist item.

Args: uuid: Checklist item UUID.

Inputs: uuid (required). Returns: result

update_projectB

Update a project's fields. Only provided fields are changed.

Args: uuid: Project UUID (required). title: New title. notes: New notes. schedule: 'inbox', 'anytime', or 'someday'. area_uuid: Move the project to this area. deadline: New deadline (Unix timestamp). start_date: New start date (Unix timestamp). tags: New tag list (replaces existing tags).

Inputs: uuid (required), title, notes, schedule, +4 more. Returns: result

update_taskA

Update an existing task. Only provided fields are changed.

Args: uuid: Task UUID (required). title: New title. notes: New notes. schedule: 'inbox', 'anytime', or 'someday'. tags: New tag list (replaces existing tags). project_uuid: Move to this project. area_uuid: Assign to this area. deadline: New deadline (Unix timestamp). start_date: New start date (Unix timestamp).

Inputs: uuid (required), title, notes, schedule, +5 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 32 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose: create, update, delete, complete, cancel, move, list, search, sync, etc. Descriptions are detailed so no two tools are ambiguous.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern (e.g., create_task, list_projects). Minor deviations like 'list_anytime' (verb_adverb) and 'trigger_sync' (verb) are present but not confusing.

    Tool Count2/5

    32 tools is excessive for a task management API. While the domain is comprehensive, this count exceeds the 'heavy' range and may overwhelm agents.

    Completeness4/5

    Covers almost all lifecycle operations for tasks, projects, tags, and checklist items. Missing create/update/delete for areas and headings, but most workflows are supported.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers