GetInvoiceDocuments (Pull Method)
GetInvoiceDocuments
Retrieves all documents that were uploaded against a given invoice. Each file is returned as base64‑encoded bytes with filename metadata.
Request
| Parameter | Type | Description |
|---|---|---|
| Company | Varchar(250) | Required. Company identifier returned by GetCompanies. |
| InvoiceNumber | Varchar(50) | Required. Invoice number whose documents you want to retrieve. |
Response
| Parameter | Type | Description |
|---|---|---|
| FileName | Varchar(250) | The name of the returned file (e.g., “evidence.pdf”, “photo.jpg”). |
| InvoiceNumber | Varchar(50) | Invoice number; pass to GetInvoiceInfo for full details. |
| FileBytes | NVarchar(max) | Base64‑encoded bytes of the document. Decode and save to persist the file. |
The response may contain multiple items (one per document). Iterate the collection and save each file after decoding.
Example (C#)
// setup request parameters
NameValueCollection getInvoiceDocsParams = new NameValueCollection
{
{ "InvoiceNumber", "1001" },
{ "Company", "ABC" }
};
dynamic getInvoiceDOCsResponse = apiClient.GetInvoiceDocuments(getInvoiceDocsParams);
// Iterate and save each returned file
foreach (var item in getInvoiceDOCsResponse)
{
Console.WriteLine("Filename: " + item.FileName);
byte[] bytes = Convert.FromBase64String(Convert.ToString(item.FileBytes));
File.WriteAllBytes(
@"C:\DownloadAPIFiles\" + Convert.ToString(item.FileName),
bytes
);
}