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

# 获取组织使用成本信息

> 返回所查询时间段内该组织的总费用，以及按天、按实体划分的组织使用成本记录列表（最长 31 天）。请求和响应中的所有日期均按 UTC 时区计算。



## OpenAPI

````yaml /zh/products/cloud/api-reference/cloud-openapi.json get /v1/organizations/{organizationId}/usageCost
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}/usageCost:
    get:
      tags:
        - Billing
      summary: 获取组织使用成本信息
      description: 返回所查询时间段内该组织的总费用，以及按天、按实体划分的组织使用成本记录列表（最长 31 天）。请求和响应中的所有日期均按 UTC 时区计算。
      parameters:
        - description: 所请求组织的 ID。
          in: path
          name: organizationId
          required: true
          schema:
            format: uuid
            type: string
        - description: 报告的开始日期，例如 2024-12-19。
          in: query
          name: from_date
          required: true
          schema:
            format: date-time
            type: string
        - description: 报告的结束日期（含当日），例如 2024-12-20。该日期不得晚于 from_date 后 30 天（即最长查询周期为 31 天）。
          in: query
          name: to_date
          required: true
          schema:
            format: date-time
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  requestId:
                    description: 为每个请求分配的唯一 ID。UUIDv4
                    format: uuid
                    type: string
                  result:
                    $ref: '#/components/schemas/UsageCost'
                  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:
    UsageCost:
      properties:
        costs:
          $ref: '#/components/schemas/UsageCostRecord'
        grandTotalCHC:
          description: 以 ClickHouse Credits (CHCs) 计量的使用总成本。
          type: number
    UsageCostRecord:
      properties:
        dataWarehouseId:
          description: 此实体所属的 dataWarehouse 的 ID（或该实体本身的 ID）。
          format: uuid
          type: string
        date:
          description: 使用日期。ISO-8601 日期，基于 UTC 时区。
          format: date
          type: string
        entityId:
          description: 实体的唯一 ID。
          format: uuid
          type: string
        entityName:
          description: 实体名称。
          type: string
        entityType:
          description: 实体类型。
          enum:
            - datawarehouse
            - service
            - clickpipe
          type: string
        locked:
          description: 为 true 时，该记录不可变。未锁定的记录在锁定前可能发生变化。
          type: boolean
        metrics:
          $ref: '#/components/schemas/UsageCostMetrics'
        serviceId:
          description: 此实体所属的 service 的 ID（或该实体本身的 ID）。对于 dataWarehouse 实体，设为 null。
          format: uuid
          nullable: true
          type: string
        totalCHC:
          description: 此实体以 ClickHouse Credits (CHCs) 计量的总使用成本。
          type: number
    UsageCostMetrics:
      properties:
        backupCHC:
          description: 以 ClickHouse Credits (CHCs) 计的备份成本。适用于 dataWarehouse 实体。
          type: number
        computeCHC:
          description: 以 ClickHouse Credits (CHCs) 计的计算资源成本。适用于 service 和 ClickPipe 实体。
          type: number
        dataTransferCHC:
          description: 以 ClickHouse Credits (CHCs) 计的数据传输成本。适用于 ClickPipe 实体。
          type: number
        initialLoadCHC:
          description: 以 ClickHouse Credits (CHCs) 计的初始加载和重新同步成本。适用于 ClickPipe 实体。
          type: number
        interRegionTier1DataTransferCHC:
          description: 以 ClickHouse Credits (CHCs) 计的 tier1 跨区域数据传输成本。适用于 service 实体。
          type: number
        interRegionTier2DataTransferCHC:
          description: 以 ClickHouse Credits (CHCs) 计的 tier2 跨区域数据传输成本。适用于 service 实体。
          type: number
        interRegionTier3DataTransferCHC:
          description: 以 ClickHouse Credits (CHCs) 计的 tier3 跨区域数据传输成本。适用于 service 实体。
          type: number
        interRegionTier4DataTransferCHC:
          description: 以 ClickHouse Credits (CHCs) 计的 tier4 跨区域数据传输成本。适用于 service 实体。
          type: number
        publicDataTransferCHC:
          description: 以 ClickHouse Credits (CHCs) 计的数据传输成本。适用于 service 实体。
          type: number
        storageCHC:
          description: 以 ClickHouse Credits (CHCs) 计的存储成本。适用于 dataWarehouse 实体。
          type: number
  securitySchemes:
    basicAuth:
      description: >-
        使用在 ClickHouse Cloud 控制台中获取的 key ID 和 key
        secret：https://clickhouse.com/docs/cloud/manage/openapi
      scheme: basic
      type: http

````