Skip to documentation
Zahara DevelopersAPI documentation
DocumentationInvoices
Download .md
Invoices

Get all Invoices (with Skip and Take)

Last updated

Retrieve a page of invoice records using skip and take.

Request

GET https://api.myzahara.net/api/{businessUnitApiKey}/Invoice/Get/{skip}/{take}

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_SKIP skip; default 0. Use an integer reference or offset as appropriate.
ZAHARA_TAKE take; default 5. 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_SKIP="${ZAHARA_SKIP:-0}"
export ZAHARA_TAKE="${ZAHARA_TAKE:-5}"
encoded_skip="$(python3 -c 'import os; from urllib.parse import quote; print(quote(os.environ["ZAHARA_SKIP"], safe=""))')"
encoded_take="$(python3 -c 'import os; from urllib.parse import quote; print(quote(os.environ["ZAHARA_TAKE"], 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}/Invoice/Get/${encoded_skip}/${encoded_take}"

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_SKIP=required('ZAHARA_SKIP', "0");
const ZAHARA_TAKE=required('ZAHARA_TAKE', "5");
let path="Invoice/Get/{skip}/{take}";
path=path.replace('{skip}',encodeURIComponent(ZAHARA_SKIP));
path=path.replace('{take}',encodeURIComponent(ZAHARA_TAKE));
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_SKIP=required('ZAHARA_SKIP', "0")
ZAHARA_TAKE=required('ZAHARA_TAKE', "5")
path="Invoice/Get/{skip}/{take}"
path=path.replace('{skip}',quote(ZAHARA_SKIP,safe=''))
path=path.replace('{take}',quote(ZAHARA_TAKE,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

Parse the top-level JSON array and iterate its records. An empty array is a valid empty result, not a network failure.

Response example

Fictional business data; array length is illustrative.

[
  {
    "DeliveryAddress": null,
    "BillingAddress": null,
    "Supplier": {
      "Address": null,
      "BankAccountNumber": "",
      "BankSortCode": "",
      "BusinessUnitId": 1001,
      "ContactName": "Example ContactName",
      "CountryCode": "gb",
      "CountryCodeId": null,
      "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": 1002,
      "SupplierName": "Example SupplierName",
      "Telephone": "",
      "VatReg": null,
      "Void": false,
      "SmartName": null,
      "IsActive": true,
      "DefaultCostCodeId": null,
      "DefaultCostCode": null,
      "Type": null,
      "DefaultCurrencyId": 1003,
      "TrustedStatus": false,
      "DefaultDivisionId": null,
      "SupplierBankIBANNumber": null,
      "SupplierBankSwiftCode": null,
      "SupplierBankName": null,
      "SupplierBankAddress": null
    },
    "InvoiceNumber": "EXAMPLE-001",
    "PurchaseOrderNumber": null,
    "TotalNetValue": 100,
    "TotalGrossValue": 120,
    "RaisedDate": "2026-01-15T10:30:00Z",
    "DueDate": "2026-01-15T10:30:00Z",
    "DocumentId": 1004,
    "BusinessDivisionId": 1005,
    "CreatedBy": 1,
    "SupplierId": 1002,
    "Description": "Example Description",
    "DateCreated": "2026-01-15T10:30:00Z",
    "LastUpdated": "2026-01-15T10:30:00Z",
    "ImageLocation": null,
    "Type": 2,
    "Status": 3,
    "Comments": null,
    "Void": false,
    "LineItemMatchType": 0,
    "ExternalRef": null,
    "ProcessId": 1006,
    "ProcessStatus": 4,
    "CurrentStepIndex": 1,
    "InvoiceType": 1,
    "DoxStoreId": null,
    "DoxStoreFileExt": null,
    "LineItems": [
      {
        "LineItemId": 1007,
        "DocumentId": 1004,
        "ProjectId": 1008,
        "CostCodeId": 1009,
        "OrderNumber": "EXAMPLE-001",
        "Quantity": 1,
        "Unit": null,
        "Price": 100,
        "Description": "Example Description",
        "NominalCodeId": 1010,
        "NominalCode": "EXAMPLE-001",
        "TaxCodeId": 1011,
        "TaxCode": "EXAMPLE-001",
        "TaxPercentage": 0,
        "TaxValue": 20,
        "NetValue": 100,
        "QuantityReceived": 1,
        "LastUpdated": "2026-01-15T10:30:00Z",
        "ProductCode": "EXAMPLE-001",
        "DiscountPercentage": 0,
        "MatchType": 0,
        "DivisionId": 1005,
        "ProjectItemCodeId": null,
        "RequiredDate": null,
        "CustomCodingFieldValues": []
      }
    ],
    "CustomFieldValues": [
      {
        "DocumentId": 1004,
        "Id": 1012,
        "TypeId": 1012,
        "Value": "Example Value"
      }
    ],
    "LastProcessingDateTime": null,
    "ReprocessCount": 0,
    "DeliveryAddressId": null,
    "BillingAddressId": null,
    "CurrencyId": 1013,
    "ParentId": null,
    "Exported": false,
    "ExportedDate": null,
    "CurrentExportStatus": 0,
    "CurrentExportType": 0,
    "CurrentExportMessage": "Example CurrentExportMessage",
    "ExportedByWorkflow": false,
    "AutomaticProcessId": null,
    "StatusBeforeClosing": null,
    "PriorityApprovalDocument": false,
    "PaymentStatus": 0
  }
]

Field reference

Field Example JSON type Use
DeliveryAddress null Value associated with this record.
BillingAddress null Value associated with this record.
Supplier object Value associated with this record.
InvoiceNumber string Displayed invoice number; preserve leading zeros and text.
PurchaseOrderNumber null Displayed purchase-order number; preserve its formatting.
TotalNetValue number Document net amount; keep it consistent with line totals.
TotalGrossValue number Document gross amount; keep it consistent with tax and line values.
RaisedDate string Invoice raised date.
DueDate string Invoice due date.
DocumentId number Numeric document reference; distinct from invoice or order number.
BusinessDivisionId number Numeric division reference.
CreatedBy number Value associated with this record.
SupplierId number Numeric supplier reference.
Description string Description text.
DateCreated string Record creation timestamp.
LastUpdated string Record update timestamp.
ImageLocation null Value associated with this record.
Type number Value associated with this record.
Status number Status enum value for the intended workflow.
Comments null Value associated with this record.
Void boolean Void flag. Choose changes deliberately.
LineItemMatchType number Value associated with this record.
ExternalRef null Value associated with this record.
ProcessId number Workflow definition reference.
ProcessStatus number Value associated with this record.
CurrentStepIndex number Value associated with this record.
InvoiceType number Value associated with this record.
DoxStoreId null Numeric or external reference; use the appropriate resource context.
DoxStoreFileExt null Value associated with this record.
LineItems array Document line objects with quantities, values and coding references.
CustomFieldValues array Document-level custom-field values linked through TypeId.
LastProcessingDateTime null Value associated with this record.
ReprocessCount number Value associated with this record.
DeliveryAddressId null Numeric or external reference; use the appropriate resource context.
BillingAddressId null Numeric or external reference; use the appropriate resource context.
CurrencyId number Numeric currency reference.
ParentId null Numeric or external reference; use the appropriate resource context.
Exported boolean Value associated with this record.
ExportedDate null Value associated with this record.
CurrentExportStatus number Value associated with this record.
CurrentExportType number Value associated with this record.
CurrentExportMessage string Value associated with this record.
ExportedByWorkflow boolean Value associated with this record.
AutomaticProcessId null Numeric or external reference; use the appropriate resource context.
StatusBeforeClosing null Value associated with this record.
PriorityApprovalDocument boolean Value associated with this record.
PaymentStatus number 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

  • Skip is an offset and take is a requested item count. Advance the offset for subsequent pages, and account for records changing between requests.
  • 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.