# Update a vendor

Operation ID: `updateVendor`

Group: Accounting › Vendors

[Open in the interactive reference](https://docs.api.lensing.ai/lensing/v1/endpoints/updateVendor)

`PATCH /accounting/vendors/{id}`

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Updates a vendor with the fields you send. A field you leave out keeps its current value.

Use the vendor's id, not its vendorNumber.

Inside bankDetails and remittanceAddress, a field you leave out also keeps its current value. An attachments list you send replaces the whole list, so include every attachment you want to keep. To remove every attachment, send attachments as null or as an empty array.

The vendor's details, contacts, defaults, bank details, and remittance address can change. Renaming the vendor also renames its business partner.

vendorType and externalVendorId can't be changed, so this endpoint doesn't accept them.

When you send bank details or a remittance address for a vendor that has none, they are created.

The response is empty. To see the updated vendor, use GET accounting/vendors/:id.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | string · 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 of the vendor you want to update. Example: `"a17c3e58-4b62-4d19-8f70-2c5d9e1a6b34"`. |

## 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. Example: `"net60"`. |
| `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. Example: `"Dana Fischer-Weiss"`. |
| `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 general ledger 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 people/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. Accepted values: 'iban', 'achOrWire', '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<object> \| null | no | The files attached to the vendor. Omit to keep the current files. Send null or an empty array to remove them all. A list you send replaces the whole list. |
| `attachments[].fileName` | string | yes | The display name of the attached file. |
| `attachments[].fileId` | string | yes | The identifier of the already-uploaded file. |

```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

```json
{
  "data": {},
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## 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` — The request carries no valid 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 from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
