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

> Update a credit line

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

## Description

Change the repayment account, AutoPay, or line status.

## 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)
- `linked_account_mask` (string)
- `plaid_account_id` (string)
- `autopay_enabled` (boolean)
- `status` (CreditLineStatusEnum)

## Responses

### 200 — Successful Response

Schema: `SuccessEnvelope_CreditLineResponse_`

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

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

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

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## 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,
  "status": "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,
  "status": "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,
  "status": "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
