> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 更新服务密码

> 为服务设置新密码



## OpenAPI

````yaml /zh/_specs/cloud-openapi.json patch /v1/organizations/{organizationId}/services/{serviceId}/password
openapi: 3.0.1
info:
  contact:
    email: support@clickhouse.com
    name: ClickHouse Support
    url: >-
      https://clickhouse.com/docs/en/cloud/manage/openapi?referrer=openapi-299828
  title: OpenAPI spec for ClickHouse Cloud
  version: '1.0'
servers:
  - url: https://api.clickhouse.cloud
security:
  - basicAuth: []
tags:
  - name: Organization
  - name: User management
  - name: Billing
  - name: Service
  - name: Backup
  - name: OpenAPI
  - name: Prometheus
  - name: ClickPipes
paths:
  /v1/organizations/{organizationId}/services/{serviceId}/password:
    patch:
      tags:
        - Service
      summary: 更新服务密码
      description: 为服务设置新密码
      parameters:
        - description: 拥有该服务的组织 ID。
          in: path
          name: organizationId
          required: true
          schema:
            format: uuid
            type: string
        - description: 要更新密码的服务 ID。
          in: path
          name: serviceId
          required: true
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServicePasswordPatchRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  requestId:
                    description: 分配给每个请求的唯一 ID。UUIDv4
                    format: uuid
                    type: string
                  result:
                    $ref: '#/components/schemas/ServicePasswordPatchResponse'
                  status:
                    description: HTTP 状态码。
                    example: 200
                    type: number
                type: object
          description: 成功响应
        '400':
          content:
            application/json:
              schema:
                properties:
                  error:
                    description: 详细错误说明。
                    type: string
                  status:
                    description: HTTP 状态码。
                    example: 400
                    type: number
                type: object
          description: 由于请求存在被视为客户端错误的问题，服务器无法或不会处理该请求。
components:
  schemas:
    ServicePasswordPatchRequest:
      properties:
        newDoubleSha1Hash:
          description: >-
            MySQL protocol 使用的可选 double SHA1 密码哈希。如果未提供 newPasswordHash，则会忽略此
            key，并使用生成的密码。算法：echo -n "yourpassword" | sha1sum | tr -d '-' | xxd
            -r -p | sha1sum | tr -d '-'
          type: string
        newPasswordHash:
          description: >-
            可选的密码哈希。用于避免通过网络传输密码。如果未提供，则会生成一个新密码，并在响应中返回。否则将使用此哈希。算法：echo -n
            "yourpassword" | sha256sum | tr -d '-' | xxd -r -p | base64
          type: string
    ServicePasswordPatchResponse:
      properties:
        password:
          description: 新的服务密码。仅当请求中没有 'newPasswordHash' 时提供
          type: string
  securitySchemes:
    basicAuth:
      description: >-
        使用从 ClickHouse Cloud 控制台获取的 key ID 和 key
        secret：https://clickhouse.com/docs/cloud/manage/openapi
      scheme: basic
      type: http

````