Join us at Fortnox App Market today!

Vouchers

Developers Integration Dictionary

During the process of creating your integration you will bump into these words and functions.

Introduction

Accounting is a product where you can record your financial transactions by bookkepping your vouchers e.g. receipts or z-reports from daily takings as well as manage all your supplier invoices and suppliers.

Most Fortnox products create vouchers in the accounting module, e.g. when bookkeepng invoices, salaries or asset depreciations.

To run this module, the accounting license is required.
To access it through the API, the Bookkeeping Scope is required.

 

This best practice example describes how to create vouchers in Fortnox. A voucher in Fortnox is built up by information from the following resources.

All Fortnox accounts will have five (5) GB free storage area that can be used to connect images to most records in Fortnox, e.g. vouchers, articles, supplier invoices, articles and assets and vouchers. If you have an image of the accounting record, e.g. a receipt, bank statement, z-report for daily register, etc., we recommend that you always upload this and connect it to the voucher in Fortnox. This creates a high user value in the software since storage of the original image is a legal requirement. By connecting an image to a voucher our users will be able to see it both when reviewing the voucher and in reports such as the performance report.

Voucher - Connected document

Voucher – Connected document

 

Financial Years

The resource “Financial Years” requires that you have the scope for bookkeeping enabled.

Verify that a valid financial year exists for the bookkeeping date that you are going to use to create your voucher.

Request

METHOD

GET

URL STRUCTURE

https://api.fortnox.se/3/financialyears/?date={Date}

If the response is an empty list, no financial year exists for the requested date. However if there is a financial year resource in the list, a financial year for the requested date exists. When a financial year not exists you will need to create one. It’s prefered that this is done by using Fortnox graphical interface. It’s possible to do this by using Fortnox API, but it’s not recommended.

Please note that it’s a common problem that a user forgets to create a new financial year in the beginning of a new financial year. Therefore we recommend that your solution should have the ability to handle this problem.

Accounts

The resource “Accounts” requires that you have the scope for bookkeeping enabled.

The accounts that you use needs to exist in Fortnox and be active. By checking this prior to creating the supplier invoice, you save yourself a few error messages.

METHOD

GET

URL STRUCTURE

https://api.fortnox.se/3/accounts/{AccountNumber}

If the account exists you can move forward in the process, if it didn’t exist you need to create it.

Create a new account

METHOD

POST

URL STRUCTURE

https://api.fortnox.se/3/accounts

REQUEST BODY

<?xml version="1.0" encoding="UTF-8"?>
<Account>
  <Description>Inköp av varor från Sverige</Description>
  <Number>4000</Number>
</Account>
<?xml version="1.0" encoding="UTF-8"?>
<Account url="https://api.fortnox.se/3/accounts/4000?financialyear=1">
  <Active>true</Active>
  <BalanceBroughtForward>0</BalanceBroughtForward>
  <CostCenter></CostCenter>
  <CostCenterSettings>ALLOWED</CostCenterSettings>
  <Description>Inköp av varor från Sverige</Description>
  <Number>4000</Number>
  <Project>0</Project>
  <ProjectSettings>ALLOWED</ProjectSettings>
  <SRU>0</SRU>
  <TransactionInformation></TransactionInformation>
  <TransactionInformationSettings>ALLOWED</TransactionInformationSettings>
  <VATCode></VATCode>
  <Year>1</Year>
</Account>

Voucher Series

The resource “Voucher Series” requires that you have the scope for bookkeeping enabled.

A voucher is created in a specific voucher series, it may therefore be a good idea to verify that the used voucher series exists for the provided financial year.

METHOD

GET

URL STRUCTURE

https://api.fortnox.se/3/voucherseries/{Code}/financialyeardate={Date}

If the voucher series exists, you can move forward in the process. If it didn’t exist you need to create it.

Create a new voucher series

METHOD

POST

URL STRUCTURE

https://api.fortnox.se/3/voucherseries

REQUEST BODY

<?xml version="1.0" encoding="UTF-8"?>
<VoucherSeries>
  <Code>X</Code>
  <Description>Övriga verifikationer</Description>
</VoucherSeries>
<?xml version="1.0" encoding="UTF-8"?>
<VoucherSeries url="https://api.fortnox.se/3/voucherseries/X">
  <Code>X</Code>
  <Description>Övriga verifikationer</Description>
  <Manual>false</Manual>
  <NextVoucherNumber>1</NextVoucherNumber>
  <Year>1</Year>
</VoucherSeries>

Vouchers

The resource “Vouchers” requires that you have the scope for bookkeeping enabled.

When all validation is done, it’s time to create the vouchers.

METHOD

