# 跟踪排队中的操作

[Orbito Ads · 简体中文 · HTML](https://orbitoads.pro/zh/docs/api/tasks/)

来源核对日期 · 2026-11-27

### 浏览文档



[全部文档](/zh/docs/) 
快速入门

- [API 快速入门](/zh/docs/api/)
- [密钥与账户权限](/zh/docs/api/authentication/)
- [将 API 文档交给 AI 助手](/zh/docs/api/ai-assistants/)

基础概念

- [解读 API 错误](/zh/docs/api/errors/)
- [请求和事件限额](/zh/docs/api/rate-limits/)
- [安全重试同一操作](/zh/docs/api/idempotency/)
- [跟踪排队中的操作](/zh/docs/api/tasks/)
- [逐页读取广告活动](/zh/docs/api/pagination/)

API 参考

- [可访问的广告账户](/zh/docs/api/accounts/)
- [查询广告活动](/zh/docs/api/campaigns/)
- [创建广告活动与上传媒体](/zh/docs/api/create-campaigns/)
- [修改现有广告活动](/zh/docs/api/manage-campaigns/)
- [广告活动与账户统计](/zh/docs/api/stats/)
- [定向词典与群组](/zh/docs/api/targeting/)

集成

- [接收广告活动事件](/zh/docs/api/webhooks/)
- [发送已确认的转化](/zh/docs/api/conversions/)
- [API 版本与更新](/zh/docs/api/changelog/)

文件与架构

- [OpenAPI · YAML](/docs/api/openapi.yaml)
- [OpenAPI · JSON](/docs/api/openapi.json)
- [llms.txt](/zh/docs/llms.txt)
- [llms-full.txt](/zh/docs/llms-full.txt)



[全部文档](/zh/docs/) 
快速入门

- [API 快速入门](/zh/docs/api/)
- [密钥与账户权限](/zh/docs/api/authentication/)
- [将 API 文档交给 AI 助手](/zh/docs/api/ai-assistants/)

基础概念

- [解读 API 错误](/zh/docs/api/errors/)
- [请求和事件限额](/zh/docs/api/rate-limits/)
- [安全重试同一操作](/zh/docs/api/idempotency/)
- [跟踪排队中的操作](/zh/docs/api/tasks/)
- [逐页读取广告活动](/zh/docs/api/pagination/)

API 参考

- [可访问的广告账户](/zh/docs/api/accounts/)
- [查询广告活动](/zh/docs/api/campaigns/)
- [创建广告活动与上传媒体](/zh/docs/api/create-campaigns/)
- [修改现有广告活动](/zh/docs/api/manage-campaigns/)
- [广告活动与账户统计](/zh/docs/api/stats/)
- [定向词典与群组](/zh/docs/api/targeting/)

集成

- [接收广告活动事件](/zh/docs/api/webhooks/)
- [发送已确认的转化](/zh/docs/api/conversions/)
- [API 版本与更新](/zh/docs/api/changelog/)

文件与架构

- [OpenAPI · YAML](/docs/api/openapi.yaml)
- [OpenAPI · JSON](/docs/api/openapi.json)
- [llms.txt](/zh/docs/llms.txt)
- [llms-full.txt](/zh/docs/llms-full.txt)



[Orbito Ads](/zh/) [文档](/zh/docs/) [API](/zh/docs/api/)



创建、复制和批量修改可能返回 HTTP 202 与任务 ID。轮询任务查看进度、汇总和单项失败，保存最终受影响的活动编号以便核对。


[Markdown](/zh/docs/api/tasks.md)



有些行动每次行动一次会与Telegram谈话,所以它们需要比HTTP请求更长的时间等待。这些返回的`202 Accepted`是**任务** ,而不是最后的结果:



- `POST /v1/campaigns` — 创建
- `POST /v1/campaigns/{ad_id}/copy` — 副本
- `POST /v1/campaigns/bulk` — 暂停、 恢复、 预算、 CPM 或删除许多



单场阵容变化(`PATCH`,暂停,恢复,预算,删除)直接回答——没有任务.



## HTTP 202 响应

示例

```
HTTP/1.1 202 Accepted
Location: /api/v1/tasks/81234
Retry-After: 2
```

示例

```
{
  "success": true,
  "data": {
    "id": 81234,
    "type": "create",
    "status": "pending",
    "account_id": 53,
    "progress": 0,
    "total": 3,
    "succeeded": null,
    "failed": null,
    "ad_ids": [],
    "errors": [],
    "paused_reason": null,
    "error": null,
    "created_at": "2026-10-08T10:15:02.411Z",
    "started_at": null,
    "completed_at": null
  }
}
```



## GET /v1/tasks/{id}

示例

```
curl -s https://orbitoads.pro/api/v1/tasks/81234 -H "X-API-Key: $ORBITO_API_KEY"
```


和上面的形状一样,在`status`成为最终任务之前,输入它;虽然一个任务是`pending`或`running`,但答复中包含`Retry-After: 2`——在民调之间等待了那么长的时间,任何同一个主人的钥匙都可以读取这个任务.


| 田野 | 意义 |
| --- | --- |
| `type` | `create`、`copy`、`status`(暂停/复发)、`budget`、`cpm`、`delete` |
| `status` | 下面看 |
| `progress` / `total` | 迄今处理的宣传活动/总数 |
| `succeeded` / `failed` | 数,一旦知道 |
| `ad_ids` | 运动任务创建( 创建、 复制) 或更改( 块) |
| `errors[]` | 最多50个失败: `{ ad_id, index, error }` - `index` 是您`campaigns`阵列中用于创建的位置 。 |
| `paused_reason` | e.g. 内阁没有平衡 |
| `error` | 整个任务为何失败 |


### 状态


| 状态 | 意义 | 最终? |
| --- | --- | --- |
| `pending` | 已排队 —— 内阁每次运行一个创建和另一个操作 | 无 |
| `running` | 进展中 | 无 |
| `paused` | 停止等待 — 通常内阁的平衡在中途就耗尽。 将内阁顶上; 从面板上恢复 | 无 |
| `completed` | 完成。 请检查 `failed` 和 `errors` – 完成的任务可以包含单个失败 。 | 是的 |
| `failed` | 整个任务失败——见`error` | 是的 |
| `cancelled` | 从面板上取消 | 是的 |



## 广告活动创建如何完成



- 新广告活动代号出现在`ad_ids`年任务完成后(在上届广告活动成立后通过内阁同步找到).
- 如果一个批次的**第一** 运动失败,任务就停止在那里,而不是重复同样的错误100次. 修正输入并再次发送.
- 如果Telegram无法解决任何一个活动的频道或机器人,则该活动将失败。 `No targets found: …` 列出他们。
- Telegram评论了每一个新广告。一个创建的广告活动通常开始`In Review`;一个[网页](/zh/docs/api/webhooks/)告诉你,当它改变的时候。



## 轮询状态示例

示例

```
async function waitForTask(id) {
  for (;;) {
    const res = await fetch(`https://orbitoads.pro/api/v1/tasks/${id}`, {
      headers: { 'X-API-Key': process.env.ORBITO_API_KEY },
    });
    const { data } = await res.json();
    if (['completed', 'failed', 'cancelled'].includes(data.status)) return data;
    if (data.status === 'paused') throw new Error(`Task paused: ${data.paused_reason}`);
    await new Promise(r => setTimeout(r, Number(res.headers.get('Retry-After') || 2) * 1000));
  }
}
```

示例

```
import time, requests

