Credit Notes

List all credit notes

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

You can filter the result by parameters:

GET /api/credit-notes?credit-note_number=GS123

Lists all credit notes with “GS123” in the credit note number. Upper and lower case are ignored.
The following filter parameters are available:

client_idID of the client
contact_idID of the contact
credit_note_numberCredit note number
statusStatus (DRAFT, OPEN, PAID). More than one statuses could be given as a comma separated list. Theses statuses will be logically OR-connected.
fromOnly show credit notes since this date (format YYYY-MM-DD)
toOnly show credit notes 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/credit-notes?group_by=client

Credit notes can also be found grouped together. The above example all credit notes grouped by client.
The following values are for parameter group_by are available:

statusstatus of the credit note
weekweek (starts with monday)

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"?>
<credit-note-groups type="array" currency_code="USD">
<total_gross type="float">347.28</total_gross>
<total_net type="float">291.83</total_net>
<client_id type="integer">476</client_id>
<client_id type="integer">476</client_id>
<total_gross type="float">1127.53</total_gross>
<total_net type="float">947.50</total_net>
<client_id type="integer">477</client_id>
<client_id type="integer">477</client_id>

Get a single credit note

GET /api/credit-notes/{id}
<?xml version="1.0" encoding="UTF-8"?>
<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>
<number type="integer">123</number>
<number_length type="integer">0</number_length>
<date type="date">2009-10-14</date>

<address>Billomat GmbH & Co. KG
Hollertszug 26
57562 Herdorf
Deutschland</address>    <title></title>
<label>Projekt 123</label>
<intro>Wir schreiben Ihnen folgende Positionen gut:</intro>
<note>Vielen Dank!</note>
<total_gross type="float">107.1</total_gross>
<total_net type="float">90.0</total_net>
<total_gross_unreduced type="float">119.0</total_gross_unreduced>
<total_net_unreduced type="float">100.0</total_net_unreduced>
<quote type="float">1.0000</quote>
<taxes type="array">
<rate type="float">19.0</rate>
<amount type="float">19.0</amount>

status can have the following values:
net_gross can have the following values:
In addition to the credit note combined taxes (taxes) will be returned.
items, comments and payments can be accessed separately.

Create credit note

POST /api/credit-notes
XML elementDescriptionTypeDefault valueMandatory
client_idID of the clientINTyes
contact_idID of the contactINT
addressthe addressALNUMClient’s address
number_prePrefixALNUMValue taken from the settings
numberSerial numberINTnext free numberr
number_lengthMinimum length of the invoice number (to be filled with leading zeros)INTValue taken from the settings
dateCredit note dateDATEtoday
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
invoice_idThe ID of the invoice, if the credit note was created from an invoice.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 credit note.INTID of the default template

status at creation is always DRAFT.

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

The remaining properties of the credit note are automatically calculated.
Credit note items (credit-note-items) can be specified directly at creation. Please find a documentation of the XML elements at Create credit note items, but the XML element credit_note_id need not be specified with.

<note>Wir schreiben Ihnen gut:</note>
<?xml version="1.0" encoding="UTF-8"?>
<id type="integer">1234</id>
<client_id type="integer">1</client_id>
<created type="datetime">2007-12-13T12:12:00+01:00</created>
<number type="integer">124</number>
<number_length type="integer">0</number_length>
<date type="date">2009-11-18</date>

Edit credit note

PUT /api/credit-notes/{id}

A credit note can basically be edited in draft status (DRAFT) only.
Credit note items and comments could not be edited at the credit note. Please use the appropriate resource instead.


Delete credit note

DELETE /api/credit-notes/{id}

Deletes a credit note with all documents (PDFs), Credit note items and comments.

Complete credit note

PUT /api/credit-notes/{id}/complete

Completes a credit note in the draft status (DRAFT). Here, the status of open (OPEN) or overdue (OVERDUE) 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 credit note or the default template is used.


Open pdf of a credit note

GET /api/credit-notes/{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.

    <id type="integer">4882</id>
<created type="datetime">2009-09-02T12:04:15+02:00</created>
<credit_note_id type="integer">240</credit_note_id>
<base64file>{base64 encoded PDF}</base64file>

Updoad a digital signature for a given credit note

PUT /api/credit-notes/{id}/upload-signature

Updoads a digital signature for a given credit note.
The status of the credit note 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.

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

Send credit note by e-mail

POST /api/credit-notes/{id}/email
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/EMAILja
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
<subject>Ihre Gutschrift</subject>
<body>Sehr geehrte Damen und Herren, ….</body>
<base64file>{base64-kodierte Datei}</base64file>

Send credit note by mail

POST /api/credit-notes/{id}/mail

Sends a credit note 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
<base64file>{base64 encoded file}</base64file>

Cancel credit note

PUT /api/credit-notes/{id}/cancel

Undo cancellation

PUT /api/credit-notes/{id}/uncancel