> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contextual.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Billing Mode History

> Get the billing mode history for a tenant for a specific month.

Args: request: Request object containing year and month with validation user_context: User context with tenant admin permissions

Returns: Billing mode history records for the specified month and year Returns at least one entry which is the mode of the first date of the given month, with potential mode changes in the middle of the month. If no record found, defaults to LEGACY mode.



## OpenAPI

````yaml api-reference/openapi.json get /billing/billing_mode/history
openapi: 3.1.0
info:
  title: Endpoints
  version: '1.0'
servers:
  - url: https://api.contextual.ai/v1
security:
  - BearerAuth: []
paths:
  /billing/billing_mode/history:
    get:
      tags:
        - /billing
      summary: Get Billing Mode History
      description: >-
        Get the billing mode history for a tenant for a specific month.


        Args: request: Request object containing year and month with validation
        user_context: User context with tenant admin permissions


        Returns: Billing mode history records for the specified month and year
        Returns at least one entry which is the mode of the first date of the
        given month, with potential mode changes in the middle of the month. If
        no record found, defaults to LEGACY mode.
      operationId: get_billing_mode_history_billing_billing_mode_history_get
      parameters:
        - name: year
          in: query
          required: true
          schema:
            type: integer
            minimum: 2025
            title: Year
        - name: month
          in: query
          required: true
          schema:
            type: integer
            maximum: 12
            minimum: 1
            title: Month
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingModeHistoryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    BillingModeHistoryResponse:
      properties:
        billing_modes:
          items:
            $ref: '#/components/schemas/BillingModeHistoryEntry'
          type: array
          title: Billing Modes
          description: List of billing mode entries for the specified month
      type: object
      required:
        - billing_modes
      title: BillingModeHistoryResponse
      description: Response to GET /billing/billing_mode/history request
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BillingModeHistoryEntry:
      properties:
        date:
          type: string
          format: date
          title: Date
          description: Date (yyyy-mm-dd) when the billing mode became effective
        billing_mode:
          $ref: '#/components/schemas/BillingMode'
          description: Billing mode
      type: object
      required:
        - date
        - billing_mode
      title: BillingModeHistoryEntry
      description: Individual billing mode entry
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    BillingMode:
      type: string
      enum:
        - ON_DEMAND_PREPAID
        - ON_DEMAND_PAY_ARREARS
        - PROVISION_THROUGHPUT
        - LEGACY
      title: BillingMode
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````