POST /api/deep-work/projects/{project_id}/cancel Bearer

Cancel Deep Work Project

Cancel a running or paused Deep Work project. Stops all executing tasks, marks remaining tasks as skipped, and sets the project to a terminal cancelled state.

Overview

Cancels a Deep Work project. All currently executing tasks are stopped, all pending tasks are marked as SKIPPED, and the project moves to CANCELLED status. Tasks that already completed keep their DONE status — finished work isn’t lost.

Cancellation is a terminal state. Once cancelled, the project can’t be resumed or re-approved.

Path Parameters

project_id string

The ID of the project to cancel. The project must exist and not already be in COMPLETED or CANCELLED status.

Response

success boolean

Whether the project was cancelled.

project object

The updated project object with status: "cancelled" and a completed_at timestamp.

Terminal window
curl -X POST http://localhost:8000/api/deep-work/projects/PROJECT_ID/cancel \
-H "Authorization: Bearer YOUR_TOKEN"
const res = await fetch(
'http://localhost:8000/api/deep-work/projects/PROJECT_ID/cancel',
{
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
}
);
const data = await res.json();
import httpx
res = httpx.post(
"http://localhost:8000/api/deep-work/projects/PROJECT_ID/cancel",
headers={"Authorization": "Bearer YOUR_TOKEN"},
)
data = res.json()
{
"success": true,
"project": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"title": "Build a REST API for recipe management",
"status": "cancelled",
"completed_at": "2024-01-15T16:30:00Z",
"task_ids": ["task-1", "task-2", "task-3"],
"team_agent_ids": ["agent-1"]
}
}
{
"detail": "Cannot cancel project with status 'completed'"
}
Request
curl -X POST "http://localhost:8000/api/deep-work/projects/{project_id}/cancel" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>"
const response = await fetch("http://localhost:8000/api/deep-work/projects/{project_id}/cancel", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
},
});

const data = await response.json();
console.log(data);
import requests

response = requests.post(
    "http://localhost:8000/api/deep-work/projects/{project_id}/cancel",
    headers={'Content-Type':'application/json','Authorization':'Bearer <token>'},
)

print(response.json())
package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {
    req, _ := http.NewRequest("POST", "http://localhost:8000/api/deep-work/projects/{project_id}/cancel", nil)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer <token>")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
Response
Send a request to see the response