Invoices

List all invoices

GET /api/invoices
<?xml version="1.0" encoding="UTF-8"?>
<invoices type="array" page="1" per_page="100" total="2">
<invoice>
…
</invoice>
<invoice>
…
</invoice>
</invoices>

You can filter the result by parameters:

GET /api/invoices?invoice_number=RE123

Lists all invoices with “RE123” in the invoice number. Upper and lower case are ignored.

The following filter parameters are available:

ParameterDescription
client_idID of the client
contact_idID of the contact
invoice_numberinvoice number
statusStatus (DRAFT, OPEN, PAID, OVERDUE, CANCELED). More than one statuses could be given as a comma separated list. Theses statuses will be logically OR-connected.
payment_typePayment Type (eg. CASH, BANK_TRANSFER, PAYPAL, …). More than one payment type could be given as a comma separated list. Theses payment types will be logically OR-connected. You can find a overview of all payment types at API documentation of payments.
fromOnly show invoices since this date (format YYYY-MM-DD)
toOnly show invoices up to this date (format YYYY-MM-DD)
labelFree text search in label text
introFree text search in introductory text
noteFree text search in explanatory notes
tagsComma separated list of tags
article_idID of an article

Aggregated list of invoices

GET /api/invoices?group_by=client

Invoices can also be found grouped together. The above example all invoices grouped by client.

The following values ​​are for parameter _group/by are available:

ValueDescription
clientclient
statusstatus of an invoice
dayday
weekweek (starts with monday)
monthmonth
yearyear

It can also be grouped according to several criteria. The desired values ​​are simply concatenated by commas (?group_by=client,year). The order of values ​​determines the order of aggregation.

The grouping parameters can also be combined with the other filters.

<?xml version="1.0" encoding="UTF-8"?>
<invoice-groups type="array" currency_code="USD">
<invoice-group>
<total_gross type="float">347.28</total_gross>
<total_net type="float">291.83</total_net>
<client_id type="integer">476</client_id>
<invoice-params>
<client_id type="integer">476</client_id>
</invoice-params>
</invoice-group>
<invoice-group>
<total_gross type="float">1127.53</total_gross>
<total_net type="float">947.50</total_net>
<client_id type="integer">477</client_id>
<invoice-params>
<client_id type="integer">477</client_id>
</invoice-params>
</invoice-group>
</invoice-groups>

Get a single invoice

GET /api/invoices/{id}
<?xml version="1.0" encoding="UTF-8"?>
<invoice>
<id type="integer">1</id>
<client_id type="integer">123</client_id>
<contact_id type="integer"></contact_id>
<created type="datetime">2007-12-13T12:12:00+01:00</created>
<invoice_number>RE123</invoice_number>
<number type="integer">123</number>
<number_pre>RE</number_pre>
<number_length type="integer">0</number_length>
<status>OPEN</status>
<date type="date">2009-10-14</date>
<supply_date>2009-10-12</supply_date>
<supply_date_type>SUPPLY_DATE</supply_date_type>
<due_date type="date">2009-10-24</due_date>
<due_days type="integer">10</due_days>

<address>Billomat GmbH & Co. KG
Hollertszug 26
57562 Herdorf
Deutschland</address>    <discount_rate type="float">2.0</discount_rate>
<discount_date type="date">2009-10-21</discount_date>
<discount_days type="integer">7</discount_days>
<discount_amount type="float">2.0</discount_amount>
<title></title>
<label>project 123</label>
<intro>We are pleased to offer you the following items into account:</intro>
<note>Thank you for your order!</note>
<total_gross type="float">107.1</total_gross>
<total_net type="float">90.0</total_net>
<net_gross>NET</net_gross>
<reduction>10</reduction>
<total_gross_unreduced type="float">119.0</total_gross_unreduced>
<total_net_unreduced type="float">100.0</total_net_unreduced>
    <paid_amount type="float">20.0</paid_amount>
    <open_amount type="float">99.0</open_amount>
<currency_code>EUR</currency_code>
<quote type="float">1.0000</quote>
<invoice_id></invoice_id>
<offer_id></offer_id>
<confirmation_id>7</confirmation_id>
<recurring_id></recurring_id>
<taxes type="array">
<tax>
<name>MwSt</name>
<rate type="float">19.0</rate>
<amount type="float">19.0</amount>
</tax>
</taxes>
    <payment_types>CASH,BANK_TRANSFER,PAYPAL</payment_types>
    <customerportal_url>https://mybillomatid.billomat.net/customerportal/invoices/show/entityId/123?hash=123456789aabbcc</customerportal_url>
