Skip to main content
POST
/
v1
/
tasks
/
{task_id}
/
cancel
Cancel Task
curl --request POST \
  --url https://www.qingbo.dev/v1/tasks/{task_id}/cancel
import requests

url = "https://www.qingbo.dev/v1/tasks/{task_id}/cancel"

response = requests.post(url)

print(response.text)
const options = {method: 'POST'};

fetch('https://www.qingbo.dev/v1/tasks/{task_id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

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

func main() {

url := "https://www.qingbo.dev/v1/tasks/{task_id}/cancel"

req, _ := http.NewRequest("POST", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://www.qingbo.dev/v1/tasks/{task_id}/cancel")
.asString();
Cancel a task in the queued state. Quota is automatically refunded.
Only tasks in the queued state can be cancelled. Tasks in processing have already started and cannot be cancelled — the endpoint returns HTTP 400 (code: task_not_cancellable). Queue turnaround is measured in seconds, so the cancellation window is small; callers should handle the 400 case. A cancelled task reports cost: 0 when queried (quota refunded).

Response

{
  "task_id": "task_xxx",
  "status": "cancelled",
  "refunded": true,
  "refunded_quota": 50000
}
FieldDescription
refundedWhether the quota was refunded
refunded_quotaAmount of quota refunded