> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 运行 Schedule

> 手动触发一次 Schedule Run。

`POST /api/v1/forward/schedules/{schedule_id}/run`

立即创建一条 Schedule Run，不改变原有触发策略。接口返回时 Run 记录已创建，但执行不一定完成。

## 请求头

| Header          | 是否必填 | 说明             |
| --------------- | ---- | -------------- |
| Authorization   | 是    | `Bearer <PAT>` |
| Idempotency-Key | 否    | 有副作用请求可选的幂等键。  |

## 路径参数

| 参数           | 类型     | 是否必填 | 说明                   |
| ------------ | ------ | ---- | -------------------- |
| schedule\_id | string | 是    | Forward Schedule ID。 |

## 示例请求

```bash theme={null}
curl -s -X POST 'https://api.qoder.com/api/v1/forward/schedules/sched_019f00112233445566778899aabbccdd/run' \
  -H "Authorization: Bearer $QODER_PAT"
```

## 示例响应

**HTTP 200 OK**

```json theme={null}
{
  "id": "srun_019f00112233445566778899aabbccdd",
  "schedule_id": "sched_019f00112233445566778899aabbccdd",
  "identity_id": "idn_019eabc123",
  "template_id": "tmpl_support",
  "status": "pending",
  "trigger_context": {
    "type": "manual"
  },
  "push_status": "skipped",
  "push_finished_at": "2026-06-22T01:00:21Z",
  "attempt": 1,
  "triggered_at": "2026-06-22T12:00:00Z",
  "created_at": "2026-06-22T12:00:00Z"
}
```

## 响应字段

| 字段  | 类型     | 说明                    |
| --- | ------ | --------------------- |
| 返回值 | object | 创建出的 Schedule Run 对象。 |

## 错误

| HTTP | Type                    | Code                      | 触发条件          |
| ---- | ----------------------- | ------------------------- | ------------- |
| 404  | `not_found_error`       | `schedule_not_found`      | Schedule 不存在。 |
| 409  | `invalid_request_error` | `schedule_archived`       | Schedule 已归档。 |
| 409  | `invalid_request_error` | `schedule_not_active`     | Schedule 已暂停。 |
| 401  | `authentication_error`  | `authentication_required` | PAT 无效或已过期。   |

## 注意事项

* 如果达到 `execution.max_concurrent_runs`，Forward 仍会创建一条 `status=skipped` 的 Run，并返回 `error.type=concurrency_limit_reached`。
* 客户端应轮询 Get Schedule Run，直到 `status` 进入 `completed`、`failed` 或 `skipped`。

## 相关

<CardGroup cols={2}>
  <Card title="获取 Schedule Run" icon="file-lines" href="/cloud-agents/api/forward/schedule-runs/get" />

  <Card title="列出 Schedule Runs" icon="history" href="/cloud-agents/api/forward/schedule-runs/list" />
</CardGroup>
