Skip to main content
POST
/
tasks
/
{taskIdOrSlug}
/
cancel
Cancel task
curl --request POST \
  --url https://twill.ai/api/v1/tasks/{taskIdOrSlug}/cancel \
  --header 'Authorization: Bearer <token>'
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

fetch('https://twill.ai/api/v1/tasks/{taskIdOrSlug}/cancel', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
import requests

url = "https://twill.ai/api/v1/tasks/{taskIdOrSlug}/cancel"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.text)
{
  "success": true,
  "task": {
    "id": "<string>"
  }
}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key"
  }
}
{
  "error": {
    "code": "not_found",
    "message": "Task not found"
  }
}
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded. Max 100 requests per minute."
  }
}
{
  "error": {
    "code": "internal_error",
    "message": "Server error"
  }
}
Marks the task CANCELLED and stops in-flight jobs. You can still follow up afterwards to resume work on the same thread.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

taskIdOrSlug
string
required

Response

Task cancelled

success
boolean
required
task
object
required