7979 schema : { type: string, format: date-time }
8080 - name : source
8181 in : query
82- schema : { type: string, enum: [web, cli, api, agent] }
82+ schema : { type: string, enum: [web, cli, api, agent, calendar, desktop ] }
8383 description : Filter by entry source. Comma-separated for multiple (e.g. `agent,cli`).
8484 responses :
8585 " 200 " :
@@ -118,6 +118,12 @@ paths:
118118 " 401 " : { $ref: "#/components/responses/Unauthorized" }
119119 " 403 " : { $ref: "#/components/responses/Forbidden" }
120120 " 404 " : { $ref: "#/components/responses/NotFound" }
121+ " 409 " :
122+ description : Conflict — another timer is already running
123+ content :
124+ application/json :
125+ schema :
126+ $ref : " #/components/schemas/Error"
121127
122128 /api/v2/time_entries/{id} :
123129 parameters :
@@ -169,6 +175,72 @@ paths:
169175 schema :
170176 $ref : " #/components/schemas/Error"
171177
178+ /api/v2/time_entries/{id}/stop :
179+ parameters :
180+ - name : id
181+ in : path
182+ required : true
183+ schema : { type: string }
184+ description : Time entry CUID
185+
186+ patch :
187+ tags : [Time Entries]
188+ summary : Stop a running time entry
189+ operationId : stopTimeEntry
190+ description : Stops a running timer and calculates elapsed duration server-side.
191+ requestBody :
192+ required : false
193+ content :
194+ application/json :
195+ schema :
196+ $ref : " #/components/schemas/TimeEntryStop"
197+ responses :
198+ " 200 " :
199+ description : Stopped time entry
200+ content :
201+ application/json :
202+ schema :
203+ $ref : " #/components/schemas/TimeEntry"
204+ " 400 " : { $ref: "#/components/responses/BadRequest" }
205+ " 403 " : { $ref: "#/components/responses/Forbidden" }
206+ " 404 " : { $ref: "#/components/responses/NotFound" }
207+
208+ /api/v2/time_entries/{id}/restart :
209+ parameters :
210+ - name : id
211+ in : path
212+ required : true
213+ schema : { type: string }
214+ description : Time entry CUID
215+
216+ patch :
217+ tags : [Time Entries]
218+ summary : Restart a stopped time entry
219+ operationId : restartTimeEntry
220+ description : Restarts a stopped entry as the active timer. Pass `replace_running` to intentionally switch timers.
221+ requestBody :
222+ required : false
223+ content :
224+ application/json :
225+ schema :
226+ $ref : " #/components/schemas/TimeEntryRestart"
227+ responses :
228+ " 200 " :
229+ description : Restarted time entry
230+ content :
231+ application/json :
232+ schema :
233+ $ref : " #/components/schemas/TimeEntry"
234+ " 400 " : { $ref: "#/components/responses/BadRequest" }
235+ " 403 " : { $ref: "#/components/responses/Forbidden" }
236+ " 404 " : { $ref: "#/components/responses/NotFound" }
237+ " 409 " :
238+ description : Conflict — another timer is already running
239+ content :
240+ application/json :
241+ schema :
242+ $ref : " #/components/schemas/Error"
243+
172244 # ─── EXPENSES ──────────────────────────────────────────────────
173245 /api/v2/expenses :
174246 get :
@@ -720,6 +792,7 @@ components:
720792 # ── Common ─────────────────────────────────────────────────
721793 Error :
722794 type : object
795+ additionalProperties : true
723796 properties :
724797 error :
725798 type : string
@@ -784,7 +857,7 @@ components:
784857 cost_rate : { type: number, nullable: true }
785858 source :
786859 type : string
787- enum : [web, cli, api, agent]
860+ enum : [web, cli, api, agent, calendar, desktop ]
788861 metadata : { $ref: "#/components/schemas/Metadata" }
789862 created_at : { type: string, format: date-time }
790863 updated_at : { type: string, format: date-time }
@@ -801,13 +874,29 @@ components:
801874 notes : { type: string }
802875 billable : { type: boolean }
803876 is_running : { type: boolean }
877+ replace_running :
878+ type : boolean
879+ description : When true with is_running, stop any current running timer before creating this one.
804880 started_time : { type: string, description: "HH:mm" }
805881 ended_time : { type: string, description: "HH:mm" }
806882 source :
807883 type : string
808- enum : [web, cli, api, agent]
884+ enum : [web, cli, api, agent, calendar, desktop ]
809885 metadata : { $ref: "#/components/schemas/Metadata" }
810886
887+ TimeEntryStop :
888+ type : object
889+ properties :
890+ notes :
891+ type : string
892+ nullable : true
893+
894+ TimeEntryRestart :
895+ type : object
896+ properties :
897+ replace_running :
898+ type : boolean
899+
811900 TimeEntryUpdate :
812901 type : object
813902 properties :
0 commit comments