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

# 获取组织使用成本

> 返回查询时间范围内该 organization 的总费用，以及按天、按 entity 划分的 organization 用量成本记录列表（最长 31 天）。请求和响应中的所有日期均按 UTC timezone 计算。



## OpenAPI

````yaml /zh/_specs/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: >-
        返回查询时间范围内该 organization 的总费用，以及按天、按 entity 划分的 organization 用量成本记录列表（最长
        31 天）。请求和响应中的所有日期均按 UTC timezone 计算。
      parameters:
        - description: 所请求的 organization 的 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: 由于存在被视为客户端错误的原因，server 无法或不愿处理该请求。
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

````