<template_id></template_id>
</invoice>

status can have the following values:

  • DRAFT
  • OPEN
  • OVERDUE
  • PAID
  • CANCELED

supply_date_type can have the following values:

  • SUPPLY_DATE (supply date as date)
  • DELIVERY_DATE (delivery date as date)
  • SUPPLY_TEXT (supply date as free text)
  • DELIVERY_TEXT (delivery date as free text)

net_gross can have the following values:

  • NET
  • GROSS

In addition to the invoice combined taxes (taxes) will be returned.

The accepted payment types are separated by comma. You can find a list of all payment types at payments documentation.

Invoice items, comments and payments can be accessed separately.

Create an invoice

POST /api/invoices
XML elementDescriptionTypeDefault valueMandatory
client_idID of the clientINTyes
contact_idID of the contactINT
addressthe addressALNUMclient’s address
number_preinvoice number prefixALNUMValue taken from the settings
numberserial numberINTnext free number
number_lengthMinimum length of the invoice number (to be filled with leading zeros)INTValue taken from the settings
dateInvoice dateDATEtoday
supply_datesupply/delivery dateMIXED (DATE/ALNUM)
supply_date_typetype of supply/delivery dateALNUM (“SUPPLY_DATE”, “DELIVERY_DATE”, “SUPPLY_TEXT”, “DELIVERY_TEXT”)
due_datedue dateDATEdate + due days taken from the settings
discount_rateCash discountINTValue from the settings
discount_dateCash discount dateDATEdate + cash discount days taken from the settings
titleTitle of the documentALNUM
labelLabel text to describe the projectALNUM
introIntroductory textALNUMDefault value taken from the settings
noteExplanatory notesALNUMdefault value taken from the settings
reductionReduction (absolute or percent: 10/10%)ALNUM
currency_codeCurrencyISO currency codeDefault currency
net_grossPrice basis (gross or net prices)ALNUM (“NET”, “GROSS”)Default value taken from the settings
quoteCurrency quote (for conversion into standard currency)FLOAT1.0000
payment_typesList (separated by comma) of all accepted payment types.FLOATDefault value taken from the settings
invoice_idThe ID of the corrected invoice, if it is an invoice correction.INT
offer_idThe ID of the estimate, if the invoice was created from an estimate.INT
confirmation_idThe ID of the confirmation, if the invoice was created from a confirmation.INT
recurring_idThe ID of the recurring, if the invoice was created from a recurring.INT
free_text_idThe ID of the free text to set title, label, intro and note.INT
template_idThe ID of the template to be used to complete the invoice.INTID of the default template

status at creation is always DRAFT.

When initially created in DRAFT state, the invoice_number is returned as an empty response. It is only on completion of an invoice that the invoice number is calculated and gets a value.

The remaining properties of the account are automatically calculated.

Specify invoice items at invoice creation

Invoice items (invoice-items) can be specified directly at creation. Please find a documentation of the XML elements at Create invoice items, but the XML element invoice_id need not be specified with.

<invoice>
<client_id>1</client_id>
<date>2009-11-18</date>
<note>Thank you for your order</note>
<invoice-items>
<invoice-item>
<unit>Piece</unit>
<unit_price>1.23</unit_price>
<quantity>1.5</quantity>
<title>Model</title>
</invoice-item>
<invoice-item>
<unit>hour</unit>
<unit_price>90</unit_price>
<quantity>8</quantity>
<title>Work</title>
</invoice-item>
</invoice-items>
</invoice>
<?xml version="1.0" encoding="UTF-8"?>
<invoice>
<id type="integer">1234</id>
<client_id type="integer">1</client_id>
<created type="datetime">2007-12-13T12:12:00+01:00</created>
<invoice_number>RE124</invoice_number>
<number type="integer">124</number>
<number_pre>RE</number_pre>
<number_length type="integer">0</number_length>
<date type="date">2009-11-18</date>
…
</invoice>

Edit invoice

PUT /api/invoices/{id}

