# POST /api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/payments

> Record a payment against a debt instrument

- **Tag:** cfo-portal
- **Operation ID:** `cfo_portal_record_debt_payment`

## Description

Record a payment on a loan, posting a balanced principal/interest entry.

**Request Body:**
- `payment_amount_cents`: total payment, split into principal + interest.
- `cash_ledger_id`: bank/cash account the money moves through.
- `payment_date`: optional, defaults to today.
- `memo`: optional journal-entry memo.
- `transaction_id`: optional — when supplied, rebook the transaction's
  existing journal entry into the principal/interest split and link the
  subledger row to that transaction.

The principal and interest accounts are resolved by direction:
debt we owe pays down Long-Term Debt with Interest Expense; a note
receivable collects against Notes Receivable with Interest Income.
Decrements the instrument's outstanding balance by the principal
portion.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `business_id` (path, string, required)
- `instrument_id` (path, string, required)

## Request body

Schema: `DebtPaymentRequest`

- `payment_amount_cents` (integer) — Total payment amount in cents (split into principal + interest). Omit when ``transaction_id`` is supplied — the transaction amount is used instead.
- `cash_ledger_id` (string) — Bank/cash ledger the money moves through — paid from (debt we owe) or received into (a note receivable). Optional when ``transaction_id`` is supplied (derived from the transaction JE).
- `payment_date` (string · date) — Payment date (defaults to today).
- `memo` (string)
- `transaction_id` (string) — When set, rebook this bank transaction's journal entry into the principal + interest split instead of creating a standalone JE.

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_DebtPaymentResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (DebtPaymentResponse)

### 400 — Bad Request - Invalid input

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 401 — Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 403 — Forbidden - Insufficient permissions

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 404 — Not Found - Resource does not exist

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation Error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/payments' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "payment_amount_cents": 0,
  "cash_ledger_id": "string",
  "payment_date": "2026-01-01",
  "memo": "string",
  "transaction_id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/payments', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "payment_amount_cents": 0,
  "cash_ledger_id": "string",
  "payment_date": "2026-01-01",
  "memo": "string",
  "transaction_id": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {'payment_amount_cents': 0,
 'cash_ledger_id': 'string',
 'payment_date': '2026-01-01',
 'memo': 'string',
 'transaction_id': 'string'}

response = httpx.post("https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/payments", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/cfo-portal/cfo-portal-record-debt-payment
- OpenAPI slice: https://www.ondayzero.com/docs/reference/cfo-portal/cfo-portal-record-debt-payment/openapi.json
- Other endpoints in **cfo-portal**: https://www.ondayzero.com/docs/reference/cfo-portal (markdown bundle: https://www.ondayzero.com/docs/reference/cfo-portal.md, OpenAPI: https://www.ondayzero.com/docs/reference/cfo-portal/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
