Invoices API

17 PracBill API endpoints for invoices. Base URL https://billing.pracbill.com.au/api.

Invoice count and ex-tax total across ALL departments for invoices dated in the range (department security is lifted).

GET /{api_key}/getInvoiceUsage/{date_from}/{date_to}

Responses

  • 200 — Usage totals

As `getInvoiceUsage/{date_from}/{date_to}` but restricted to one department.

GET /{api_key}/getInvoiceUsage/{date_from}/{date_to}/{deptid}

Responses

  • 200 — Usage totals

Retrieve all invoices for the department (every generated invoice, `invoice_generated = 1`; includes void and draft). Each invoice is built with invoiceInfo(). Returns `{success:false, description:'no invoices found'}` when there are none.

GET /{api_key}/invoice/get

Responses

  • 200 — Request received successfully

Retrieve all invoices for the department, optionally ordered. Body parsing: the raw body is cut at the first '=' and URL-decoded before JSON decoding, so send JSON without a literal '=' (or URL-encode it). The `order_by` value is inserted into the SQL ORDER BY clause unvalidated.

POST /{api_key}/invoice/get

Request body

FieldTypeDescription
order_bystringColumn / expression to order by (not validated). Commonly used: iid, cid, date, company, duedate, balance

Responses

  • 200 — Request received successfully

Download invoice usage (call/CDR detail) as CSV file. Each row carries a trailing Site Name column (empty when the charged service has no engineering site).

GET /{api_key}/invoice/get/csv/usage/{iid}

Responses

  • 200 — CSV file (attachment `invoice_{iid}.csv` / `invoice_usage_{iid}.csv`). An invalid API key or missing / non-positive iid returns a JSON error envelope instead.

Download invoice as CSV file. Site-grouped invoices carry a trailing Site Name column (empty when the row has no engineering site).

GET /{api_key}/invoice/get/csv/{iid}

Responses

  • 200 — CSV file (attachment `invoice_{iid}.csv` / `invoice_usage_{iid}.csv`). An invalid API key or missing / non-positive iid returns a JSON error envelope instead.

All authorized, generated, non-void invoices for a customer, each with raw line rows under `items` (iitems, services, calls). Failure: `{success:false, description:'no customer invoices'}`.

GET /{api_key}/invoice/get/customer/{cid}

Responses

  • 200 — Request received successfully

Filtered invoices for a customer (same response as the unfiltered customer list). One filter expression only. NOTE: the `void` filter lists ALL void invoices of the department - it is not restricted to the customer. `draft` lists the customer's draft invoices.

GET /{api_key}/invoice/get/customer/{cid}/filter/{filter}

Responses

  • 200 — Request received successfully

Filtered, paginated invoice list (20 per page). Base set is authorized, generated, non-void invoices; the `draft` and `void` filters replace that base set. Ordered by iid. Same list-row shape as `/invoice/get/page`. Page 1 is returned.

GET /{api_key}/invoice/get/filter/{filter}/page

Responses

  • 200 — Request received successfully

Filtered, paginated invoice list (20 per page). Base set is authorized, generated, non-void invoices; the `draft` and `void` filters replace that base set. Ordered by iid. Same list-row shape as `/invoice/get/page`.

GET /{api_key}/invoice/get/filter/{filter}/page/{page_number}

Responses

  • 200 — Request received successfully

Paginated list of authorized, generated, non-void invoices ordered by iid (20 per page). Rows are the autotable list view (id, Type, Company, Date, Due Date, Status, Reconciled, Amount), not full invoices; use `/invoice/get/{iid}` for those. Page 1 is returned.

GET /{api_key}/invoice/get/page

Responses

  • 200 — Request received successfully

Paginated list of authorized, generated, non-void invoices ordered by iid (20 per page). Rows are the autotable list view (id, Type, Company, Date, Due Date, Status, Reconciled, Amount), not full invoices; use `/invoice/get/{iid}` for those.

GET /{api_key}/invoice/get/page/{page_number}

Responses

  • 200 — Request received successfully

Download the invoice PDF for an invoice ID. Shares its handler with the `statement` form.

GET /{api_key}/invoice/get/pdf/{iid}

Responses

  • 200 — PDF file (inline). A cached PDF is served when available, otherwise rendered with wkhtmltopdf. Errors are JSON ('invalid key', 'must include iid').

Alias of `/{api_key}/invoice/get/pdf/{iid}`: downloads the PDF for an INVOICE id (not a customer statement).

GET /{api_key}/invoice/get/statement/{iid}

Responses

  • 200 — PDF file (inline). A cached PDF is served when available, otherwise rendered with wkhtmltopdf. Errors are JSON ('invalid key', 'must include iid').

Retrieve a specific invoice by ID (card fields removed). Failure: `{success:false, description:'invoice not found'}`.

GET /{api_key}/invoice/get/{iid}

Responses

  • 200 — Request received successfully

Mark an invoice as bad debt (sets `bad_debt` to today's date, drops any cached PDF). State-changing GET. No existence check: `{success:true}` for any iid.

GET /{api_key}/invoice/{iid}/bad_debt

Responses

  • 200 — Invoice marked as bad debt

Void an invoice (sets `void = 1`, drops any cached PDF). State-changing GET. No existence check: `{success:true}` for any iid.

GET /{api_key}/invoice/{iid}/void

Responses

  • 200 — Invoice voided

← All API groups