POST

URL STRUCTURE

https://api.fortnox.se/3/vouchers

REQUEST BODY

<?xml version="1.0" encoding="UTF-8"?>
<Voucher>
    <Comments>Zrapport XXXX</Comments>
    <Description>Z-Rapport</Description>
    <TransactionDate>2014-03-13</TransactionDate>
    <VoucherRows>
        <VoucherRow>
            <Account>2641</Account>
            <Credit>200</Credit>
            <Debit>0</Debit>
            <TransactionInformation>Zrapport xxxxx </TransactionInformation>
        </VoucherRow>
        <VoucherRow>
            <Account>3011</Account>
            <Credit>800</Credit>
            <Debit>0</Debit>
            <TransactionInformation>Zrapport xxxxx </TransactionInformation>
        </VoucherRow>
        <VoucherRow>
            <Account>1930</Account>
            <Credit>0</Credit>
            <Debit>1000</Debit>
        </VoucherRow>
    </VoucherRows>
    <VoucherSeries>A</VoucherSeries>
</Voucher>
<?xml version="1.0" encoding="UTF-8"?>
<Voucher url="https://api.fortnox.se/3/vouchers/A/1?financialyear=2">
    <Comments>Zrapport XXXX</Comments>
    <CostCenter></CostCenter>
    <Description>Z-Rapport</Description>
    <Project>0</Project>
    <ReferenceNumber></ReferenceNumber>
    <ReferenceType>MANUAL</ReferenceType>
    <TransactionDate>2014-03-13</TransactionDate>
    <VoucherNumber>1</VoucherNumber>
    <VoucherRows>
        <VoucherRow>
            <Account>2641</Account>
            <CostCenter></CostCenter>
            <Credit>200</Credit>
            <Description>Debiterad ingående moms</Description>
            <Debit>0</Debit>
            <Project>0</Project>
            <Removed>false</Removed>
            <TransactionInformation>Zrapport xxxxx </TransactionInformation>
        </VoucherRow>
        <VoucherRow>
            <Account>3011</Account>
            <CostCenter></CostCenter>
            <Credit>800</Credit>
            <Description>Försäljning tillverkade produkter 25% moms</Description>
            <Debit>0</Debit>
            <Project>0</Project>
            <Removed>false</Removed>
            <TransactionInformation>Zrapport xxxxx </TransactionInformation>
        </VoucherRow>
        <VoucherRow>
            <Account>1930</Account>
            <CostCenter></CostCenter>
            <Credit>0</Credit>
            <Description>Företagskonto / checkkonto / affärskonto</Description>
            <Debit>1000</Debit>
            <Project>0</Project>
            <Removed>false</Removed>
            <TransactionInformation></TransactionInformation>
        </VoucherRow>
    </VoucherRows>
    <VoucherSeries>A</VoucherSeries>
    <Year>2</Year>
</Voucher>

Created Voucher

Upload an image

Upload either a PDF, TIF or JPG document to Fortnox that you can connect to your voucher.

METHOD

POST

URL STRUCTURE

https://api.fortnox.se/3/inbox?path=inbox_v

REQUEST BODY
The file should be sent as a data stream.

<?xml version="1.0" encoding="UTF-8"?>
<File url="https://api.fortnox.se/3/inbox/ff696daa-bee6-4e23-b8ed-258104243e94">
  <Comments></Comments>
  <Id>ff696daa-bee6-4e23-b8ed-258104243e94</Id>
  <Name>voucher1.png</Name>
  <Path>root</Path>
  <Size>157</Size>
</File>

Connect an image to voucher

The last step is to connect the uploaded image to the voucher.

METHOD

POST

URL STRUCTURE

https://api.fortnox.se/3/voucherfileconnections/?financialyeardate={Date}

REQUEST BODY

<?xml version="1.0" encoding="UTF-8"?>
<VoucherFileConnection>
    <FileId>ff696daa-bee6-4e23-b8ed-258104243e94</FileId>
    <VoucherNumber>1</VoucherNumber>
    <VoucherSeries>A</VoucherSeries>
</VoucherFileConnection>
<?xml version="1.0" encoding="UTF-8"?>
<VoucherFileConnection url="https://api.fortnox.se/3/voucherfileconnections/ff696daa-bee6-4e23-b8ed-258104243e94">
    <FileId>ff696daa-bee6-4e23-b8ed-258104243e94</FileId>
    <VoucherDescription>Z-Rapport</VoucherDescription>
    <VoucherNumber>1</VoucherNumber>
    <VoucherSeries>A</VoucherSeries>
    <VoucherYear>2</VoucherYear>
</VoucherFileConnection>