Accounting is a product where you can record your financial transactions by bookkeeping 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 bookkeeping 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.
Verify that a valid financial year exists for the bookkeeping date that you are going to use to create your voucher.
URL (GET): 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 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.
URL (GET): 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.
POST https://api.fortnox.se/3/accounts
Payload example
{
"Account": {
"Description": "Inköp av varor från Sverige",
"Number": "4000"
}
}
Response example
{
"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"
}
}
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.
URL (GET): https://api.fortnox.se/3/voucherseries/{Code}/financialyeardate={Date}
POST https://api.fortnox.se/3/voucherseries
Payload example
{
"VoucherSeries": {
"Code": "X",
"Description": "Övriga verifikationer"
}
}
Response example
{
"VoucherSeries": {
"-url": "https://api.fortnox.se/3/voucherseries/X",
"Code": "X",
"Description": "Övriga verifikationer",
"Manual": "false",
"NextVoucherNumber": "1",
"Year": "1"
}
}
When all validation is done, it’s time to create the vouchers.
POST https://api.fortnox.se/3/vouchers
Payload example
{
"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 example
{
"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.
The query parameter that is named "path" in the example below can have one of either the following values:
Inbox_a - Asset register
Inbox_d - Daily takings
Inbox_s - Supplier invoices
Inbox_v - Vouchers
Inbox_b - Bank files
Inbox_l - Payroll files
Inbox_kf - Customer invoices
Inbox_o - Orders
Inbox_of - Offers
To be able to connect the uploaded file to the newly created voucher, you have to use "Inbox_v" as value for the path-parameter.
The file should be sent as a data stream, where the content-type is multipart/form-data.
The property "Id" in the response you get when the file is properly uploaded, you shall use its value in the payload when connecting the file to the voucher.
POST https://api.fortnox.se/3/inbox?path={folder}
Response example
{
"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"
}
}
POST https://api.fortnox.se/3/voucherfileconnections
Payload example
{
"VoucherFileConnection": {
"FileId": "ff696daa-bee6-4e23-b8ed-258104243e94",
"VoucherYear": 1,
"VoucherSeries": "A",
"VoucherNumber": "1",
}
}
Response example
{
"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": "1"
}
}
See our comprehensive documentation regarding the Fortnox API.
Approximately half a million customers are waiting for your integration at our Integrations page.