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

# Get credit details

> Get credit details



## OpenAPI

````yaml get /credits/{credit_id}
openapi: 3.0.3
info:
  version: '1.0'
  title: Togai Apis
  contact:
    email: engg@togai.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  description: APIs for Togai App
servers:
  - description: Api endpoint
    url: https://api.togai.com/
  - description: Sandbox api endpoint
    url: https://sandbox-api.togai.com/
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: Customer level calls
  - name: Accounts
    description: Account level calls
  - name: Event Schemas
    description: Event Schema level calls
  - name: Usage Meters
    description: Usage Meter level calls
  - name: Price Plans
    description: (DEPRECATED) Price Plan level calls
  - name: PricePlanV2
    description: Price Plan V2 level calls
  - name: Schedules
    description: Account Schedule level calls
  - name: Pricing Rules
    description: Pricing Rules level calls
  - name: Settings
    description: Settings
  - name: Price Experimentation
    description: Price Experimentation apis
  - name: InvoiceGroups
    description: Invoice Group level calls
  - name: Organization
    description: Organization level calls
  - name: FileStorage
    description: File Storage level calls
  - name: Aliases
    description: Alias level calls
  - name: Reports
    description: Report level calls
  - name: ReportTemplates
    description: Report Template level calls
  - name: Customer Portal
    description: Portal level calls
  - name: Alerts
    description: Alert level calls
  - name: Event Management
    description: APIs for getting events ingested in Togai
    externalDocs:
      description: docs
      url: https://togai.com/docs/billing/events
  - name: Metrics
    description: APIs for getting Togai metrics
    externalDocs:
      description: docs
      url: https://togai.com/docs/metrics
  - name: Licenses
    description: APIs for getting or updating license records in Togai
  - name: Entitlements
    description: APIs related to entitlements
  - name: Invoices
    description: Invoices API
  - name: Credits
    description: Credits API
  - name: Wallet
    description: Wallet API
  - name: InvoiceTemplates
    description: InvoiceTemplates API
  - name: InvoiceSequence
    description: InvoiceSequence API
  - name: Payments
    description: Payments API
  - name: Authentication
    description: Authentication API
externalDocs:
  description: Find out more about Togai
  url: https://docs.togai.com/docs
paths:
  /credits/{credit_id}:
    get:
      tags:
        - Credits
      summary: Get credit details
      description: Get credit details
      operationId: getCreditDetails
      parameters:
        - $ref: '#/components/parameters/credit_id'
      responses:
        '200':
          $ref: '#/components/responses/CreditDetailsResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '401':
          $ref: '#/components/responses/ErrorResponse'
        '403':
          $ref: '#/components/responses/ErrorResponse'
        '404':
          $ref: '#/components/responses/ErrorResponse'
        '429':
          $ref: '#/components/responses/ErrorResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    credit_id:
      in: path
      name: credit_id
      required: true
      schema:
        type: string
        example: creds.1znQx9jiIXw.r44fc
  responses:
    CreditDetailsResponse:
      description: >-
        Response for Fetch Credit Details request. This contains Credit
        Transactions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreditDetailsResponse'
    ErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            ErrorResponse:
              summary: Error message
              value:
                message: <Reason message>
  schemas:
    CreditDetailsResponse:
      allOf:
        - $ref: '#/components/schemas/Credit'
        - type: object
          additionalProperties: false
          required:
            - transactions
          properties:
            transactions:
              type: array
              items:
                $ref: '#/components/schemas/CreditTransaction'
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - message
      properties:
        message:
          type: string
          description: error description
          maxLength: 500
    Credit:
      allOf:
        - $ref: '#/components/schemas/CreditRequest'
        - type: object
          additionalProperties: false
          required:
            - id
            - customerId
            - status
            - createdAt
          properties:
            id:
              description: Identifier of credits
              type: string
              maxLength: 50
              example: cred.1znqBOVcai0.0tBFz
            customerId:
              type: string
              example: 7VcRw9xZDIqsC5E
            status:
              type: string
              enum:
                - ACTIVE
                - CONSUMED
                - EXPIRED
                - VOIDED
              example: ACTIVE
            creditUnit:
              type: string
              example: USD
            holdAmount:
              type: number
              example: 500
            consumedAmount:
              type: number
              example: 400
            createdAt:
              type: string
              format: date-time
            updatedAt:
              type: string
              format: date-time
    CreditTransaction:
      type: object
      additionalProperties: false
      required:
        - id
        - creditId
        - transactionType
        - amount
        - createdAt
      properties:
        id:
          description: Identifier of credit transactions
          type: string
          maxLength: 50
        creditId:
          type: string
        transactionType:
          type: string
          enum:
            - CREDITED
            - DEBITED
            - EXPIRED
            - VOIDED
          example: CREDITED
        invoiceId:
          type: string
        entityId:
          type: string
        amount:
          type: number
          example: 200
        createdAt:
          type: string
          format: date-time
    CreditRequest:
      description: Payload to grant Credits
      type: object
      additionalProperties: false
      required:
        - accountId
        - effectiveFrom
        - priority
        - purpose
      properties:
        accountId:
          type: string
          example: ACC001
        purpose:
          type: string
          example: PREPAID_CREDIT
        applicableEntityIds:
          description: >
            List of entity ids for which the credit is applicable. If null or
            empty, the credit is applicable to all ids. This list can accept
            special values like: - ALL_USAGE_METER_RATE_CARDS: To apply the
            credit to all usage meter rate cards - ALL_FIXED_FEE_RATE_CARDS: To
            apply the credit to all fixed fee rate cards
          type: array
          uniqueItems: true
          items:
            type: string
            example:
              - umg.1znQx9jiIXw.r44fc
              - ALL_USAGE_METER_RATE_CARDS
              - ALL_FIXED_FEE_RATE_CARDS
        effectiveFrom:
          type: string
          format: date
          example: '2020-07-04'
        effectiveUntil:
          type: string
          format: date
          example: '2021-07-04'
        creditAmount:
          type: number
          example: 1000
        priority:
          type: integer
          example: 1
        grantorId:
          description: The entity through which the credit has been granted
          type: string
        idempotencyKey:
          description: The idempotency key for uniqueness of the credit record
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer <credential>

````