<span id="根式嵌入模型写入路由配置"></span>

# Update embedding routing configuration (root endpoint)

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

Write the complete embedding routing configuration for the current workspace.


```http
PUT https://api.moi.matrixorigin.cn/v5/embedding/router
```

<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.

[Configure identity, Workspace, and object permissions in the same environment](objects.md#prepare).

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

## Request

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

```bash
curl --request PUT \
  "$BASE_URL/embedding/router" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data-raw '{"strategy":"ROUND_ROBIN","health_check_interval":30,"max_retries":1,"session_affinity":false}'
```

:::::
:::::{tab-item} Parameters

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Workspace-ID` | Header | string | Yes | Workspace ID in the same environment. |
| `strategy` | Body | string | No | Three defined strings. Omission or an invalid value uses ROUND_ROBIN. |
| `health_check_interval` | Body | integer | No | Positive seconds. Omitted/nonpositive values become 30. |
| `max_retries` | Body | integer | No | LLM: nonpositive values use 0. Embedding: nonpositive values use 2. |
| `session_affinity` | Body | boolean | No | Omission/null means false and overwrites the previous configuration. |

Requires Workspace model_router.update. Writes complete configuration using request values and defaults, not a patch preserving omitted fields. Save old values before writing and read back afterward. Successful configuration does not establish verified routing, session affinity, or retry behavior.

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

<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": {
    "strategy": "ROUND_ROBIN",
    "health_check_interval": 30,
    "max_retries": 1,
    "session_affinity": false
  }
}
```

:::::
:::::{tab-item} Fields

HTTP 200。

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | OK on success. |
| `msg` | string | OK on success. |
| `data` | object | [Actual objects for this protocol](objects.md#responses). |

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

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

## Error response

[Errors and result confirmation](objects.md#errors) distinguishes the two protocols. Parse omitted fields, SDK zero values, and empty HTTP responses separately. Confirm writes using the corresponding read operation.