Updates an invoice with the given parameters.

An invoice can basically be edited in draft status (DRAFT) only.

Invoice items and comments could not be edited at the invoice. Please use the appropriate resource instead.

<invoice>
<date>2009-10-13</date>
</invoice>

Delete invoice

DELETE /api/invoices/{id}

Deletes an invoice with all documents (PDFs), items and comments.

Complete invoice

PUT /api/invoices/{id}/complete

Completes an invoice in the draft status (DRAFT). Here, the status of open (OPEN), overdue (OVERDUE), or paid (PAID) is set and a PDF is generated and stored in the file system.

The optional parameter template_id determines which template is used to create a pdf.

If this parameter is not specified, the template specified at the invoice or the default template is used.

<complete>
<template_id>123</template_id>
</complete>

Open pdf of an invoice

GET /api/invoices/{id}/pdf

At this point, the parameter format=pdf can also be used to open the PDF directly with MIME type “application/pdf”.

With the optional parameter type=print you can request the PDF without background. Note that the setting print_version must have been activated.

<pdf>
    <id type="integer">4882</id>
<created type="datetime">2009-09-02T12:04:15+02:00</created>
<invoice_id type="integer">240</invoice_id>
<filename>invoice_123.pdf</filename>
<mimetype>application/pdf</mimetype>
<filesize>70137</filesize>
<base64file>{base64 encoded PDF}</base64file>
</pdf>

Upload a digital signature for a given invoice

PUT /api/invoices/{id}/upload-signature

Uploads a digital signature for a given invoice. The status of the invoice may not be DRAFT.

XML elementDescriptionTypeDefault valueMandatory
base64fileBase64 encoded PDF with digital signatureBASE64FILEyes

Note: A (qualitfied) digital signature can NOT be created by the billomat[API] directly. We recommend that you use this function directly on the PixelLetter interface or another service.

<signature>
<base64file>{base64 encoded PDF}</base64file>
</signature>

Send invoice by e-mail

POST /api/invoices/{id}/email

Sends an invoice by e-mail.

XML elementDescriptionTypeDefault valueMandatory
email_template_idID of the e-mail templateINT
fromSenderEMAILDefault email from the settings
recipientsRecipients of the e-mail. There must be at least one xml node for “to”, “cc” and/or “bcc”.XML node/EMAILyes
subjectSubject of the e-mail (may include placeholders)ALNUMValue taken from the (default) e-mail template
bodyText of the e-mail (may include placeholders)ALNUMValue taken from the (default) e-mail template
filenameName of the PDF file (without .pdf)ALNUMinvoice_{id}
attachmentsFurther files. Attachments can contain as many nodes on the “attachment” with the elements “filename”, “mimetype” and “base64file”.XML node
<email>
<from>info@billomat.com</from>
<recipients>
<to>info@billomat.com</to>
<cc>mail@example.com</cc>
</recipients>
<subject>Your invoice</subject>
<body>Dear sir or madam, ….</body>
<filename>invoice</filename>
<attachments>
<attachment>
<filename>drawing.pdf</filename>
<mimetype>application/pdf</mimetype>
<base64file>{base64 encoded file}</base64file>
</attachment>
</attachments>
</email>

Send invoice by mail

POST /api/invoices/{id}/mail

Sends an invoice by mail. Pixelletter has to be configured as add on for usage.

XML elementDescriptionTypeDefault valueMandatory
colorDetermines whether to use color printing.BOOL0
duplexDetermines whether to use duplex printing.BOOL1
paper_weightDetermines the paper weight in grams. Possible values are 80 or 90.INT90
attachmentsFurther PDF files. Attachments can contain as many nodes on the “attachment” with the elements “filename”, “mimetype” and “base64file”.XML node
<mail>
<color>0</color>
    <duplex>1</duplex>
    <paper_weight>90</paper_weight>
    <attachments>
<attachment>
<filename>drawing.pdf</filename>
<mimetype>application/pdf</mimetype>
<base64file>{base64 encoded file}</base64file>
</attachment>
</attachments>
</mail>

Cancel invoice

PUT /api/invoices/{id}/cancel

Undo cancellation

PUT /api/invoices/{id}/uncancel

Send invoice to encashment service

PUT /api/invoices/{invoiceId}>/encash