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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 更新连接

> 部分更新连接。仅应用您发送的字段；密钥信息保持掩码处理。

部分更新您之前创建的连接。仅应用请求体中出现的字段：您省略的任何字段都保留其当前值。

> [!NOTE]
>
> **此处无法更改的内容**：`provider_id`、`flow_type`、`payment_methods` 和 `INTEGRATION_TYPE` 参数不可变更。如需更改其中任何一项，请创建新连接，并将您的路由规则重新指向该连接。

### 路径参数

**connection\_id** `string` *required*

[创建连接](https://docs.y.uno/zh-hans/reference/organizations/connections/create-connection.md) 返回的 id。必须属于您的 API 密钥所作用的账户。

### 请求体

**account\_id** `string` *required*

连接所属账户的 UUID。

**merchant\_connection\_id** `string`

此连接的新标签。最多 255 个字符，并且在账户内仍必须唯一。省略此字段即可保留当前标签。

**params** `object[]`

要更改的参数，以 `{param_id, value}` 对组成的 **扁平数组** 提交，结构与 [创建连接](https://docs.y.uno/zh-hans/reference/organizations/connections/create-connection.md) 相同。

参数会 **按 `param_id` 合并** 到连接的当前参数上：您未发送的 `param_id` 保留其当前值。您只需发送实际要更改的内容。您发送的每个 `param_id` 都会根据服务提供商目录进行校验。

**项**

**param\_id** `string` *required*

目录中的确切 `param_id`。大小写敏感。

**value** `string | boolean | number | array` *required*

与目录中的 `field_type` 保持一致。

**costs** `object[]`

成本配置。与 `params` 不同，`costs` **不会合并**：只要提供该字段，它就会 *替换* 连接的整个成本表。省略此字段即可保持现有成本不变。

**项**

**sort\_number** `integer`

成本条目的优先级顺序。

**cost\_name** `string`

成本条目的标签。

**currency** `string`

ISO 4217 币种代码。必须是该服务提供商支持的币种。

**cost\_values** `object`

**successful | unsuccessful**

**fixed\_fee** `number`

固定费用金额。

**percentage** `number`

百分比费用。

### 响应

返回更新后的连接，结构与 [检索连接](https://docs.y.uno/zh-hans/reference/organizations/connections/retrieve-connection.md) 相同。

**connection\_id** `string`

连接的唯一标识符。更新不会改变此值。

**merchant\_connection\_id** `string`

您为此连接设置的内部标签。

**provider\_id** `string`

此连接所属的服务提供商。

**status** `string`

当前状态。

**flow\_type** `string`

始终为 `PAYIN`。

**payment\_methods** `string[]`

支持的支付方式列表。

**params** `object[]`

合并后连接的完整参数集，而不仅是您发送的参数。敏感值以 `***` 掩码显示。

**costs** `object[]`

连接的成本配置。

**created\_at** `string`

ISO 8601 时间戳。

**updated\_at** `string`

ISO 8601 时间戳。更新成功后会刷新。

```bash cURL — rotate a secret theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
curl -X PATCH 'https://api.y.uno/v1/connections/f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e' \
  -H 'public-api-key: <YOUR_PUBLIC_KEY>' \
  -H 'private-secret-key: <YOUR_SECRET_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "params": [
      { "param_id": "SECRET_KEY", "value": "sk_live_new..." }
    ]
  }'
```

```bash cURL — rename theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
curl -X PATCH 'https://api.y.uno/v1/connections/f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e' \
  -H 'public-api-key: <YOUR_PUBLIC_KEY>' \
  -H 'private-secret-key: <YOUR_SECRET_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "merchant_connection_id": "stripe-us-prod-002"
  }'
```

```json 200 OK theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
  "merchant_connection_id": "stripe-us-prod-002",
  "provider_id": "STRIPE",
  "status": "ACTIVE",
  "flow_type": "PAYIN",
  "payment_methods": ["CARD"],
  "params": [
    { "param_id": "INTEGRATION_TYPE",             "value": "STRIPE_CHARGES" },
    { "param_id": "SECRET_KEY",                   "value": "***" },
    { "param_id": "RADAR_FRAUD_ANALYSIS",         "value": false },
    { "param_id": "SEND_RECEIPT_EMAIL_PARAMETER", "value": false },
    { "param_id": "SETUP_FUTURE_USAGE",           "value": false },
    { "param_id": "ORDER_ID",                     "value": "DEFAULT" }
  ],
  "costs": [
    {
      "sort_number": 1,
      "cost_name": "Transaction Fee",
      "currency": "USD",
      "cost_values": {
        "successful":   { "fixed_fee": 0.30, "percentage": 2.9 },
        "unsuccessful": { "fixed_fee": 0.0,  "percentage": 0.0 }
      }
    }
  ],
  "created_at": "2026-05-12T10:24:00Z",
  "updated_at": "2026-05-12T11:02:17Z"
}
```

```json 400 — Unknown Param theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "type": "validation_error",
  "code": "UNKNOWN_PARAM",
  "message": "Param 'FOO' is not part of provider 'STRIPE' catalog",
  "details": { "provider_id": "STRIPE", "param_id": "FOO" }
}
```

```json 409 — Conflict theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "type": "conflict",
  "code": "CONNECTION_MERCHANT_ID_CONFLICT",
  "message": "A connection with merchant_connection_id 'stripe-us-prod-002' already exists in this account",
  "details": { "merchant_connection_id": "stripe-us-prod-002" }
}
```

> [!NOTE]
>
> **密钥信息处理**：目录中标记为 `secret: true` 的参数始终以 `"value": "***"` 返回。回传 `"***"` 并不能保留密钥信息：只需完全省略该 `param_id`，其存储的值就会被保留。

### 错误

| HTTP | `code` |
| - | - |
| `400` | `UNKNOWN_PARAM` 某个 `param_id` 不属于该服务提供商目录。 |
| `400` | `INVALID_PARAM_VALUE` 某个值与目录中的 `field_type` 或允许的选项不匹配。 |
| `400` | `UNSUPPORTED_CURRENCY` 某个 `costs[].currency` 不在该服务提供商支持的列表中。 |
| `400` | `VALIDATION_ERROR` `connection_id` 不是有效的 UUID，或 `merchant_connection_id` 超过 255 个字符。 |
| `400` | `MALFORMED_BODY` 请求体不是有效的 JSON。 |
| `401` | `NOT_AUTHENTICATED` API 密钥缺失或无效。 |
| `404` | `CONNECTION_NOT_FOUND` 未知的 `connection_id`，或该 id 属于其他账户。 |
| `409` | `CONNECTION_MERCHANT_ID_CONFLICT` `merchant_connection_id` 已存在于此账户中。 |


## OpenAPI

````yaml openapi/zh-hans/organizations/connections/update-connection.json PATCH /connections/{connection_id}
openapi: 3.1.0
info:
  title: Connections API - Update
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /connections/{connection_id}:
    patch:
      summary: 更新连接
      description: 部分更新连接。仅应用请求体中包含的字段。
      operationId: update-connection
      parameters:
        - name: connection_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - account_id
              properties:
                account_id:
                  type: string
                  format: uuid
                  example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                merchant_connection_id:
                  type: string
                  maxLength: 255
                  example: stripe-us-prod-002
                params:
                  type: array
                  items:
                    type: object
                    properties:
                      param_id:
                        type: string
                        example: SECRET_KEY
                      value:
                        type: string
                        example: sk_live_...
                costs:
                  type: array
                  items:
                    type: object
                    properties:
                      sort_number:
                        type: integer
                        example: 1
                      cost_name:
                        type: string
                        example: Transaction Fee
                      currency:
                        type: string
                        example: USD
                      cost_values:
                        type: object
                        properties:
                          successful:
                            type: object
                            properties:
                              fixed_fee:
                                type: number
                                example: 0.25
                              percentage:
                                type: number
                                example: 2.7
                          unsuccessful:
                            type: object
                            properties:
                              fixed_fee:
                                type: number
                                example: 0
                              percentage:
                                type: number
                                example: 0
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  connection_id:
                    type: string
                    example: f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e
                  merchant_connection_id:
                    type: string
                    example: stripe-us-prod-002
                  provider_id:
                    type: string
                    example: STRIPE
                  status:
                    type: string
                    example: ACTIVE
                  flow_type:
                    type: string
                    example: PAYIN
                  payment_methods:
                    type: array
                    items:
                      type: string
                    example:
                      - CARD
                  params:
                    type: array
                    items:
                      type: object
                      properties:
                        param_id:
                          type: string
                          example: SECRET_KEY
                        value:
                          type: string
                          example: '***'
                  costs:
                    type: array
                    items:
                      type: object
                      properties:
                        sort_number:
                          type: integer
                          example: 1
                        cost_name:
                          type: string
                          example: Transaction Fee
                        currency:
                          type: string
                          example: USD
                  created_at:
                    type: string
                    format: date-time
                    example: '2026-05-12T10:24:00Z'
                  updated_at:
                    type: string
                    format: date-time
                    example: '2026-05-12T11:02:17Z'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: validation_error
                  code:
                    type: string
                    example: UNKNOWN_PARAM
                  message:
                    type: string
                    example: Param 'FOO' is not part of provider 'STRIPE' catalog
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: auth_error
                  code:
                    type: string
                    example: NOT_AUTHENTICATED
                  message:
                    type: string
                    example: Not authenticated
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: not_found
                  code:
                    type: string
                    example: CONNECTION_NOT_FOUND
                  message:
                    type: string
                    example: Connection '...' was not found
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: conflict
                  code:
                    type: string
                    example: CONNECTION_MERCHANT_ID_CONFLICT
                  message:
                    type: string
                    example: >-
                      A connection with merchant_connection_id
                      'stripe-us-prod-002' already exists in this account
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: PUBLIC-API-KEY
      x-default: <Your PUBLIC-API-KEY>
    sec1:
      type: apiKey
      in: header
      name: PRIVATE-SECRET-KEY
      x-default: <Your PRIVATE-SECRET-KEY>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.