# Update supplier

Last updated: 2026-11-26

Update an existing supplier record.

 

## Request

 

` PUT https://api.myzahara.net/api/{businessUnitApiKey}/Supplier/Update/{supplierId} `

 

Send ` Accept: application/json ` and ` Content-Type: application/json `.

 

Send the body as JSON. Keep strings quoted, and retain the object, array or scalar shape shown below.

 

### Request body example

 

Replace the fictional identifiers and values with those for your business.

 

```json
{
  "Address": {
    "AddressId": 1001,
    "AddressLines": "Example AddressLines",
    "Postcode": "",
    "CountryCodeId": 1002,
    "CountryCode": "gb",
    "AddressType": 2,
    "IsPrimary": false,
    "Void": false,
    "LastUpdated": "2026-01-15T10:30:00Z"
  },
  "BankAccountNumber": "",
  "BankSortCode": "",
  "BusinessUnitId": 1003,
  "ContactName": "Example ContactName",
  "CountryCode": "gb",
  "CountryCodeId": 1002,
  "DefaultNominalCode": null,
  "DefaultNominalCodeId": null,
  "DefaultPaymentTerms": 0,
  "PaymentTermStartType": 0,
  "PaymentTermDaysNumber": 1,
  "PaymentTermType": 1,
  "DefaultTaxCode": null,
  "DefaultTaxCodeId": null,
  "Email": null,
  "SupplierEmails": null,
  "LastUpdated": "2026-01-15T10:30:00Z",
  "DateCreated": "2026-01-15T10:30:00Z",
  "Products": [],
  "ReferenceNumber": "EXAMPLE-001",
  "SupplierId": 1004,
  "SupplierName": "Example SupplierName",
  "Telephone": "",
  "VatReg": "",
  "Void": false,
  "SmartName": "Example SmartName",
  "IsActive": true,
  "DefaultCostCodeId": null,
  "DefaultCostCode": null,
  "Type": "Example Type",
  "DefaultCurrencyId": 1005,
  "TrustedStatus": false,
  "DefaultDivisionId": null,
  "SupplierBankIBANNumber": null,
  "SupplierBankSwiftCode": null,
  "SupplierBankName": null,
  "SupplierBankAddress": null
}
```

 

### Request fields

 

| Field | Example JSON type | Use |
| --- | --- | --- |
| Address | object | Address object; preserve nullable fields. |
| BankAccountNumber | string | Value associated with this record. |
| BankSortCode | string | Value associated with this record. |
| BusinessUnitId | number | Owning business-unit reference. |
| ContactName | string | Value associated with this record. |
| CountryCode | string | Country short code. |
| CountryCodeId | number | Numeric or external reference; use the appropriate resource context. |
| DefaultNominalCode | null | Value associated with this record. |
| DefaultNominalCodeId | null | Default nominal-code reference. |
| DefaultPaymentTerms | number | Value associated with this record. |
| PaymentTermStartType | number | Value associated with this record. |
| PaymentTermDaysNumber | number | Value associated with this record. |
| PaymentTermType | number | Value associated with this record. |
| DefaultTaxCode | null | Value associated with this record. |
| DefaultTaxCodeId | null | Default tax-code reference. |
| Email | null | Email address; treat it as personal/business data. |
| SupplierEmails | null | Value associated with this record. |
| LastUpdated | string | Record update timestamp. |
| DateCreated | string | Record creation timestamp. |
| Products | array | Value associated with this record. |
| ReferenceNumber | string | Business-facing supplier reference. |
| SupplierId | number | Numeric supplier reference. |
| SupplierName | string | Supplier display name. |
| Telephone | string | Value associated with this record. |
| VatReg | string | Value associated with this record. |
| Void | boolean | Void flag. Choose changes deliberately. |
| SmartName | string | Value associated with this record. |
| IsActive | boolean | Activity flag. |
| DefaultCostCodeId | null | Numeric or external reference; use the appropriate resource context. |
| DefaultCostCode | null | Value associated with this record. |
| Type | string | Value associated with this record. |
| DefaultCurrencyId | number | Numeric or external reference; use the appropriate resource context. |
| TrustedStatus | boolean | Value associated with this record. |
| DefaultDivisionId | null | Numeric or external reference; use the appropriate resource context. |
| SupplierBankIBANNumber | null | Value associated with this record. |
| SupplierBankSwiftCode | null | Value associated with this record. |
| SupplierBankName | null | Value associated with this record. |
| SupplierBankAddress | null | Value associated with this record. |

 

## Authentication and scope

 

Use the API key for the business unit that owns these records. A tenancy key, business-unit ID and resource ID are different values.

 

Keep credentials in environment variables or a secret store. They appear in the URL path: redact URLs in logs, monitoring and errors. Do not share real keys, workflow tokens or customer responses with a coding agent.

 

## Working examples

 

Set the environment variables below, then run one example. Node.js requires version 22+; Python uses its standard library. cURL requires 7.76.0+ and Python 3 for path/query encoding. The clients use a 30-second timeout and do not automatically retry.

 

| Environment variable | Purpose |
| --- | --- |
| ZAHARA\_BUSINESS\_UNIT\_API\_KEY | Private business-unit API key. |
| ZAHARA\_SUPPLIER\_ID | supplierId. Use an integer reference or offset as appropriate. |
| ZAHARA\_API\_BASE\_URL | Selected API origin, without an /api path. |
| ZAHARA\_REQUEST\_FILE | File containing the JSON request body. |

 

### cURL

 

