{"openapi":"3.1.0","info":{"title":"Timer API","version":"1.0.0","description":"Time tracking and fees. Auth: `Authorization: Bearer nst_...` (create tokens in the app settings). Money values are in the user's currency units; durations in seconds; times ISO 8601."},"servers":[{"url":"/api/v1"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"security":[{"bearer":[]}],"paths":{"/me":{"get":{"summary":"Current user and settings (hourly_rate, currency, timezone)","responses":{"200":{"description":"OK"}}},"patch":{"summary":"Update settings","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"hourly_rate":{"type":"number"},"currency":{"type":"string"},"timezone":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}}},"/projects":{"get":{"summary":"List projects","parameters":[{"name":"archived","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create project; if an active one has the same name (case-insensitive), returns it with existing=true and 200","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"hourly_rate":{"type":["number","null"]},"currency":{"type":["string","null"]}}}}}},"responses":{"201":{"description":"Created"}}}},"/projects/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get project with notes","responses":{"200":{"description":"OK"}}},"patch":{"summary":"Rename, archive, replace notes, set the project's own rate/currency (null = user default) or in_total (false = own project, left out of the month total)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"notes":{"type":"string"},"archived":{"type":"boolean"},"in_total":{"type":"boolean"},"hourly_rate":{"type":["number","null"]},"currency":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete project and its entries","responses":{"200":{"description":"OK"}}}},"/projects/{id}/notes":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"summary":"Append a line to the project notes","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}}},"/timer":{"get":{"summary":"Running timers. Each project has its own; `running` is the given project's (or the latest), `timers` lists all","parameters":[{"name":"project","in":"query","schema":{"type":"string"}},{"name":"project_id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/timer/start":{"post":{"summary":"Start a project's timer (other projects are unaffected). 409 code=timer_running if this project's is running, unless on_running is given","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"project":{"type":"string","description":"Project name (case-insensitive), alternative to project_id"},"note":{"type":"string"},"on_running":{"type":"string","enum":["stop","discard"],"description":"What to do if this project's timer is running and overlaps: stop = end it where this time starts; discard = delete it. Omit to get 409 and leave it alone."}}}}}},"responses":{"201":{"description":"Started"},"409":{"description":"A timer is running (body.running has it)"}}}},"/timer/stop":{"post":{"summary":"Stop a project's timer; optional note replaces its description. Without a project it only works if one timer runs (else 409 code=project_required)","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"project":{"type":"string","description":"Project name (case-insensitive), alternative to project_id"},"note":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}}},"/entries":{"get":{"summary":"List time entries of a month","parameters":[{"name":"month","in":"query","schema":{"type":"string","example":"2026-11"},"description":"YYYY-MM in the user's timezone; default current month"},{"name":"project_id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Log time after the fact (give ended_at or minutes)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["started_at"],"properties":{"project_id":{"type":"string"},"project":{"type":"string","description":"Project name (case-insensitive), alternative to project_id"},"started_at":{"type":"string","format":"date-time"},"ended_at":{"type":"string","format":"date-time"},"minutes":{"type":"number"},"note":{"type":"string"},"on_running":{"type":"string","enum":["stop","discard"],"description":"What to do if this project's timer is running and overlaps: stop = end it where this time starts; discard = delete it. Omit to get 409 and leave it alone."}}}}}},"responses":{"201":{"description":"Created"},"409":{"description":"code=timer_running: overlaps the running timer (body.running). code=overlap: overlaps a logged period of the same project (body.conflicts); nothing saved"}}}},"/entries/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Edit entry, including the running one's note (409 code=overlap if the new times overlap another period)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"started_at":{"type":"string"},"ended_at":{"type":"string"},"note":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete entry","responses":{"200":{"description":"OK"}}}},"/summary":{"get":{"summary":"Seconds and fees per project for a month; totals and total_seconds are grouped by currency and only include projects with in_total","parameters":[{"name":"month","in":"query","schema":{"type":"string","example":"2026-11"},"description":"YYYY-MM in the user's timezone; default current month"}],"responses":{"200":{"description":"OK"}}}}}}