Cancel a running task
April 18, 2025
Table of contents
This endpoint cancels a running API task from being tracked by the scheduler. The task will still be executed by Kling, but the API will no longer track its progress.
https://api.useapi.net/v1/kling/scheduler/
task_id
The task_id
value should be a numeric identifier of the task you want to cancel. You can get task IDs from GET /scheduler.
Request Headers
Authorization: Bearer {API token}
API token
is required, see Setup useapi.net for details.
Responses
-
Task was successfully canceled.
-
{ "error": "Error ..." }
-
{ "error": "Unauthorized", "code": 401 }
-
{ "error": "Unable to locate running task_id 123456789" }
Examples
-
curl -X DELETE "https://api.useapi.net/v1/kling/scheduler/123456789" \ -H "Accept: application/json" \ -H "Authorization: Bearer …"
-
const token = "API token"; const taskId = "123456789"; const apiUrl = `https://api.useapi.net/v1/kling/scheduler/${taskId}`; const response = await fetch(apiUrl, { method: "DELETE", headers: { "Authorization": `Bearer ${token}`, }, }); console.log("response", {status: response.status, statusText: response.statusText});
-
import requests token = "API token" task_id = "123456789" apiUrl = f"https://api.useapi.net/v1/kling/scheduler/{task_id}" headers = { "Authorization" : f"Bearer {token}" } response = requests.delete(apiUrl, headers=headers) print(response.status_code, response.reason)