<span id="刷新runner连接凭据"></span>

# Refresh Runner connection credentials

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

Requires agent_runner.manage. Revokes the old JTI, updates the current binding, and returns a new connect_cmd while retaining Runner/Edge IDs. This differs from Edge holder automatic renew and does not guarantee the same token on repeated calls.


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

<span id="调用前准备"></span>

## Before you call this API

`BASE_URL` uses the product API prefix `https://api.moi.matrixorigin.cn/v5`. For a dedicated deployment, use its corresponding product API address.

[Prepare identity and identifiers](objects.md#prepare).

<span id="请求"></span>

## Request

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```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} Parameters

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Workspace-ID` | Header | string | Yes | Target workspace in the same environment; no workspace segment in the path. |
| `id` | Path | string | Yes | Accessible Runner ID in the same workspace, from creation or list results. |

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

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```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} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | OK on success. |
| `msg` | string | Response information; OK on success. |
| `data` | object | [Response objects and omission rules](objects.md#responses). |

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

<span id="错误响应"></span>

## Error response

[Errors and recovery boundaries](lifecycle.md#errors) distinguishes Runner, Edge renewal, and compute observations. They do not share one numeric error table.
