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

# Get Credits

> Credits the authenticated API key can spend right now.

For most keys, `credits` is the balance of the account the key belongs to: your personal balance for a personal key, the organization's balance for an organization key. A key with a credit cap gets its remaining cap instead, along with `key_quota`, and the organization's balance isn't shown to it.

The balance includes charges that have already posted. Realtime sessions are charged while they run, and batch jobs are charged when they finish.

Call this endpoint from your server with your API key. Client tokens are refused with `403`. Poll at most once per second.



## OpenAPI

````yaml /openapi.json get /v1/credits
openapi: 3.1.0
info:
  title: Decart API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/credits:
    get:
      summary: Get Credits
      description: >-
        Credits the authenticated API key can spend right now.


        For most keys, `credits` is the balance of the account the key belongs
        to: your personal balance for a personal key, the organization's balance
        for an organization key. A key with a credit cap gets its remaining cap
        instead, along with `key_quota`, and the organization's balance isn't
        shown to it.


        The balance includes charges that have already posted. Realtime sessions
        are charged while they run, and batch jobs are charged when they finish.


        Call this endpoint from your server with your API key. Client tokens are
        refused with `403`. Poll at most once per second.
      operationId: get_credits_v1_credits_get
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
            description: API key for authentication
            title: X-Api-Key
          description: API key for authentication
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditsResponse'
        '401':
          description: No or invalid API key provided
        '403':
          description: Client tokens cannot read the credit balance
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: Credits service unavailable
components:
  schemas:
    CreditsResponse:
      properties:
        credits:
          type: integer
          title: Credits
          description: >-
            Credits this API key can spend right now. For a key with a credit
            cap, its remaining cap (equal to `key_quota.remaining`).
        key_quota:
          $ref: '#/components/schemas/KeyQuota'
          description: >-
            The key's credit cap. Present only for a key with a cap; omitted
            otherwise.
      type: object
      required:
        - credits
      title: CreditsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    KeyQuota:
      properties:
        limit:
          type: integer
          title: Limit
          description: >-
            Credits the key may spend per window, or in total for a cap that
            never resets.
        used:
          type: integer
          title: Used
          description: Credits the key has spent in the current window.
        remaining:
          type: integer
          title: Remaining
          description: '`limit - used`, floored at 0.'
        resets_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Resets At
          description: >-
            When the current window ends and `used` returns to 0. `null` for a
            cap that never resets.
      type: object
      required:
        - limit
        - used
        - remaining
        - resets_at
      title: KeyQuota
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.