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

# API para consultar el saldo de créditos: facturación KYC

> Consulta tu saldo de créditos de Didit y la configuración de recarga automática. Un solo saldo paga todos los productos: crédito del plan y recargas.



Prompt para consultar el saldo de créditos
        Copiar el prompt al portapapeles



      
      

\<pre>

\`Goal: Read the organization's current pre-paid credit balance (USD) plus its auto-refill configuration.

Endpoint: GET https://verification.didit.me/v3/billing/balance/
Auth header: x-api-key: <DIDIT_API_KEY>

curl:
curl -X GET 'https://verification.didit.me/v3/billing/balance/' \
-H 'x-api-key: YOUR_API_KEY'

Response 200:
\{
"balance": "1234.5600",                  // USD, FIXED-POINT DECIMAL STRING — parse with Decimal/BigDecimal, not float.
"auto_refill_enabled": true,             // boolean
"auto_refill_amount": "500.00",          // USD string or null
"auto_refill_threshold": "100.00"        // USD string or null — auto-refill fires when balance falls below this
}

Notes:
\- Balance is ORGANIZATION-WIDE — shared across every application under the same org.
\- Decreases as verifications are billed; increases when a top-up settles via Stripe webhook.
\- Currency is always USD.
\- Configure auto-refill in Console → Billing; requires a saved Stripe payment method (card, SEPA, or US ACH). The auto-refill amount is $50 to $10,000, added at face value, the same range as a manual top-up.
\- Poll at a low cadence (every few minutes max) — balance only changes when usage is billed or a top-up settles.

Common patterns:
\- Gate session creation in production — stop opening new sessions if balance drops below your operational floor.
\- Power internal dashboards / low-balance alerts.
\- Detect misconfigured auto-refill: auto_refill_enabled=true with null auto_refill_amount/threshold means it's effectively off (or no eligible payment method on file).

Failure modes (envelope {"detail": "..."}):
\- 401 — missing/malformed x-api-key.
\- 403 — key valid but bound application not allowed to read billing.
\- 429 — rate-limited.

See /getting-started/pricing for the credit consumption model and POST /v3/billing/top-up/ to add funds programmatically.

For end-to-end Didit integration, paste in the full prompt at /integration/integration-prompt.`

\</pre>



      
      

Pegar en



## OpenAPI

````yaml es/openapi-25.json GET /v3/billing/balance/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: API de verificación de identidad. Autentícate con el encabezado x-api-key.
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/billing/balance/:
    get:
      tags:
        - Billing
      summary: Obtener el saldo de créditos
      description: >-
        Obtiene el saldo de crédito prepago actual en USD (para toda la
        organización) junto con la configuración de recarga automática. Los
        importes son cadenas decimales: analízalos con una biblioteca decimal.
      operationId: get_billing_balance
      responses:
        '200':
          description: >-
            Saldo de créditos actual y configuración de recarga automática de la
            organización.
          content:
            application/json:
              schema:
                type: object
                required:
                  - balance
                  - auto_refill_enabled
                properties:
                  balance:
                    type: string
                    description: >-
                      Saldo de créditos prepago actual en USD, como cadena
                      decimal de punto fijo. Disminuye a medida que se facturan
                      las verificaciones y aumenta cuando se liquida una
                      recarga.
                  auto_refill_enabled:
                    type: boolean
                    description: >-
                      Si es `true`, Didit cargará automáticamente el método de
                      pago guardado para añadir créditos cuando el saldo cruce
                      `auto_refill_threshold`. Se configura desde Console →
                      Facturación.
                  auto_refill_amount:
                    type: string
                    nullable: true
                    description: >-
                      Importe en USD que se cobrará y se añadirá al saldo en
                      cada recarga automática, por su valor nominal. Se
                      configura entre \$50 y \$10,000 en Console → Facturación.
                      `null` cuando la recarga automática está desactivada o no
                      está configurada.
                  auto_refill_threshold:
                    type: string
                    nullable: true
                    description: >-
                      Umbral de activación en USD. La recarga automática se
                      activa cuando `balance` cae por debajo de este valor.
                      `null` cuando la recarga automática está deshabilitada o
                      no configurada.
              examples:
                Healthy balance with auto-refill:
                  value:
                    balance: '1234.5600'
                    auto_refill_enabled: true
                    auto_refill_amount: '500.00'
                    auto_refill_threshold: '100.00'
                Low balance, manual top-up only:
                  value:
                    balance: '12.0000'
                    auto_refill_enabled: false
                    auto_refill_amount: null
                    auto_refill_threshold: null
        '403':
          description: >-
            Falta la clave de API, no es válida o fue revocada, o la clave no
            puede leer los datos de facturación de esta organización. Si falta
            la clave, se devuelve `403`; si es incorrecta, fue revocada o
            expiró, se devuelve `401`.
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    detail: You do not have permission to perform this action.
        '429':
          description: >-
            Límite de solicitudes superado; espera y reintenta cuando haya
            pasado el intervalo indicado en `Retry-After`.
          content:
            application/json:
              examples:
                Throttled:
                  value:
                    detail: Request was throttled. Expected available in 30 seconds.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: |-
            curl -X GET 'https://verification.didit.me/v3/billing/balance/' \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.billing.retrieve_balance()
            print(result)
        - lang: javascript
          label: Node.js
          source: |-
            import Didit from "@didit-protocol/sdk-node";

            // Reads DIDIT_API_KEY.
            const didit = new Didit();

            const result = await didit.billing.retrieveBalance();
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Billing.RetrieveBalance(ctx)\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: |-
            import me.didit.Didit;

            // Reads DIDIT_API_KEY.
            Didit client = new Didit();

            var result = client.billing().retrieveBalance();
            System.out.println(result);
        - lang: php
          label: PHP
          source: |-
            <?php

            require 'vendor/autoload.php';

            use Didit\DiditClient;

            // Reads DIDIT_API_KEY.
            $didit = new DiditClient();

            $result = $didit->billing->retrieveBalance();
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # Reads DIDIT_API_KEY.
            didit = Didit::Client.new

            result = didit.billing.retrieve_balance
            puts result.to_h
        - lang: csharp
          label: .NET
          source: |-
            using System;
            using System.Text.Json;
            using Didit;

            // Reads DIDIT_API_KEY.
            using var client = new DiditClient();

            var result = await client.Billing.RetrieveBalanceAsync();
            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        La clave de API de tu aplicación, que encontrarás en Developers -> API
        keys en la Business Console. La clave principal tiene acceso completo.
        Una clave con nombre puede tener un alcance limitado: ninguno, lectura o
        escritura por recurso, limitada a algunos flujos o a sesiones aprobadas,
        a una lista de direcciones IP y a una fecha de caducidad. 401 significa
        que la clave es incorrecta, se revocó o expiró; 403 significa que no se
        envió ninguna clave, que la clave no tiene acceso a este recurso o
        acción, o que la solicitud provino de una dirección fuera de su lista de
        IP; 404 en una ruta de sesión significa que la sesión está fuera de los
        flujos o estados de la clave. Una clave sin acceso a contenido
        multimedia recibe las URL de imágenes, videos y PDF como null, y una
        clave sin permiso de escritura en sesiones recibe los enlaces y tokens
        de sesión como null. Consulta https://docs.didit.me/console/api-keys.

````

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