askledgerDocs
REST-APIContacts
Documentatie

Update a supplier

PATCH
/ledgers/{ledgerId}/contacts/{supplierId}

Update an existing supplier in the accounting package from an invoice: correct its name (e.g. a typo or a new legal name), or fill in an IBAN, KvK number or VAT number that is still empty. This is a permanent change. IBAN, KvK and VAT number can never be replaced: when the supplier already has another value the call fails with field_already_set and nothing changes. Never retry with other values; tell the user that a different bank account or registration on an invoice can be a sign of invoice fraud, and that they change such fields in the accounting package itself. Find the supplier with search-contacts first (by kvk or iban, then by name). Values equal to the current ones change nothing. The IBAN must have valid check digits (invalid_iban), the VAT number a valid format and checksum (invalid_vat_number), and a KvK number must be in the KvK register under a name that fits the (new) name (kvk_name_mismatch). The user must confirm a summary with old → new per field before anything changes. If the result has created=false and a confirmation object, nothing was changed yet: show confirmation.summary to the user verbatim and ask whether to make these changes. Only after the user explicitly says yes in the chat, call update-supplier again with exactly the same arguments plus confirmationToken. Never confirm on the user's behalf and never reuse a token for other arguments.

A write: over REST only LedgerSuite products with askledger:purchase-write can call it, after their user approved the write in the product (no confirmation is asked). Other callers get 403 confirmation_required and use the MCP tool, which asks the user to confirm. Purchase entries: 409 duplicate when the package already has the booking (same supplier and invoice number); nothing was booked then. Send an Idempotency-Key to make retries safe.

Requires the ledger:write scope (Wijzigen in Exact). Same operation as the MCP tool update-supplier.

Authorization

bearer
headerAuthorizationBearer <token>

A company group API key (al_live_…, created at /dashboard/api), an OAuth access token from the same authorization flow MCP clients use, or (other LedgerSuite products, /administrations routes only) a LedgerSuite client_credentials token.

Path Parameters

ledgerId*string

Ledger (administration) id, from list-ledgers

Length1 <= length
supplierId*string

Contact id (con_…) from search-contacts, or its remoteId

Length1 <= length

Header Parameters

Idempotency-Key?string

Unique per write (e.g. your own id for it), at most 255 characters. A retry with the same key and body gets the first response again (header Idempotent-Replayed: true) instead of a second write; the same key with another body answers 422 idempotency_key_reused, and a retry while the first request still runs 409 idempotency_in_progress. Kept for 7 days.

Lengthlength <= 255

Request Body

application/json
  1. body
name?string

New name, e.g. the legal name on the invoice

Length1 <= length <= 50
iban?string

IBAN to add; only when the supplier has no bank account yet

Length1 <= length <= 34
kvk?string

KvK number to add, 8 digits; only when empty

Match^\d{8}$
vatNumber?string

VAT number to add, with country prefix; only when empty

Length4 <= length <= 20
source?

Where the new values come from, kept in the audit trail

Response Body

OK

application/json
  1. response
created*boolean

True when the changes were written to the package

message*string
confirmation*|null
contact*

Customer and/or supplier

changes*array<>

Changed fields (or, before confirmation, the fields that will change)

curl -X PATCH "https://example.com/ledgers/string/contacts/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "created": true,  "message": "string",  "confirmation": {    "token": "string",    "summary": "string",    "expiresInSeconds": 0  },  "contact": {    "id": "string",    "remoteId": "string",    "code": "string",    "name": "string",    "email": "string",    "kvk": "string",    "vatNumber": "string",    "isCustomer": true,    "isSupplier": true,    "blocked": true,    "ibans": [      "string"    ],    "remoteStatus": "string",    "remoteUpdatedAt": "string",    "updatedAt": "string",    "deletedAt": "string"  },  "changes": [    {      "field": "name",      "from": "string",      "to": "string"    }  ]}