# PATCH /api/v1/credit/lines/{credit_line_id}

> Update a credit line

- **Tag:** credit
- **Operation ID:** `update_credit_line`

## Description

Change the repayment account, AutoPay, the credit limit, or the status.

Supplying ``credit_limit_cents`` re-approves the line: it emits
``credit.line.limit_changed`` and pushes the new available credit to
the issuer. This is the write behind Request More Funding.

Supplying ``status`` needs ``reason`` and emits
``credit.line.suspended``, ``credit.line.reinstated`` or
``credit.line.closed``. Activating a pending line whose disclosure
awaits the merchant's acknowledgement needs ``acknowledgement_override``
from an operator.

## Authentication

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

## Parameters

- `credit_line_id` (path, string, required)

## Request body

Schema: `CreditLineUpdateRequest`

- `linked_account_name` (string) — Display name of the merchant's repayment account.
- `linked_account_mask` (string) — Last digits of the repayment account.
- `plaid_account_id` (string) — The merchant's Plaid account the repayments leave from.
- `autopay_enabled` (boolean) — Switch AutoPay due events on or off for the line.
- `merchant_email` (string) — Where statements and borrower notices go.
- `merchant_business_id` (string) — The borrower's own DayZero business, when it keeps its books here. An underwriting assessment for the line measures this business. Must be a business the caller can access.
- `external_merchant_id` (string) — Change your merchant identifier on the line. The value it replaces is kept as `previous_external_merchant_id`, with who changed it and when; payer and card mapping references and payout names still match the previous value. The merchant's bank connections and feeds on the program follow the new value. Another open (not closed) line of the same program with the same value is `409` `CREDIT_901`. Cannot be cleared: `null` changes nothing.
- `merchant_legal_name` (string) — The merchant's legal entity name, as printed on disclosures. Cannot be cleared while the program's `compliance.enabled` is true.
- `merchant_state` (string) — Two-letter US state, DC or territory code of the merchant. Selects the disclosure template. Cannot be cleared while the program's `compliance.enabled` is true.
- `merchant_address` (MerchantAddress) — The merchant's registered address. Cannot be cleared while the program's `compliance.enabled` is true.
- `status` (CreditLineStatusEnum) — Move the line between pending, active, suspended and closed. A change needs `reason`. Suspending, reinstating (suspended back to active) and closing emit `credit.line.suspended`, `credit.line.reinstated` and `credit.line.closed`. Closing is refused for an API token when the program's `limit_change_policy` is `console_only`. Sending the status the line already has changes nothing. Activating a `pending` line pushes its available credit to the issuer (or emits `credit.line.limit_changed` for partner-managed cards); while its disclosure awaits the merchant's acknowledgement it is refused (`CREDIT_617`) unless an operator sends `acknowledgement_override`.
- `reason` (string) — Why the status changed. Required with a status change; carried on the event and returned as `status_reason` on the line.
- `acknowledgement_override` (AcknowledgementOverride) — Activate a `pending` line whose disclosure awaits the merchant's acknowledgement without it. Operators in the console only: an API token sending it is `403` (`CREDIT_618`). The disclosure becomes `overridden` with who, when and `reason`, and `credit.disclosure.overridden` is emitted. Ignored on any other status change, or when nothing awaits acknowledgement.
- `reason_code` (string) — Optional category of a suspension or closure: `credit_risk`, `delinquency`, `fraud`, `merchant_request` or `administrative`. On a program with adverse-action notices on, the first three record an adverse action.
- `credit_limit_cents` (integer) — Re-approved limit, in cents. This is the write behind Request More Funding (§6.1) and behind a risk-led reduction. Changing it emits `credit.line.limit_changed` and pushes the new available credit to the issuer, so the card starts declining at the new limit. A reduction below the current balance is allowed — available credit floors at zero and existing loans keep their own terms. Follows the program's `limit_change_policy`: under `approval_required` every caller gets `409` (submit a limit-change request instead); under `console_only` an API token gets `403`.
- `limit_change_reason` (string) — Why the limit moved. Carried on the event and the ledger so an increase can be traced to the decision behind it.

## Responses

### 200 — Successful Response

Schema: `SuccessEnvelope_CreditLineResponse_`

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

### 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 PATCH 'https://api.ondayzero.com/api/v1/credit/lines/{credit_line_id}' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "linked_account_name": "string",
  "linked_account_mask": "string",
  "plaid_account_id": "string",
  "autopay_enabled": false,
  "merchant_email": "string",
  "merchant_business_id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/credit/lines/{credit_line_id}', {
  method: 'PATCH',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "linked_account_name": "string",
  "linked_account_mask": "string",
  "plaid_account_id": "string",
  "autopay_enabled": false,
  "merchant_email": "string",
  "merchant_business_id": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {'linked_account_name': 'string',
 'linked_account_mask': 'string',
 'plaid_account_id': 'string',
 'autopay_enabled': False,
 'merchant_email': 'string',
 'merchant_business_id': 'string'}

response = httpx.patch("https://api.ondayzero.com/api/v1/credit/lines/{credit_line_id}", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/credit/update-credit-line
- OpenAPI slice: https://www.ondayzero.com/docs/reference/credit/update-credit-line/openapi.json
- Other endpoints in **credit**: https://www.ondayzero.com/docs/reference/credit (markdown bundle: https://www.ondayzero.com/docs/reference/credit.md, OpenAPI: https://www.ondayzero.com/docs/reference/credit/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
