Skip to documentation
Zahara DevelopersAPI documentation
DocumentationSuppliers
Download .md
Suppliers

Get supplier by ID

Last updated

Retrieve one supplier using its numeric SupplierId.

Request

GET https://api.myzahara.net/api/{businessUnitApiKey}/Supplier/Get/{supplierId}

Send Accept: application/json.

No request body is required.

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.

cURL

# 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}"
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 GET --header 'Accept: application/json' \
  "https://api.myzahara.net/api/${ZAHARA_BUSINESS_UNIT_API_KEY:?Set ZAHARA_BUSINESS_UNIT_API_KEY}/Supplier/Get/${encoded_supplierId}"

JavaScript (Node.js 22+)

// Node.js 22+. Standard library only.
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');
let path="Supplier/Get/{supplierId}";
path=path.replace('{supplierId}',encodeURIComponent(ZAHARA_SUPPLIER_ID));
const base='https://api.myzahara.net';
const url=new URL(base+'/api/'+encodeURIComponent(ZAHARA_BUSINESS_UNIT_API_KEY)+'/'+path);

let response;
try { response=await fetch(url,{method:'GET',headers:{Accept:'application/json'},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 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')
path="Supplier/Get/{supplierId}"
path=path.replace('{supplierId}',quote(ZAHARA_SUPPLIER_ID,safe=''))
base='https://api.myzahara.net'
url=base+'/api/'+quote(ZAHARA_BUSINESS_UNIT_API_KEY,safe='')+'/'+path
request=Request(url,method='GET',headers={'Accept':'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 status before parsing JSON. Handle nullable results and arrays according to the returned body, and keep a missing record separate from an authentication or transport failure.

Response example

Fictional business data; array length is illustrative.

{
  "Address": {
    "AddressId": 1001,
    "AddressLines": null,
    "Postcode": "",
    "CountryCodeId": null,
    "CountryCode": "gb",
    "AddressType": 2,
    "IsPrimary": false,
    "Void": false,
    "LastUpdated": "2026-01-15T10:30:00Z"
  },
  "BankAccountNumber": "",
  "BankSortCode": "",
  "BusinessUnitId": 1002,
  "ContactName": null,
  "CountryCode": "gb",
  "CountryCodeId": null,
  "DefaultNominalCode": "EXAMPLE-001",
  "DefaultNominalCodeId": 1003,
  "DefaultPaymentTerms": 0,
  "PaymentTermStartType": 0,
  "PaymentTermDaysNumber": 1,
  "PaymentTermType": 1,
  "DefaultTaxCode": null,
  "DefaultTaxCodeId": null,
  "Email": "example@example.com",
  "SupplierEmails": [
    {
      "Email": "example@example.com",
      "AddedOn": "Example AddedOn",
      "SupplierEmailTypeDescription": "example@example.com",
      "SupplierEmailType": 1,
      "SupplierEmailId": 1004
    }
  ],
  "LastUpdated": "2026-01-15T10:30:00Z",
  "DateCreated": "2026-01-15T10:30:00Z",
  "Products": [
    {
      "SyncFriendlyName": "Example SyncFriendlyName",
      "ProductId": 1005,
      "ProductName": "Example ProductName",
      "NetValue": 100,
      "DiscountPercentage": 0,
      "TaxCodeId": 1006,
      "NominalCodeId": null,
      "CostCodeId": null,
      "ProjectId": null,
      "SyncId": null,
      "SyncDate": null,
      "SyncType": null,
      "ProductCode": "EXAMPLE-001",
      "SupplierProductCode": "EXAMPLE-001",
      "SupplierId": 1007,
      "Void": false,
      "LastUpdated": "2026-01-15T10:30:00Z",
      "Unit": null,
      "Supplier": {
        "IsSelected": false,
        "IsDeleted": false,
        "SyncFriendlyName": "Example SyncFriendlyName",
        "Id": 1007,
        "ViewModeOnly": false,
        "DefaultOrdersEmail": "example@example.com",
        "SupplierId": 1007,
        "BusinessUnitId": 1002,
        "SupplierName": "Example SupplierName",
        "ContactName": null,
        "CountryCodeId": null,
        "ReferenceNumber": "EXAMPLE-001",
        "AbnNumber": null,
        "AbnBranch": null,
        "ReportTaxablePayments": null,
        "Void": false,
        "LastUpdated": "2026-01-15T10:30:00Z",
        "DateCreated": "2026-01-15T10:30:00Z",
        "Telephone": null,
        "VatReg": "",
        "DefaultNominalCodeId": 1003,
        "DefaultTaxCodeId": null,
        "DefaultCostCodeId": 1008,
        "DefaultDivisionId": null,
        "DefaultCurrencyId": 1009,
        "DefaultPaymentTerms": 0,
        "SupplierBankSwiftCode": null,
        "SupplierBankIBANNumber": null,
        "SupplierBankName": null,
        "SupplierBankAddress": null,
        "Notes": null,
        "Terms": null,
        "SyncId": "00000000-0000-4000-8000-000000000001",
        "SyncDate": "2026-01-15T10:30:00Z",
        "SyncType": 10,
        "AddressId": 1001,
        "RestrictedBuying": false,
        "Type": null,
        "SmartName": null,
        "IsActive": true,
        "TrustedStatus": null,
        "PaymentTermType": 1,
        "PaymentTermDaysNumber": 1,
        "PaymentTermStartType": 0,
        "EnableLineProducts": true,
        "Address": {
          "Id": 1001,
          "AddressLines": null,
          "Postcode": "",
          "CountryCodeId": null,
          "IsPrimary": false,
          "City": null,
          "Street": null,
          "State": null,
          "Void": false,
          "LastUpdated": "2026-01-15T10:30:00Z",
          "BusinessUnits": [],
          "BusinessDivisions": [],
          "Documents": [],
          "Invoices": [],
          "Projects": [],
          "Suppliers": [],
          "LineItems": [],
          "CountryCode": null
        },
        "BusinessUnit": null,
        "Currency": null,
        "PurchaseOrderFormat": 1,
        "CompanyRegNumber": null,
        "SupplierDocuments": [],
        "SupplierNotes": [],
        "SupplierEmails": [
          {
            "Id": 1004,
            "SupplierEmailId": 1004,
            "Email": "example@example.com",
            "AddedOn": "Example AddedOn",
            "SupplierId": 1007,
            "SupplierEmailType": 1,
            "IsDefault": false
          }
        ],
        "LineItems": [],
        "CountryCode": null,
        "DefaultTaxCode": null,
        "DefaultNominalCode": {
          "Id": 1003,
          "SyncFriendlyName": "Example SyncFriendlyName",
          "NominalCodeId": 1003,
          "BusinessUnitId": 1002,
          "Code": "EXAMPLE-001",
          "Description": "Example Description",
          "SyncId": "00000000-0000-4000-8000-000000000001",
          "SyncDate": "2026-01-15T10:30:00Z",
          "SyncType": 10,
          "LastUpdated": "2026-01-15T10:30:00Z",
          "DateCreated": "2026-01-15T10:30:00Z",
          "IsActive": true,
          "IsStartingDefaultCode": false,
          "Void": false,
          "BusinessUnit": null,
          "Suppliers": [],
          "LineItems": []
        },
        "DefaultCostCode": {
          "Id": 1008,
          "SyncFriendlyName": "Example SyncFriendlyName",
          "CostCodeId": 1008,
          "BusinessUnitId": 1002,
          "Code": "EXAMPLE-001",
          "Description": "Example Description",
          "SyncId": "00000000-0000-4000-8000-000000000001",
          "SyncDate": "2026-01-15T10:30:00Z",
          "SyncType": 10,
          "LastUpdated": "2026-01-15T10:30:00Z",
          "DateCreated": "2026-01-15T10:30:00Z",
          "IsActive": true,
          "IsStartingDefaultCode": false,
          "Void": false,
          "BusinessUnit": null,
          "Suppliers": []
        },
        "DefaultDivision": null,
        "UserLockId": null
      },
      "TaxCode": null,
      "CostCode": null,
      "NominalCode": null,
      "Project": null
    }
  ],
  "ReferenceNumber": "EXAMPLE-001",
  "SupplierId": 1007,
  "SupplierName": "Example SupplierName",
  "Telephone": null,
  "VatReg": "",
  "Void": false,
  "SmartName": null,
  "IsActive": true,
  "DefaultCostCodeId": 1008,
  "DefaultCostCode": "EXAMPLE-001",
  "Type": null,
  "DefaultCurrencyId": 1009,
  "TrustedStatus": null,
  "DefaultDivisionId": null,
  "SupplierBankIBANNumber": null,
  "SupplierBankSwiftCode": null,
  "SupplierBankName": null,
  "SupplierBankAddress": null
}

Field reference

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 null Value associated with this record.
CountryCode string Country short code.
CountryCodeId null Numeric or external reference; use the appropriate resource context.
DefaultNominalCode string Value associated with this record.
DefaultNominalCodeId number 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 string Email address; treat it as personal/business data.
SupplierEmails array 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 null Value associated with this record.
VatReg string Value associated with this record.
Void boolean Void flag. Choose changes deliberately.
SmartName null Value associated with this record.
IsActive boolean Activity flag.
DefaultCostCodeId number Numeric or external reference; use the appropriate resource context.
DefaultCostCode string Value associated with this record.
Type null Value associated with this record.
DefaultCurrencyId number Numeric or external reference; use the appropriate resource context.
TrustedStatus null 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.

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.
  • Use numeric identifiers where an identifier is requested. Preserve formatting and leading zeros in displayed document numbers and business codes.

Enum reference · API overview

.md
Take this page to your coding agent.

Copy a clean Markdown URL that follows the published article.