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.
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.
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.
REQUEST:
Method: GET
URL Structure: https://api.fortnox.se/3/accounts/{AccountNumber}
RESPONSE:
If the account exists you can move forward in the process, if it didn’t exist you need to create it.
REQUEST:
METHOD: POST
URL STRUCTURE: https://api.fortnox.se/3/accounts
REQUEST BODY
{
"Account": {
"Description": "Inköp av varor från Sverige",
"Number": "4000"
}
}
RESPONSE
{
"Account": {
"-url": "https://api.fortnox.se/3/accounts/4000?financialyear=1",
"Active": "true",
"BalanceBroughtForward": "0",
"CostCenter": {
},
"CostCenterSettings": "ALLOWED",
"Description": "Inköp av varor från Sverige",
"Number": "4000",
"Project": "0",
"ProjectSettings": "ALLOWED",
"SRU": "0",
"TransactionInformation": {
},
"TransactionInformationSettings": "ALLOWED",
"VATCode": {
},
"Year": "1"
}
}
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.
REQUEST
Method: GET
URL Structure: https://api.fortnox.se/3/voucherseries/{Code}/financialyeardate={Date}
REQUEST
Method: POST
URL Structure: https://api.fortnox.se/3/voucherseries
REQUEST BODY:
{
"VoucherSeries": {
"Code": "X",
"Description": "Övriga verifikationer"
}
}
RESPONSE:
{
"VoucherSeries": {
"-url": "https://api.fortnox.se/3/voucherseries/X",
"Code": "X",
"Description": "Övriga verifikationer",
"Manual": "false",
"NextVoucherNumber": "1",
"Year": "1"
}
}
The resource “Vouchers” requires that you have the scope for bookkeeping enabled.
When all validation is done, it’s time to create the vouchers.
REQUEST:
METHOD: POST
URL Structure: https://api.fortnox.se/3/vouchers
REQUEST BODY:
{
"Voucher": {
"Comments": "Zrapport XXXX",
"Description": "Z-Rapport",
"TransactionDate": "2014-03-13",
"VoucherRows": {
"VoucherRow": [
{
"Account": "2641",
"Credit": "200",
"Debit": "0",
"TransactionInformation": "Zrapport xxxxx "
},
{
"Account": "3011",
"Credit": "800",
"Debit": "0",
"TransactionInformation": "Zrapport xxxxx "
},
{
"Account": "1930",
"Credit": "0",
"Debit": "1000"
}
]
},
"VoucherSeries": "A"
}
}
RESPONSE:
{
"Voucher": {
"-url": "https://api.fortnox.se/3/vouchers/A/1?financialyear=2",
"Comments": "Zrapport XXXX",
"CostCenter": {
},
"Description": "Z-Rapport",
"Project": "0",
"ReferenceNumber": {
},
"ReferenceType": "MANUAL",
"TransactionDate": "2014-03-13",
"VoucherNumber": "1",
"VoucherRows": {
"VoucherRow": [
{
"Account": "2641",
"CostCenter": {
},
"Credit": "200",
"Description": "Debiterad ingående moms",
"Debit": "0",
"Project": "0",
"Removed": "false",
"TransactionInformation": "Zrapport xxxxx "
},
{
"Account": "3011",
"CostCenter": {
},
"Credit": "800",
"Description": "Försäljning tillverkade produkter 25% moms",
"Debit": "0",
"Project": "0",
"Removed": "false",
"TransactionInformation": "Zrapport xxxxx "
},
{
"Account": "1930",
"CostCenter": {
},
"Credit": "0",
"Description": "Företagskonto / checkkonto / affärskonto",
"Debit": "1000",
"Project": "0",
"Removed": "false",
"TransactionInformation": {
}
}
]
},
"VoucherSeries": "A",
"Year": "2"
}
}
Upload either a PDF, TIF or JPG document to Fortnox that you can connect to your voucher.
REQUEST:
Method: POST
URL Structure: https://api.fortnox.se/3/inbox?path=inbox_v
REQUEST BODY:
The file should be sent as a data stream.
RESPONSE:
{
"File": {
"-url": "https://api.fortnox.se/3/inbox/ff696daa-bee6-4e23-b8ed-258104243e94",
"Comments": {
},
"Id": "ff696daa-bee6-4e23-b8ed-258104243e94",
"Name": "voucher1.png",
"Path": "root",
"Size": "157"
}
}
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:
{
"VoucherFileConnection": {
"FileId": "ff696daa-bee6-4e23-b8ed-258104243e94",
"VoucherNumber": "1",
"VoucherSeries": "A"
}
}
RESPONSE:
{
"VoucherFileConnection": {
"-url": "https://api.fortnox.se/3/voucherfileconnections/ff696daa-bee6-4e23-b8ed-258104243e94",
"FileId": "ff696daa-bee6-4e23-b8ed-258104243e94",
"VoucherDescription": "Z-Rapport",
"VoucherNumber": "1",
"VoucherSeries": "A",
"VoucherYear": "2"
}
}