# PUT /api/v1/vendor-credits/{vendor_credit_id}

> Update vendor credit

- **Tag:** vendor-credits
- **Operation ID:** `update_vendor_credit_api_v1_vendor_credits__vendor_credit_id__put`

## Description

Update a draft vendor credit.

## Authentication

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

## Parameters

- `vendor_credit_id` (path, string, required)

## Request body

Schema: `VendorCreditUpdate`

- `amount_cents` (integer) — Credit amount in cents
- `reason` (VendorCreditReasonEnum) — Reason for the vendor credit
- `description` (string) — Description of the credit
- `bill_id` (string) — Original bill being credited
- `issue_date` (string · date) — Issue date
- `line_items` (array · VendorCreditLineItem) — Line items for credit detail
- `internal_notes` (string) — Internal notes
- `vendor_credit_number` (string) — Vendor's reference number

## Responses

### 200 — Successful Response

Schema: `VendorCreditResponse`

- `id` (string · required) — Vendor credit ID
- `business_id` (string · required) — Business receiving the credit
- `vendor_id` (string · required) — Vendor issuing the credit
- `bill_id` (string) — Original bill being credited
- `number` (string) — Auto-generated vendor credit number (e.g. VC-0001)
- `vendor_credit_number` (string) — Vendor's own reference number (from the credit doc)
- `status` (string · required) — Status: draft, issued, partially_applied, applied, void
- `currency` (string · required) — ISO currency code (e.g. USD)
- `amount` (integer · required) — Total credit amount in cents
- `amount_in_dollars` (string · required) — Total credit amount in dollars
- `amount_applied` (integer · required) — Amount applied in cents
- `amount_applied_in_dollars` (string · required) — Amount applied in dollars
- `amount_remaining` (integer · required) — Remaining amount in cents
- `amount_remaining_in_dollars` (string · required) — Remaining amount in dollars
- `issue_date` (string · date · required) — Date the credit was issued
- `applied_date` (string · date-time) — When credits were fully applied
- `created_at` (string · date-time · required) — Record creation timestamp
- `updated_at` (string · date-time · required) — Last update timestamp
- `reason` (string · required) — Reason code
- `reason_display` (string · required) — Human-readable reason label
- `description` (string) — Description of the credit
- `internal_notes` (string) — Internal notes
- `line_items` (object) — Detailed line items breakdown
- `voided_at` (string · date-time) — When the credit was voided
- `voided_reason` (string) — Reason for voiding
- `vendor_name` (string) — Vendor display name
- `bill_number` (string) — Original bill number
- `bill_applications` (array · VendorCreditApplicationResponse) — Applications to bills
- `can_be_applied` (boolean · required) — Whether credits can be applied to bills
- `can_be_voided` (boolean · required) — Whether the credit can be voided
- `can_be_deleted` (boolean · required) — Whether the credit can be deleted (drafts only)
- `has_applications` (boolean · required) — Whether any credits have been applied

### 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 PUT 'https://api.ondayzero.com/api/v1/vendor-credits/{vendor_credit_id}' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount_cents": 0,
  "reason": "string",
  "description": "string",
  "bill_id": "string",
  "issue_date": "2026-01-01",
  "line_items": []
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/vendor-credits/{vendor_credit_id}', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "amount_cents": 0,
  "reason": "string",
  "description": "string",
  "bill_id": "string",
  "issue_date": "2026-01-01",
  "line_items": []
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "amount_cents": 0,
  "reason": "string",
  "description": "string",
  "bill_id": "string",
  "issue_date": "2026-01-01",
  "line_items": []
}

response = httpx.put("https://api.ondayzero.com/api/v1/vendor-credits/{vendor_credit_id}", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/vendor-credits/update-vendor-credit
- OpenAPI slice: https://www.ondayzero.com/docs/reference/vendor-credits/update-vendor-credit/openapi.json
- Other endpoints in **vendor-credits**: https://www.ondayzero.com/docs/reference/vendor-credits
