# 刷新Runner连接凭据

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

使用agent_runner.manage权限，撤销旧JTI并更新当前绑定，返回新的connect_cmd；保持Runner和Edge ID。它与Edge持有者自动renew是不同接口，不承诺重复请求返回同一token。


```http
POST https://api.moi.matrixorigin.cn/v5/agent-runners/{id}/refresh-token
```

## 调用前准备

`BASE_URL` 使用产品 API 前缀 `https://api.moi.matrixorigin.cn/v5`；专有部署填写对应的产品 API 地址。

[准备身份和标识](objects.md#prepare)。

## 请求

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} 输入示例

```bash
curl --request POST \
  "$BASE_URL/agent-runners/$RUNNER_ID/refresh-token" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} 参数说明

| 参数 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `X-Workspace-ID` | 请求头 | string | 是 | 同环境目标工作区；路径中没有工作区段。 |
| `id` | 路径 | string | 是 | 同工作区可访问的Runner ID，来自创建或列表结果。 |

:::::
::::::
:::::::

## 成功响应

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": "runner-example",
    "workspace_id": "workspace-example",
    "user_id": "user-example",
    "name": "示例Runner",
    "runner_type": "custom",
    "edge_agent_id": "runner-runner-example",
    "phase": "pending",
    "token_expires_at": "2026-12-12T01:00:00Z",
    "created_at": "2026-11-12T01:00:00Z",
    "updated_at": "2026-11-12T01:00:00Z",
    "connect_cmd": "astra-edge --edge-id runner-runner-example --server-url wss://edge.example.invalid --token example-edge-token --reconnect true"
  }
}
```

:::::
:::::{tab-item} 字段说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `code` | string | 成功为OK。 |
| `msg` | string | 响应信息，成功为OK。 |
| `data` | object | [返回对象与省略条件](objects.md#responses)。 |

:::::
::::::
:::::::

## 错误响应

[错误与恢复边界](lifecycle.md#errors)区分Runner、Edge续期及计算观测；不共用同一数值错误表。
