API: Accounting
POST /accounting_api/add | Create a new accounting statement using FORM DATA. |
POST /accounting_api/do/upload_attachment | Add an attachment to a statement. |
GET /accounting_api/get/account_balance | Fetch the balance of a given account and date. |
GET /accounting_api/get/ledger | Fetch a ledger report. |
GET /accounting_api/get/accounts | Fetch a list of accounts. |
GET /accounting_api/get/vatcodes | Fetch a list of VAT codes. |
GET /accounting_api/get/periods | Fetch a list of accounting periods. |
GET /accounting_api/get/opening_balances | Fetch a list of opening balances for a given period. |
POST /accounting_api/add
Create a new accounting statement using FORM DATA.
Statement rows are given as an array, for example row[x][debit] is the debit value of the row x.
Request parameters
Name | Description | Data type | Req’d | Example |
---|---|---|---|---|
entry_date | Entry date. Leave empty for current date. | string (date) | 2024-01-01 | |
statement_series_code | Statement series code. | string | CA (see Statement series list) | |
description | Description of statement | string | Cash sales | |
purchase_invoice_id | purchace_invoice_id* | int | ||
*Mandatory if statement_series_code is PU. Also statement_series_code MUST be PU if purchase_invoice_id is given.
If statement_series_code parameter NOT posted at all, statement_series_code is GL.
Header fields (above) appears only once in the POST payload and they are all optional. At least two statement rows (below) must be sent along with the header data. Number of rows is not limited, but the sum of all debit fields must be equal to the sum of all credit fields. A single row must not have both debit and credit values present.
Negative values are not allowed, the amount must be given to the correct debit/credit side as positive.
Name | Description | Data type | Req’d | Example |
---|---|---|---|---|
row[1][debit] | Debit sum for first statement row, max 2 decimals | number | YES | 100.00 |
row[1][account] | Account for the first statement row | int | YES | 4000 |
row[1][description] | Description for the first statement row | string | Row description | |
row[1][vatcode] | VAT handling (identifier) for the row. Use GET /accounting_api/get/vatcodes for full list of VAT handling identifiers and their functions * | int | ||
row[1][dim_{dimension_type_id}] | Dimensions for statement row. {dimension_type_id} is the id of the dimension type and it’s value is the code of the dimension. | string | row[1][dim_1] = 100 (dimension for the type ”1” would be 100) | |
row[1][accrual_start] | Acrual start date YYYY-MM-DD | date | 2024-12-31 | |
row[1][accrual_count] | Count of acruals | int | 12 | |
row[2][credit] | Credit sum for the second statement row, max 2 decimals | number | YES | 100.00 |
row[2][account] | Account for the second statement row | int | YES | 199999 |
row[2][description] | Description for the second statement row | string | ||
row[2][vatcode] | VAT handling (identifier) for the row. Use GET /accounting_api/get/vatcodes for full list of VAT handling identifiers and their functions | int | ||
row[2][dim_{dimension_type_id}] | Dimensions for statement row. {dimension_type_id} is the id of the dimension type and it’s value is the code of the dimension. | string | ||
row[2][accrual_start] | Acrual start date YYYY-MM-DD | date | 2024-12-31 | |
row[2][accrual_count] | Count of acruals | int | 12 |
* Standard vatcodes | ||
Id | Vatpercent | Type |
63 | 25.50 | Sales |
11 | 24 | Sales |
58 | 25.50 | Purchases |
1 | 24 | Purchases |
Response
Response code | Description |
---|---|
200 | Ok, adding a statement was successfull |
400 | Unable to add a statement. Further information can be found from the errors array in response JSON |
401 | API key / company code is invalid or the user does not have permission to add statements |
405 | Invalid method, double check you are sending ”POST” and not ”GET” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
id | If adding a statement was successfull, id contains unique identifier for the newly created statement | int | 1234 |
statement_number | Statement number | int | 5 |
statement_series_code | Statement series code Starting from 8.8.22 | string | GL (see Statement series list) |
statement_series_id | Old way. Only if POST statement_series_id or no statement_series_id or_statement_series_code. Do not make new implementations after 8.8.2022. Fennoa internal identifier of the statement series. | int | 16 |
Statement series
Following statement serias are available to POST (add).
Statement series name | Series code |
---|---|
Cash | CA |
General ledger 1 | GL |
General ledger 2 | GL2 |
General ledger 3 | GL3 |
General ledger 4 | GL4 |
General ledger 5 | GL5 |
General ledger 6 | GL6 |
Purchace invoice* | PU |
*Only for adding statement to purchace invoice already saved to Fennoa.
POST /accounting_api/do/upload_attachment
Add an attachment to a statement. PDF-format is recommended, but JPEG or PNG are also supported.
Request parameters
Request parameters are given as part of the URL as follows:
/accounting_api/do/upload_attachment/<id>
Name | Description | Data type | Req’d | Example |
---|---|---|---|---|
id | Unique identifier of a statement | int | 100 | |
Form data
Content type must be multipart/form-data which is used to send binary data to the server. Form-data contains one field ”file” that is the actual file upload.
Name | Description | Data type | Req’d | Example |
---|---|---|---|---|
file | File to upload | file | YES | |
Response
Response code | Description |
---|---|
200 | Ok, file uploaded successfully and attached to the statement |
400 | Error receiving the file |
401 | API key / company code is invalid or the user does not have permission |
405 | Invalid method, double check you are sending ”POST” and not ”GET” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
data | Description of the status (if stataus = OK) | string | File stored. |
GET /accounting_api/get/account_balance
Fetch the balance of a given account and date.
Request parameters are given as part of the URL as follows:
/accounting_api/get/account_balance/<accounts>/<date>/[<dimensions>]
Example queries:
/accounting_api/get/account_balance/2018-01-01/2018-01-31
/accounting_api/get/account_balance/2018-01-01/2018-01-31/accounts:1900,1910
/accounting_api/get/account_balance/2018-01-01/2018-01-31/dim1:100
Request parameters
Name | Description | Data type | Req’d | Example |
---|---|---|---|---|
account | Account from which the balance is being fetched | int | YES | 1910 |
date | Balance date | int | YES | 2024-12-31 |
Response
Response | |
---|---|
Response code | Description |
200 | Ok, fetching a balance was successfull |
400 | Unable to fetch balance |
401 | API key / company code is invalid or the user does not have permission to fetch account balance |
404 | Account, dimension or dimension type is not found |
405 | Invalid method, double check you are sending ”GET” and not ”POST” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
account | Account (from the request) | int | 1900 |
date | Date (from the request) | string (date) | 2024-12-31 |
dimensions | Dimension (from the request) | array | |
sum_debit | Debit sum | number | 400.01 |
sum_credit | Credit sum | number | 300.02 |
GET /accounting_api/get/ledger
Fetch a ledger report.
Request parameters are given as part of the URL as follows:
/accounting_api/get/ledger/<start_date>/<end_date>/[<additional_filters>]
Request parameters
Name | Description | Data type | Req’d | Example |
---|---|---|---|---|
start_date | Start date of the ledger report | string (date) | YES | 2024-12-01 |
end_date | End date of the ledger report | string (date) | YES | 2024-12-31 |
Additional filters
Name | Description | Data type | Req’d | Example |
---|---|---|---|---|
accounts | Fetch ledger only given accounts, separated by a comma | string | 1900,1910,1920 | |
dimX | Dimensions. Level of dimensio and value | string | dim1:100 | |
series | Statement series id | string |
1=GL 2=IN 3=PU 5=PJ 16=CA |
Example queries:
/accounting_api/get/ledger/2018-01-01/2018-01-31
/accounting_api/get/ledger/2018-01-01/2018-01-31/accounts:1900,1910
/accounting_api/get/ledger/2018-01-01/2018-01-31/dim1:100
/accounting_api/get/ledger/2018-01-01/2018-01-31/accounts:1900,1910/dim1:100/dim2:200
/accounting_api/get/ledger/2018-01-01/2018-01-31/series:1 (statement_series_id)
Response
Response code | Description |
---|---|
200 | Ok, fetching a ledger was successfull |
400 | Unable to fetch ledger |
401 | API key / company code is invalid or the user does not have permission to fetch ledger |
405 | Invalid method, double check you are sending ”GET” and not ”POST” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
statement_id | Unique identifier of the statement row | int | 10540 |
account | Account | string | 1900 |
date | Date | string (date) | 2024-01-02 |
debit | Debit value | number | 45.67 |
credit | Credit value | number | 0.00 |
description | Description | string | Description from the statement |
series | Statement series code | string | IN |
number | Statement number | int | 52 |
opening | Opening balance | number | 0.00 |
closing | Closing balance | number | 45.67 |
dimensions | Zero dimensions returns empty array | ||
links | |||
type | Type of statement | string | sales_invoice |
id | Statement id | int | 2750 |
url | Url (after https://app.fennoa.com) to GET statement | string | /api/sales_api/2750 |
GET /accounting_api/get/accounts
Fetch a list of accounts.
Request parameters
Request parameters are given as part of the URL as follows:
/accounting_api/get/accounts/[<accounts>]
Example queries:
/accounting_api/get/accounts
/accounting_api/get/accounts/1900,1910
Response
Response code | Description |
---|---|
200 | Ok, fetching accounts was successfull |
400 | Unable to fetch accounts |
401 | API key / company code is invalid or the user does not have permission to fetch accounts |
404 | Accounts not found using the given filters |
405 | Invalid method, double check you are sending ”GET” and not ”POST” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
code | Numeric code for an account | int | 1900 |
name | Account name | string | Cash |
vatcode_id | VAT code (if configured for account) | int | 1 |
vatcode_type | If VAT code is present, type indicates whether it is for sales or for purchases | string | sales / purchases |
vatcode | VAT code, human readable version | string | Standard / Reduced 1 / EU-services |
GET /accounting_api/get/vatcodes
Fetch a list of VAT codes.
Response
Response code | Description |
---|---|
200 | Ok, fetching VAT codes was successfull |
400 | Unable to fetch VAT codes |
401 | API key / company code is invalid or the user does not have permission to fetch VAT codes |
405 | Invalid method, double check you are sending ”GET” and not ”POST” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
id | Unique identifier of the VAT code | int | 1 |
type | Either ”sales” or ”purchases” | string | sales / purchases |
name | Human-readable presentation of the VAT code | string | Standard / Reduced 1 |
GET /accounting_api/get/periods
Fetch a list of accounting periods.
Response
Response code | Description |
---|---|
200 | Ok, fetching VAT codes was successfull |
400 | Unable to fetch VAT codes |
401 | API key / company code is invalid or the user does not have permission to fetch VAT codes |
405 | Invalid method, double check you are sending ”GET” and not ”POST” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
id | Unique identifier of the VAT code | int | 1 |
type | Either ”sales” or ”purchases” | string | sales / purchases |
name | Human-readable presentation of the VAT code | string | Standard / Reduced 1 |
GET /accounting_api/get/periods
Fetch a list of accounting periods.
Response
Response code | Description |
---|---|
200 | Ok, fetching accounting periods was successfull |
400 | Unable to fetch accounting periods |
401 | API key / company code is invalid or the user does not have permission to fetch accounting periods |
405 | Invalid method, double check you are sending ”GET” and not ”POST” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
id | Unique identifier of the accounting period | int | 2 |
start_date | First day of the accounting period | date | 2024-01-01 |
end_date | Last day of the accounting period | date | 2024-12-31 |
GET /accounting_api/get/opening_balances
Fetch a list of opening balances for a given period.
Request parameters are given as part of the URL as follows:
/accounting_api/get/opening_balances/<period_id>/[<additional_filters>]
Additional filters
Name | Description | Data type | Req’d | Example |
---|---|---|---|---|
accounts | Fetch opening balances for only given accounts, separated by a comma | string | 1900,1910,1920 | |
Response
Response code | Description |
---|---|
200 | Ok, fetching opening balances was successfull |
400 | Unable to fetch opening balances |
401 | API key / company code is invalid or the user does not have permission to fetch opening balances |
405 | Invalid method, double check you are sending ”GET” and not ”POST” etc |
503 | Service Unavailable |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
status | Status of the operation | string | OK / ERROR |
Name | Description | Data type | Possible values / Examples |
---|---|---|---|
account_code | Account number | int | 1021 |
total_sum | Total sum | number | 815.04 |
debit_sum | Debit | number | 815.04 |