basePath: /v1beta1/msp
definitions:
  billing_errors.BaseError:
    properties:
      code:
        type: string
      error: {}
      msgPrefix:
        type: string
      status:
        type: integer
    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: 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 consumed
          in the period 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 toward 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: 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 consumed
          in the period 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 toward 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: 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 consumed
          in the period 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 toward 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: 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 consumed
          in the period 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 toward 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.MspBills:
    properties:
      overview:
        allOf:
          - $ref: '#/definitions/forms.BillsOverview'
        description: The overall information for a bill in the specified organization.
      summaryByCustomer:
        description: Month of bills happens to a specific MSP.
        items:
          $ref: '#/definitions/forms.SummaryByCustomer'
        type: array
      summaryByService:
        description: A breakdown of the bill by service.
        items:
          $ref: '#/definitions/forms.BillsServiceCosts'
        type: array
    type: object
  forms.MspCredit:
    properties:
      credit:
        description: The total amount of credit.
        example: "1000.00"
        type: string
      creditCode:
        description: The code of a credit.
        example: 498c7f44-656f-4944-b455-0695faa5d4f9
        type: string
      expiryDate:
        description: Expired date of a credit.
        example: "2023-12-01T00:00:00Z"
        type: string
      remainingCredit:
        description: The remaining amount of a credit.
        example: "1000.00"
        type: string
      services:
        description: The service to which a credit is applicable.
        example: General Product
        type: string
      startDate:
        description: Effective start date of a credit.
        example: "2023-11-01T00:00:00Z"
        type: string
      status:
        description: The status of a credit.
        example: active
        type: string
    type: object
  forms.MspDiscount:
    properties:
      description:
        description: The description of a discount.
        type: string
      discountCode:
        description: The code of a discount.
        example: 498c7f44-656f-4944-b455-0695faa5d4f9
        type: string
      expiryDate:
        description: Expired date of a credit.
        example: "2023-12-01T00:00:00Z"
        type: string
      percentageDiscount:
        description: The percentage is deducted from the original price. For example,
          a 20% discount on a $100 item would result in a discounted price of $80.
        example: 20%
        type: string
      services:
        description: The service to which a discount is applicable.
        example: Node Compute, Changefeed,
        type: string
      startDate:
        description: Effective start date of a credit.
        example: "2023-11-01T00:00:00Z"
        type: string
      status:
        description: The status of a discount.
        example: valid
        type: string
    type: object
  forms.SummaryByCustomer:
    properties:
      customerID:
        description: The Organization ID of MSP
        type: integer
      mspCustomerBills:
        allOf:
          - $ref: '#/definitions/forms.BillsExplorer'
        description: The bill generated for a specific MSP customer in the specified
          month.
    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
host: msp.tidbapi.com
info:
  contact: {}
  description: This is a billing system server for managed service provider (MSP).
  title: MSP (Managed Service Provider) OPENAPI
  version: v1beta1
paths:
  /bills/{billedMonth}:
    get:
      consumes:
        - application/json
      description: This endpoint retrieves the bill for the given month of a specific
        MSP. You can query a bill up to 6 months prior to the current month. The bill
        is returned in JSON format.
      parameters:
        - description: The month of this bill happens for the specified organization.
            The 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.MspBills'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/billing_errors.BaseError'
        "403":
          description: Forbidden
          schema:
            $ref: '#/definitions/billing_errors.BaseError'
      summary: Return MSP monthly bills
      tags:
        - MSP
  /credits:
    get:
      consumes:
        - application/json
      description: This endpoint retrieves the credits applied to a specific MSP.
      produces:
        - application/json
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: '#/definitions/forms.MspCredit'
            type: array
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/billing_errors.BaseError'
      summary: Return credits applied to a specific MSP
      tags:
        - MSP
  /discounts/:
    get:
      consumes:
        - application/json
      description: This endpoint retrieves the discount applied to a specific MSP.
      produces:
        - application/json
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: '#/definitions/forms.MspDiscount'
            type: array
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/billing_errors.BaseError'
      summary: Return discounts applied to a specific MSP
      tags:
        - MSP
  /mspCustomerBills/{billedMonth}/mspCustomers/{mspCustomerId}:
    get:
      consumes:
        - application/json
      description: This endpoint retrieves the bill for the given month of a specific
        end customer of MSP. You can query a bill up to 6 months prior to the current
        month. The bill is returned in JSON format.
      parameters:
        - description: The month of this bill happens for the specified organization.
            The format is YYYY-MM, for example, '2023-08'.
          in: path
          name: billedMonth
          required: true
          type: string
        - description: ID of the MSP customer.
          in: path
          name: mspCustomerId
          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 monthly bills for a specific MSP customer
      tags:
        - MSP
swagger: "2.0"