def wait_for_task(task_id):
    while True:
        r = requests.get(f"https://orbitoads.pro/api/v1/tasks/{task_id}",
                         headers={"X-API-Key": API_KEY}, timeout=30)
        task = r.json()["data"]
        if task["status"] in ("completed", "failed", "cancelled"):
            return task
        if task["status"] == "paused":
            raise RuntimeError(f"Task paused: {task['paused_reason']}")
        time.sleep(int(r.headers.get("Retry-After", 2)))
```



## API 参考

完整广告接口需要为此工作区单独配置供应商凭据。客户端请求使用自己的 Orbito API 密钥。账户订购、开通和外部账单分别处理。

## GET `/api/v1/tasks/{id}`

读取任务进度、返回的广告 ID 及各项失败信息。

| 参数 | 位置 | 格式 | 必填 |
| --- | --- | --- | --- |
| `id` | path | `integer` | 是 |
| `X-API-Key` | header | `string` | 是 |

cURL

```
curl -X GET https://orbitoads.pro/api/v1/tasks/96203 \
  -H 'X-API-Key: YOUR_ORBITO_KEY'
```

HTTP 200

```
{
  "success": true,
  "data": {
    "id": 96203,
    "type": "create",
    "status": "completed",
    "account_id": 7401,
    "total": 1,
    "ad_ids": [
      38019
    ],
    "progress": 1,
    "succeeded": 1,
    "failed": 0,
    "errors": [],
    "paused_reason": null,
    "error": null,
    "created_at": "2026-11-03T12:01:00Z",
    "started_at": "2026-11-03T12:01:02Z",
    "completed_at": "2026-11-03T12:01:04Z"
  }
}
```



## 实施说明

## 受理与完成

创建、复制和批量操作返回 HTTP 202 及任务 ID。按 Retry-After 轮询 GET /api/v1/tasks/{id}。即使状态为 completed，也要检查 failed 和 errors。



## 任务状态与结果

pending、running、paused 是非终态；completed、failed、cancelled 表示结束。查看 progress、total、ad_ids 及最多 50 条单项错误。paused_reason 可说明需在面板处理的预算不足。



## 操作与字段

GET /api/v1/tasks/{id} pending running paused completed failed cancelled succeeded failed errors



- GET /api/v1/tasks/{id}
- pending
- running
- paused
- completed
- failed
- cancelled
- succeeded
- failed
- errors



## 请求示例

GET /api/v1/tasks/{id} HTTP/1.1 Host: orbitoads.pro X-API-Key: {key}



## 结构字段与限制

本表依据公开的 v1 契约。参数与字段名称区分大小写。各操作的 HTTP 状态码分别表示成功、输入校验和访问检查。链接规范给出了完整的请求与响应结构。



## 报告维度

API 的单次创建请求最多 100 项活动，单次复制最多 100 份，单次批量操作最多处理 1,000 项已有活动。202 响应指向排队任务。修改下一组之前，先检查完成任务的 failed 与 errors。



## 协议参考

| 方法 | 路径 | 参数 | 请求内容 | 响应码 |
| --- | --- | --- | --- | --- |
| GET | /api/v1/tasks/{id} | id | — | 200, 400, 401, 404 |
| POST | /api/v1/campaigns | Idempotency-Key | application/json · CreateSingleRequest \| CreateBatchRequest | 202, 400, 401, 403, 404, 409, 422, 429, 503 |
| POST | /api/v1/campaigns/bulk | Idempotency-Key | application/json · BulkRequest | 202, 400, 401, 403, 404, 409, 422, 429 |
| POST | /api/v1/campaigns/{ad_id}/copy | ad_id, account_id, Idempotency-Key | application/json · CopyRequest | 202, 400, 401, 403, 404, 409, 422, 429 |


来源 · [数据来源](https://adsly.pro/docs/api/openapi.yaml)

## 结构字段与限制 · 跟踪排队中的操作

| 字段 | 文档取值 |
| --- | --- |
| HTTP 202 | Location, Retry-After |
| status | pending, running, paused, completed, failed, cancelled |
| progress / total | integer / integer |
| succeeded / failed | integer \| null |
| errors[] | ≤ 50 |
| ad_ids[] | integer |


来源 · [数据来源](https://adsly.pro/docs/api/tasks/)

## Task

| 字段 | 字段类型 |
| --- | --- |
| id | integer |
| type | create \| copy \| status \| budget \| cpm \| delete \| edit \| recreate |
| status | pending \| running \| paused \| completed \| failed \| cancelled |
| account_id | integer |
| progress | integer |
| total | integer |
| succeeded | integer \| null |
| failed | integer \| null |
| ad_ids | array · [integer] |
| errors | array · [object] · 0 … 50 |
| paused_reason | string \| null |
| error | string \| null |
| created_at | string · date-time |
| started_at | string \| null · date-time |
| completed_at | string \| null · date-time |


来源 · [数据来源](https://adsly.pro/docs/api/openapi.yaml)



## 相关阅读

[解读 API 错误](/zh/docs/api/errors/)[请求和事件限额](/zh/docs/api/rate-limits/)[安全重试同一操作](/zh/docs/api/idempotency/)[逐页读取广告活动](/zh/docs/api/pagination/)



参考资料更新日期 2026-10-08



[上一主题**安全重试同一操作**](/zh/docs/api/idempotency/)[下一主题**逐页读取广告活动**](/zh/docs/api/pagination/)

## 来源与数据

- [openapi.yaml](https://orbitoads.pro/docs/api/openapi.yaml)
- [openapi.json](https://orbitoads.pro/docs/api/openapi.json)