```sh
# cURL 7.76.0+ and Python 3. Keep credentials and business data private.
set -e
export ZAHARA_BUSINESS_UNIT_API_KEY="${ZAHARA_BUSINESS_UNIT_API_KEY:?Set ZAHARA_BUSINESS_UNIT_API_KEY}"
export ZAHARA_SUPPLIER_ID="${ZAHARA_SUPPLIER_ID:?Set ZAHARA_SUPPLIER_ID}"
export ZAHARA_API_BASE_URL="${ZAHARA_API_BASE_URL:?Set ZAHARA_API_BASE_URL}"
export ZAHARA_REQUEST_FILE="${ZAHARA_REQUEST_FILE:?Set ZAHARA_REQUEST_FILE}"
encoded_supplierId="$(python3 -c 'import os; from urllib.parse import quote; print(quote(os.environ["ZAHARA_SUPPLIER_ID"], safe=""))')"

curl --fail-with-body --silent --show-error --max-time 30 \
  --request PUT --header 'Accept: application/json' --header 'Content-Type: application/json' --data-binary "@${ZAHARA_REQUEST_FILE}" \
  "${ZAHARA_API_BASE_URL:?Set ZAHARA_API_BASE_URL}/api/${ZAHARA_BUSINESS_UNIT_API_KEY:?Set ZAHARA_BUSINESS_UNIT_API_KEY}/Supplier/Update/${encoded_supplierId}"
```

 

### JavaScript (Node.js 22+)

 

```javascript
// Node.js 22+. Standard library only.
import { readFileSync } from 'node:fs';
function required(name, fallback) { const value=process.env[name] || fallback; if(!value) throw new Error('Set '+name); return value; }
const ZAHARA_BUSINESS_UNIT_API_KEY=required('ZAHARA_BUSINESS_UNIT_API_KEY');
const ZAHARA_SUPPLIER_ID=required('ZAHARA_SUPPLIER_ID');
const ZAHARA_API_BASE_URL=required('ZAHARA_API_BASE_URL');
const ZAHARA_REQUEST_FILE=required('ZAHARA_REQUEST_FILE');
let path="Supplier/Update/{supplierId}";
path=path.replace('{supplierId}',encodeURIComponent(ZAHARA_SUPPLIER_ID));
const base=ZAHARA_API_BASE_URL.replace(/\/$/, '');
const url=new URL(base+'/api/'+encodeURIComponent(ZAHARA_BUSINESS_UNIT_API_KEY)+'/'+path);

const body=JSON.stringify(JSON.parse(readFileSync(ZAHARA_REQUEST_FILE,'utf8')));
let response;
try { response=await fetch(url,{method:'PUT',headers:{Accept:'application/json','Content-Type':'application/json'},body,signal:AbortSignal.timeout(30000),redirect:'error'}); }
catch { throw new Error('Request failed or timed out; URL omitted to protect credentials'); }
if(!response.ok) throw new Error('Zahara returned HTTP '+response.status);
const text=await response.text();
const result=text.trim()?JSON.parse(text):null;
console.log(JSON.stringify(result,null,2));
```

 

### Python 3

 

```python
# Python 3, standard library.
import os,json
from urllib.parse import quote,urlencode
from urllib.request import Request,build_opener,HTTPRedirectHandler
from urllib.error import HTTPError,URLError
class NoRedirect(HTTPRedirectHandler):
    def redirect_request(self,req,fp,code,msg,headers,newurl): return None
def required(name,fallback=None):
    value=os.environ.get(name) or fallback
    if not value: raise SystemExit('Set '+name)
    return value
ZAHARA_BUSINESS_UNIT_API_KEY=required('ZAHARA_BUSINESS_UNIT_API_KEY')
ZAHARA_SUPPLIER_ID=required('ZAHARA_SUPPLIER_ID')
ZAHARA_API_BASE_URL=required('ZAHARA_API_BASE_URL')
ZAHARA_REQUEST_FILE=required('ZAHARA_REQUEST_FILE')
path="Supplier/Update/{supplierId}"
path=path.replace('{supplierId}',quote(ZAHARA_SUPPLIER_ID,safe=''))
base=ZAHARA_API_BASE_URL.rstrip('/')
url=base+'/api/'+quote(ZAHARA_BUSINESS_UNIT_API_KEY,safe='')+'/'+path
with open(ZAHARA_REQUEST_FILE,encoding='utf-8') as file: body=json.dumps(json.load(file)).encode('utf-8')
request=Request(url,data=body,method='PUT',headers={'Accept':'application/json','Content-Type':'application/json'})
try:
    with build_opener(NoRedirect).open(request,timeout=30) as response:
        data=response.read()
except HTTPError as error: raise SystemExit('Zahara returned HTTP '+str(error.code)) from None
except URLError: raise SystemExit('Request failed; URL omitted to protect credentials') from None
text=data.decode('utf-8')
result=json.loads(text) if text.strip() else None
print(json.dumps(result,indent=2))
```

 

## Successful response

 

Check the HTTP status before using the result. Parse a JSON body when present, and handle an empty successful body separately. Retrieve the relevant record afterwards to confirm the intended change.

 

## Handling failures

 

Check the HTTP status before parsing or saving the body as a business result. Handle authentication failures, missing records, invalid references, timeouts and unexpected formats separately. Do not turn a failed request into \[\], null, false or a zero count. Redact credential-bearing URLs and avoid logging personal or financial data.

 

## Integration notes

 

- Keep SupplierId separate from ReferenceNumber and SupplierName. Supplier records can include contact and banking data; avoid logging full responses.
- After a timeout or uncertain outcome, reconcile current state before retrying. A failed HTTP request is not proof that no change occurred.
- Use numeric identifiers where an identifier is requested. Preserve formatting and leading zeros in displayed document numbers and business codes.

 

[Enum reference](https://help.zaharasoftware.com/api-docs/enums-complete-list.md) · [API overview](https://help.zaharasoftware.com/api-docs/home.md)
