Cancel a Task
POST https://maxaeo.ai/geoapi/geodata/developer/task/cancelCancels a task that is still waiting in the queue. A canceled task has status canceled, isn’t charged, and its reserved credits are released.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
task_id |
string | Yes | The task ID returned by Submit a task or List tasks, up to 64 characters |
The body has task_id only; any extra field returns 1001.
Which tasks you can act on: the same as Retrieve a task — every task the same user submitted in their personal account, no matter which API key was used or whether it was submitted from the Playground in the Developer Console.
Request examples
Section titled “Request examples”curl -X POST "https://maxaeo.ai/geoapi/geodata/developer/task/cancel" \ -H "Authorization: Bearer $MAXAEO_API_KEY" \ -H "Content-Type: application/json" \ -d '{"task_id": "task_3f6c1d2e-8a4b-4c1f-9e2d-7b5a0c9d1e23"}'import os
import requests
URL = "https://maxaeo.ai/geoapi/geodata/developer/task/cancel"HEADERS = {"Authorization": f"Bearer {os.environ['MAXAEO_API_KEY']}"}
data = requests.post( URL, headers=HEADERS, json={"task_id": "task_3f6c1d2e-8a4b-4c1f-9e2d-7b5a0c9d1e23"}, timeout=30).json()if data["ret"] != 1: raise RuntimeError(f"ret={data['ret']}: {data['msg']}")
task = data["data"]["ent"]if task["status"] == "canceled": print("Canceled")else: print("Not canceled; current status:", task["status"])const URL = "https://maxaeo.ai/geoapi/geodata/developer/task/cancel";const headers = { Authorization: `Bearer ${process.env.MAXAEO_API_KEY}`, "Content-Type": "application/json",};
const resp = await fetch(URL, { method: "POST", headers, body: JSON.stringify({ task_id: "task_3f6c1d2e-8a4b-4c1f-9e2d-7b5a0c9d1e23" }),});const data = await resp.json();if (data.ret !== 1) throw new Error(`ret=${data.ret}: ${data.msg}`);
const task = data.data.ent;console.log(task.status === "canceled" ? "Canceled" : `Not canceled; current status: ${task.status}`);Response
Section titled “Response”data.ent is the task object, the same structure as Retrieve a task. Read status to see what happened:
status |
Meaning | Credits |
|---|---|---|
canceled |
The cancel worked | Not charged; reserved credits are released |
running |
The task had already started, so it was not canceled and finishes as usual | Charged as usual if it succeeds |
succeeded / failed |
The task had already finished, so nothing was canceled | As per the task’s own result |
- A
queuedorpendingtask can be canceled. - A
dispatchingtask (being handed over) may not be cancelable for a moment; it is returned unchanged, so call again shortly. In rare cases apendingtask behaves the same way. Anystatusother thancanceledmeans the task wasn’t canceled. - A cancel that doesn’t take effect isn’t an error —
retis still1, so always checkstatus. - Repeated calls don’t error; it’s safe to call again.
Example response for a successful cancel:
{ "ret": 1, "data": { "ent": { "thinking": false, "task_id": "task_3f6c1d2e-8a4b-4c1f-9e2d-7b5a0c9d1e23", "platform": "doubao", "query": "适合程序员的机械键盘推荐", "status": "canceled", "answer": "", "result_json": "", "share_link": "", "error_code": "crawl_canceled", "error_message": "任务已取消", "started_at": 0, "finished_at": 1793018460, "created_at": 1793018425, "updated_at": 1793018460, "monitor_date": "2026-10-26", "priority": 2, "country": "", "credits": 0 } }}A canceled task has error_code crawl_canceled, a plain-text error_message (任务已取消, Chinese for “task canceled”), and credits of 0.
A canceled task can’t be retried — calling retry on it returns it unchanged, still canceled. To run it again, submit a new task, which gets a new task_id (task IDs are generated by the server and can’t be chosen).
Errors
Section titled “Errors”ret |
Cause |
|---|---|
1001 |
task_id is missing or longer than 64 characters, or the body contains undefined fields |
1030 |
API key missing or invalid |
1031 |
The task doesn’t exist or doesn’t belong to the current user |
-1 |
Service temporarily unavailable — the task is left unchanged, so you can call again |
Related pages
Section titled “Related pages”- Task Lifecycle: statuses, and the rules for canceling and retrying
- Retry a task: retry a task whose crawl failed
- The task object: every field
- Error Handling: every error code
