---
title: "Ajustar saldo de cuenta"
description: "Corrige un saldo por cobrar o por pagar con un motivo auditable."
language: es-MX
canonical_url: "https://exac.mx/docs/mcp/tools/adjust_account_balance"
md_url: "https://exac.mx/docs/mcp/tools/adjust_account_balance.md"
---

# Ajustar saldo de cuenta

Corrige un saldo por cobrar o por pagar con un motivo auditable.

Herramienta: `adjust_account_balance`

## Propósito

Corrige un saldo por cobrar o por pagar con un motivo auditable.

### Úsala cuando

Se requiere una corrección contable documentada.

### No la uses cuando

El cambio representa un pago, venta, gasto u operación normal.

| Detalle | Valor |
| --- | --- |
| Permisos | Según input.kind: receivable → receivables:manage; payable → payables:manage |
| Efectos secundarios | Destructivo |
| Idempotencia | Idempotente |

## Esquema de entrada

```json
{
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request."
    },
    "input": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "receivable"
            },
            "balanceType": {
              "type": "string",
              "const": "operational"
            },
            "customerId": {
              "type": "string"
            },
            "documentRef": {
              "type": "string",
              "pattern": "^sales_receipt:.+$"
            },
            "targetBalance": {
              "type": "number",
              "minimum": 0
            },
            "reason": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "required": [
            "kind",
            "balanceType",
            "customerId",
            "documentRef",
            "targetBalance",
            "reason"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "receivable"
            },
            "balanceType": {
              "type": "string",
              "const": "fiscalPpd"
            },
            "customerId": {
              "type": "string"
            },
            "documentRef": {
              "type": "string",
              "pattern": "^cfdi:.+$"
            },
            "targetBalance": {
              "type": "number",
              "minimum": 0
            },
            "reason": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "required": [
            "kind",
            "balanceType",
            "customerId",
            "documentRef",
            "targetBalance",
            "reason"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "payable"
            },
            "balanceType": {
              "type": "string",
              "const": "operational"
            },
            "supplierId": {
              "type": "string"
            },
            "documentRef": {
              "type": "string",
              "pattern": "^expense:.+$"
            },
            "targetBalance": {
              "type": "number",
              "minimum": 0
            },
            "reason": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "required": [
            "kind",
            "balanceType",
            "supplierId",
            "documentRef",
            "targetBalance",
            "reason"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "payable"
            },
            "balanceType": {
              "type": "string",
              "const": "fiscalPpd"
            },
            "supplierId": {
              "type": "string"
            },
            "documentRef": {
              "type": "string",
              "pattern": "^cfdi:.+$"
            },
            "targetBalance": {
              "type": "number",
              "minimum": 0
            },
            "reason": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          "required": [
            "kind",
            "balanceType",
            "supplierId",
            "documentRef",
            "targetBalance",
            "reason"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "idempotencyKey",
    "input"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false
}
```

## Esquema de salida

```json
{
  "type": "object",
  "properties": {
    "data": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "previousBalance": {
              "type": "number"
            },
            "previousDocumentBalance": {
              "type": "number"
            },
            "adjustmentAmount": {
              "type": "number"
            },
            "newBalance": {
              "type": "number"
            },
            "newDocumentBalance": {
              "type": "number"
            }
          },
          "required": [
            "previousBalance",
            "previousDocumentBalance",
            "adjustmentAmount",
            "newBalance",
            "newDocumentBalance"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "previousBalance": {
              "type": "number"
            },
            "previousDocumentBalance": {
              "type": "number"
            },
            "adjustmentAmount": {
              "type": "number"
            },
            "newBalance": {
              "type": "number"
            },
            "newDocumentBalance": {
              "type": "number"
            }
          },
          "required": [
            "previousBalance",
            "previousDocumentBalance",
            "adjustmentAmount",
            "newBalance",
            "newDocumentBalance"
          ],
          "additionalProperties": false
        }
      ]
    },
    "error": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "validation_error",
            "unauthenticated",
            "forbidden",
            "not_found",
            "method_not_allowed",
            "conflict",
            "idempotency_conflict",
            "operation_in_progress",
            "recovery_required",
            "rate_limited",
            "provider_unavailable",
            "internal"
          ]
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "properties": {
            "issues": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "message": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "path",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "retryable": {
              "type": "boolean"
            },
            "retryAfterSeconds": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": false
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "oneOf": [
    {
      "required": [
        "data"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
```

## Herramientas relacionadas

- [`get_accounts`](/docs/mcp/tools/get_accounts.md) — **Leer cuentas**: Busca cuentas por cobrar o por pagar y consulta sus movimientos.

- [`record_payment`](/docs/mcp/tools/record_payment.md) — **Registrar pago**: Registra dinero recibido o pagado y lo asigna a saldos abiertos.

## Flujo relacionado

[Consulta los flujos canónicos en la introducción](/docs.md)

## Operaciones REST equivalentes

- [`POST /v1/accounts/receivables/{customerId}/adjustments`](/docs/api/accounts-payments/accounts/create-receivable-adjustment.md)

- [`POST /v1/accounts/payables/{supplierId}/adjustments`](/docs/api/accounts-payments/accounts/create-payable-adjustment.md)

Documentación completa: https://exac.mx/docs.md
Índice para agentes: https://exac.mx/docs/llms.txt
