basePath: /v1beta1
definitions:
  billing_errors.BaseError:
    properties:
      code:
        type: string
      error: {}
      msgPrefix:
        type: string
      status:
        type: integer
    type: object
  forms.BillsCostExplorer:
    properties:
      credits:
        description: The total credits held by the organization in this bill. The
          value of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      discounts:
        description: The total amount of discounts applied to this bill. The value
          of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      elements:
        items:
          $ref: '#/definitions/forms.BillsCostExplorerElements'
        type: array
      runningTotal:
        description: The sum of services that the specified organization has consumed
          during this bill period. The value of this field is expressed in cents (100ths
          of one US Dollar).
        example: "0.00"
        type: string
      totalCost:
        description: |-
          The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).
          `total_cost` = `running_total` - `discounts` - `credits`.
        example: "0.00"
        type: string
    type: object
  forms.BillsCostExplorerBreakdown:
    properties:
      billedDate:
        type: string
      credits:
        description: The total credits held by the organization in this bill. The
          value of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      detailKey:
        type: string
      detailName:
        type: string
      discounts:
        description: The total amount of discounts applied to this bill. The value
          of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      runningTotal:
        description: The sum of services that the specified organization has consumed
          during this bill period. The value of this field is expressed in cents (100ths
          of one US Dollar).
        example: "0.00"
        type: string
      totalCost:
        description: |-
          The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).
          `total_cost` = `running_total` - `discounts` - `credits`.
        example: "0.00"
        type: string
    type: object
  forms.BillsCostExplorerElements:
    properties:
      billedDate:
        type: string
      breakdown:
        items:
          $ref: '#/definitions/forms.BillsCostExplorerBreakdown'
        type: array
      credits:
        description: The total credits held by the organization in this bill. The
          value of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      discounts:
        description: The total amount of discounts applied to this bill. The value
          of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      runningTotal:
        description: The sum of services that the specified organization has consumed
          during this bill period. The value of this field is expressed in cents (100ths
          of one US Dollar).
        example: "0.00"
        type: string
      totalCost:
        description: |-
          The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).
          `total_cost` = `running_total` - `discounts` - `credits`.
        example: "0.00"
        type: string
    type: object
  forms.BillsDetail:
    properties:
      billedDate:
        description: The date when this bill happens.
        type: string
      clusterName:
        description: Name of the cluster.
        type: string
      credits:
        description: The total credits held by the organization in this bill. The
          value of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      discounts:
        description: The total amount of discounts applied to this bill. The value
          of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      projectName:
        description: Name of the project.
        type: string
      runningTotal:
        description: The sum of services that the specified organization has consumed
          during this bill period. The value of this field is expressed in cents (100ths
          of one US Dollar).
        example: "0.00"
        type: string
      servicePathName:
        description: Name of the service.
        type: string
      totalCost:
        description: |-
          The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).
          `total_cost` = `running_total` - `discounts` - `credits`.
        example: "0.00"
        type: string
    type: object
  forms.BillsDetails:
    properties:
      details:
        items:
          $ref: '#/definitions/forms.BillsDetail'
        type: array
    type: object
  forms.BillsExplorer:
    properties:
      overview:
        allOf:
        - $ref: '#/definitions/forms.BillsOverview'
        description: The overall information for a bill in the specified organization.
      summaryByProject:
        allOf:
        - $ref: '#/definitions/forms.SummaryByProject'
        description: A breakdown of the bill by project.
      summaryByService:
        description: A breakdown of the bill by service.
        items:
          $ref: '#/definitions/forms.BillsServiceCosts'
        type: array
    type: object
  forms.BillsOtherName:
    properties:
      chargeName:
        example: Support Plan
        type: string
      credits:
        description: The total credits held by the organization in this bill. The
          value of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      discounts:
        description: The total amount of discounts applied to this bill. The value
          of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      runningTotal:
        description: The sum of services that the specified organization has consumed
          during this bill period. The value of this field is expressed in cents (100ths
          of one US Dollar).
        example: "0.00"
        type: string
      totalCost:
        description: |-
          The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).
          `total_cost` = `running_total` - `discounts` - `credits`.
        example: "0.00"
        type: string
    type: object
  forms.BillsOverview:
    properties:
      billedMonth:
        description: The month in which this bill is generated for the specified organization.
        example: 2023-09
        type: string
      credits:
        description: The total credits held by the organization in this bill. The
          value of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      discounts:
        description: The total amount of discounts applied to this bill. The value
          of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      runningTotal:
        description: The sum of services that the specified organization has consumed
          during this bill period. The value of this field is expressed in cents (100ths
          of one US Dollar).
        example: "0.00"
        type: string
      totalCost:
        description: |-
          The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).
          `total_cost` = `running_total` - `discounts` - `credits`.
        example: "0.00"
        type: string
    type: object
  forms.BillsProjects:
    properties:
      credits:
        description: The total credits held by the organization in this bill. The
          value of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      discounts:
        description: The total amount of discounts applied to this bill. The value
          of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      projectName:
        description: The name of a project in the specified organization.
        example: prod-project
        type: string
      runningTotal:
        description: The sum of services that the specified organization has consumed
          during this bill period. The value of this field is expressed in cents (100ths
          of one US Dollar).
        example: "0.00"
        type: string
      totalCost:
        description: |-
          The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).
          `total_cost` = `running_total` - `discounts` - `credits`.
        example: "0.00"
        type: string
    type: object
  forms.BillsServiceCosts:
    properties:
      credits:
        description: The total credits held by the organization in this bill. The
          value of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      discounts:
        description: The total amount of discounts applied to this bill. The value
          of this field is expressed in cents (100ths of one US Dollar).
        example: "0.00"
        type: string
      runningTotal:
        description: The sum of services that the specified organization has consumed
          during this bill period. The value of this field is expressed in cents (100ths
          of one US Dollar).
        example: "0.00"
        type: string
      serviceCosts:
        items:
          $ref: '#/definitions/forms.BillsServiceCosts'
        type: array
      serviceName:
        description: The name of services provided by TiDB Cloud.
        example: TiDB Dedicated
        type: string
      totalCost:
        description: |-
          The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).
          `total_cost` = `running_total` - `discounts` - `credits`.
        example: "0.00"
        type: string
    type: object
  forms.ClusterOpenAPI:
    properties:
      ProjectID:
        example: "0"
        type: string
      id:
        example: "0"
        type: string
      name:
        type: string
      regionName:
        type: string
      status:
        type: string
    type: object
  forms.CostExplorerProvider:
    properties:
      name:
        description: The name of the cloud provider to include in the query.
        type: string
      regions:
        description: A list of region names to include in the query.
        items:
          type: string
        type: array
    type: object
  forms.CostExplorerService:
    properties:
      category:
        description: The service category name (second level).
        type: string
      component:
        description: The service component name (third level).
        type: string
      product:
        description: The service product name (first level).
        type: string
      service:
        description: The full service name, typically combining all levels.
        type: string
    type: object
  forms.CostExplorerTrendsBreakdownKey:
    enum:
    - service
    - product
    - project
    - cluster
    - provider
    - region
    - customer
    type: string
    x-enum-varnames:
    - CostExploreTrendsBreakdownKeyService
    - CostExploreTrendsBreakdownKeyProduct
    - CostExploreTrendsBreakdownKeyProject
    - CostExploreTrendsBreakdownKeyCluster
    - CostExploreTrendsBreakdownKeyProvider
    - CostExploreTrendsBreakdownKeyRegion
    - CostExploreTrendsBreakdownKeyCustomer
  forms.CostExplorerTrendsTimeGroup:
    enum:
    - day
    - month
    - total
    type: string
    x-enum-varnames:
    - CostExploreTrendsTimeGroupDay
    - CostExploreTrendsTimeGroupMonth
    - CostExploreTrendsTimeGroupTotal
  forms.Groups:
    properties:
      groupBy:
        description: |-
          Specifies categories for grouping query results. Value options are:
          - "service": Group query results by service type
          - "product": Group query results by product type (TiDB Dedicated, TiDB Serverless, or Support Plan)
          - "project": Group query results by project IDs
          - "cluster": Group query results by cluster IDs
          - "provider": Group query results by cloud provider
          - "region": Group query results by cloud provider region
        items:
          $ref: '#/definitions/forms.CostExplorerTrendsBreakdownKey'
        type: array
      timeGranularity:
        allOf:
        - $ref: '#/definitions/forms.CostExplorerTrendsTimeGroup'
        description: |-
          Determines the time-based organization of query results. Value options are:
          - "day": Query results are organized daily
          - "month": Query results are organized monthly
          - "total": Query results are organized as a single total
    type: object
  forms.ProjectOpenAPI:
    properties:
      id:
        example: "0"
        type: string
      name:
        type: string
      status:
        type: string
    type: object
  forms.Provider:
    properties:
      name:
        description: Name of the cloud provider
        type: string
      regions:
        description: Name of the region
        items:
          type: string
        type: array
    type: object
  forms.SummaryByProject:
    properties:
      otherCharges:
        description: These charges occur not only within a project but also across
          the entire organization.
        items:
          $ref: '#/definitions/forms.BillsOtherName'
        type: array
      projects:
        description: The projects in the specified organization.
        items:
          $ref: '#/definitions/forms.BillsProjects'
        type: array
    type: object
  forms.TimeRange:
    properties:
      endDate:
        description: 'The end date of the time range. The time format follows the
          [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example:
          `"2023-12-01T00:00:00Z"`.'
        type: string
      startDate:
        description: 'The start date of the time range. The time format follows the
          [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example:
          `"2023-12-01T00:00:00Z"`.'
        type: string
    type: object
  forms.TrendsArgs:
    properties:
      clusters:
        items:
          $ref: '#/definitions/forms.ClusterOpenAPI'
        type: array
      projects:
        items:
          $ref: '#/definitions/forms.ProjectOpenAPI'
        type: array
      providers:
        items:
          $ref: '#/definitions/forms.Provider'
        type: array
      services:
        description: 'The Identifier of TiDB Cloud services consists of 3 levels.
          For example, "service": "TiDB Dedicated - Node Compute - TiFlash" consists
          of the following 3 levels.'
        items:
          $ref: '#/definitions/forms.CostExplorerService'
        type: array
    type: object
  forms.TrendsFilter:
    properties:
      clusters:
        description: A list of cluster IDs to include in the query.
        items:
          type: string
        type: array
      customers:
        description: '"A list of customer IDs to include in the query.'
        items:
          type: string
        type: array
      projects:
        description: A list of project IDs to include in the query.
        items:
          type: string
        type: array
      providers:
        description: A list of providers to include in the query.
        items:
          $ref: '#/definitions/forms.CostExplorerProvider'
        type: array
      services:
        description: A list of TiDB Cloud services to include in the query.
        items:
          $ref: '#/definitions/forms.CostExplorerService'
        type: array
      timeRange:
        allOf:
        - $ref: '#/definitions/forms.TimeRange'
        description: The time period for the query.
    type: object
  forms.TrendsInput:
    properties:
      filter:
        $ref: '#/definitions/forms.TrendsFilter'
      groups:
        $ref: '#/definitions/forms.Groups'
    type: object
host: billing.tidbapi.com
info:
  contact: {}
  description: This is a billing system server
  title: Billing System OPENAPI
  version: v1beta1
paths:
  /bills/{billedMonth}:
    get:
      consumes:
      - application/json
      description: This endpoint retrieves the bill for the given month of a specific
        organization. You can query a bill up to 6 months prior to the current month.
        The bill is returned in JSON format.To use this resource, the requesting API
        Key must have the Organization Billing Admin or Organization Owner role.
      parameters:
      - description: The month of this bill happens for the specified organization,
          format is YYYY-MM, for example '2023-08'.
        in: path
        name: billedMonth
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/forms.BillsExplorer'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/billing_errors.BaseError'
      summary: Return organization monthly bills
      tags:
      - Billing
  /billsCostExplorer:
    post:
      consumes:
      - application/json
      description: 'This endpoint executes a cost explorer query and returns the usage
        details. Cost Explorer query:'
      parameters:
      - description: args
        in: body
        name: args
        required: true
        schema:
          $ref: '#/definitions/forms.TrendsInput'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/forms.BillsCostExplorer'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/billing_errors.BaseError'
      summary: Get the usage details according to a cost explorer query
      tags:
      - Billing
  /billsCostExplorer/args:
    get:
      consumes:
      - application/json
      description: This endpoint retrieves the basic info for a specific organization,
        including service info, cloud provider info, project info, and cluster info.
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/forms.TrendsArgs'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/billing_errors.BaseError'
      summary: Return basic info of a specific organization, which contains the key
        info to execute a cost explorer query
      tags:
      - Billing
  /billsDetails/{billedMonth}:
    get:
      consumes:
      - application/json
      description: This endpoint retrieves the bill for the given month of a specific
        organization with daily usage details. You can query a bill up to 6 months
        prior to the current month. The bill is returned in JSON format. To use this
        resource, the requesting API Key must have the Organization Billing Admin
        or Organization Owner role.
      parameters:
      - description: The month of this bill happens for the specified organization.
          The format is `YYYY-MM`, for example '2024-05'.
        in: path
        name: billedMonth
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/forms.BillsDetails'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/billing_errors.BaseError'
      summary: Get the monthly bill of the organization with daily usage details
      tags:
      - Billing
swagger: "2.0"
