Administrate

Getting Invoices by Account

Invoices are associated with accounts. For information about (and a listing of) invoices for a specific account, use the following:

GET /api/v2/finance/sales_invoices

Using curl

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/sales_invoices?account_id=123 \
     -k -u (login):(password)

Using php

<?php
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/sales_invoices?account_id=123';
$credentials = 'username:password';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0 );

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo $result;

Example response

{
    "account_id": 123,
    "company_id": 1,
    "date": "2012-06-07T11:27:58",
    "entries": [
        {
            "amount": 452.99,
            "company_id": 1,
            "currency": {},
            "group_id": 38,
            "id": 17
        },
        {
            "amount": 582.00,
            "company_id": 1,
            "currency": {},
            "group_id": 38,
            "id": 19
        }
    ],
    "id": 38,
    "number": "38"
}

With the id of each entry, you will now be able to fetch individual Pdfs using the same id numbers. see Getting Invoices

Getting Invoices

To access the generated documents for specific invoices. Most of the time you’ll want to first obtain a list of invoices within the context of an account using the “Getting Invoices by Account” function. Getting Invoices by Account

In the example above, the invoice id is 38. Therefore, the following URL will retrieve the PDF:

/api/v2/docs/invoice/38.pdf

If you have a Xero integration and the invoice has been finalised and synced to Xero the above link will return the Xero PDF for the invoice.