# Update Vendor

`PATCH /accounting/vendors/{id}`

Group: Accounting › Vendors · Operation ID: `updateVendor`

Updates the vendor with the given identifier. Only the fields in the request body change.

Only the fields in the request body change. Renaming the vendor also renames the business partner the rest of finance posts against. bankDetails and remittanceAddress are whole sub-objects: sending one replaces its fields, and a vendor that has none has them created on first supply. attachments is tri-state: omit it to keep the current set, send null to remove them all, or send a non-empty array to replace the set, and an empty array is ignored. vendorType and externalVendorId cannot be changed, so this endpoint does not accept them. To retire a vendor with history, set status to 'inactive' rather than deleting it. The response is empty. Read the updated record with GET accounting/vendors/:id.

[Open in the interactive reference](https://docs.api.lensing.ai/?op=updateVendor)

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | `"v1"` | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `Idempotency-Key` | header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with `400 IDEMPOTENCY_NOT_SUPPORTED` rather than silently ignored. |
| `id` | path | string | yes | The unique identifier for the vendor to update. |

## Request body

Required, `application/json`: updateVendorInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `vendorName` | string | no | The new name of the vendor. Omit to leave it unchanged. |
| `status` | string | no | The new lifecycle status. Accepted values: 'active', 'inactive'. Setting 'inactive' retires a vendor with history without deleting it. |
| `paymentTerms` | string | no | The new default payment-terms key. Omit to leave it unchanged. Stored as supplied. |
| `vendorSubType` | string | no | The new sub-type. Accepted values: 'direct', 'indirect'. Omit to leave it unchanged. |
| `mainContactName` | string | no | The new primary contact name. Omit to leave it unchanged. |
| `mainContactEmail` | string | no | The new primary contact email. Omit to leave it unchanged. |
| `mainContactPhone` | string | no | The new primary contact phone. Omit to leave it unchanged. |
| `billingEmail` | string | no | The new billing email. Omit to leave it unchanged. |
| `preferredCurrency` | string | no | The new preferred currency. Format ISO 4217, for example 'USD'. Omit to leave it unchanged. |
| `preferredLanguage` | string | no | The new preferred language. Omit to leave it unchanged. |
| `independentContractor` | string | no | The new independent-contractor value. Accepted values: 'yes', 'no', 'unsure'. Omit to leave it unchanged. |
| `origin` | string | no | The new source system. Omit to leave it unchanged. |
| `defaultAccountId` | string | no | The new default GL account. Omit to leave it unchanged. See id on GET accounting/accounts/:id. |
| `departmentId` | string | no | The new default department. Omit to leave it unchanged. See id on GET departments/:id. |
| `vendorEntityId` | string | no | The new legal entity. Omit to leave it unchanged. See id on GET base/entities. |
| `bankDetails` | object | no | The bank account the vendor is paid into. Sending this replaces the bank-detail fields. Omit it to leave the bank details unchanged. |
| `bankDetails.bankAccountNumber` | string | no | The vendor's bank account number, or IBAN. |
| `bankDetails.bankAccountType` | string | no | The kind of bank account, as your tenant's account-type list spells it. |
| `bankDetails.bankAccountHolderName` | string | no | The name the account is held in. |
| `bankDetails.bankAccountNumberType` | string | no | How to read bankAccountNumber. One of 'iban', 'achOrWire' or 'other'. |
| `bankDetails.financialInstitutionId` | string | no | The bank's identifier, a BIC, SWIFT or routing number. |
| `bankDetails.financialInstitutionIdType` | string | no | How to read financialInstitutionId. |
| `remittanceAddress` | object | no | The address remittance advice is sent to. Sending this replaces the address fields. Omit it to leave the address unchanged. |
| `remittanceAddress.line1` | string | yes | The first address line: street number and name, or PO box. |
| `remittanceAddress.line2` | string | no | The second address line: apartment, suite, unit, building or floor. |
| `remittanceAddress.city` | string | yes | The city or locality. |
| `remittanceAddress.stateProvince` | string | no | The state, province or region. |
| `remittanceAddress.zipCode` | string | yes | The postal or ZIP code. |
| `remittanceAddress.country` | string | yes | The country, as a name or ISO 3166-1 code. |
| `remittanceAddress.attention` | string | no | The person or department that mail to this address is for. |
| `attachments` | array of object or null | no | The files attached to the vendor. Omit to keep the current set. Send null to remove them all. Send a non-empty array to replace the set. An empty array is ignored, so send null to clear. |
| `attachments[].fileName` | string | yes | The display name of the attached file. |
| `attachments[].fileId` | string | yes | The identifier of the already-uploaded file. |

Example:

```json
{
  "vendorName": "<vendorName>",
  "status": "<status>",
  "paymentTerms": "net60",
  "vendorSubType": "<vendorSubType>",
  "mainContactName": "Dana Fischer-Weiss",
  "mainContactEmail": "<mainContactEmail>",
  "mainContactPhone": "<mainContactPhone>",
  "billingEmail": "<billingEmail>",
  "preferredCurrency": "<preferredCurrency>",
  "preferredLanguage": "<preferredLanguage>",
  "independentContractor": "<independentContractor>",
  "origin": "<origin>",
  "defaultAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "departmentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "vendorEntityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "bankDetails": {
    "bankAccountNumber": "<bankAccountNumber>",
    "bankAccountType": "<bankAccountType>",
    "bankAccountHolderName": "<bankAccountHolderName>",
    "bankAccountNumberType": "<bankAccountNumberType>",
    "financialInstitutionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "financialInstitutionIdType": "<financialInstitutionIdType>"
  },
  "remittanceAddress": {
    "line1": "<line1>",
    "line2": "<line2>",
    "city": "<city>",
    "stateProvince": "<stateProvince>",
    "zipCode": "<zipCode>",
    "country": "<country>",
    "attention": "<attention>"
  },
  "attachments": [
    {
      "fileName": "<fileName>",
      "fileId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    }
  ]
}
```

## Response

`200` Success

## Response headers

- `Idempotency-Replayed` — Present and `true` only when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent as `false`.

## Errors

| Code | Status |
| --- | --- |
| `NOT_FOUND` | 400 |
| `REFERENCE_NOT_FOUND` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND, REFERENCE_NOT_FOUND
- `401` — Missing or invalid access token
- `403` — Not authorized
- `404` — Not found
- `409` — The Idempotency-Key is still being processed by another request.
- `422` — The Idempotency-Key was already used with a different request payload.
- `429` — Too many requests
- `500` — Internal server error
