List all vouchers
Retrieves a list of vouchers. The vouchers are returned sorted by voucher series and voucher number with the lowest number appearing first.
Note that vouchers have two keys, one for voucher series and one for voucher number. The financial year is also specified for each voucher, this is due to the same voucher series and number is used each year.
So to get a unique voucher you need the voucher series, the voucher number and the financial year. These properties will always be returned where ever vouchers is used.
Examples
Request
curl -X "GET" "https://api.fortnox.se/3/vouchers" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json"
Response
{ "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 49 }, "Vouchers": [ { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "Description": "Kundfaktura Anders Svensson (36)", "ReferenceNumber": "36", "ReferenceType": "INVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 25, "VoucherSeries": "B", "Year": 1 }, [...] { "@url": "https://api.fortnox.se/3/vouchers/D/6?financialyear=1", "Description": "Kundfaktura Sven Andersson (58)", "ReferenceNumber": "58", "ReferenceType": "SUPPLIERINVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 6, "VoucherSeries": "D", "Year": 1 } ] }
Request
Using Guzzle
// Include Guzzle. If using Composer: // require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; function send_request() { // Vouchers (GET https://api.fortnox.se/3/vouchers) $client = new Client(); $request = $client->createRequest('GET', 'https://api.fortnox.se/3/vouchers'); try { $request->addHeaders([ 'Access-Token'=>'61cf63ae-4ab9-4a95-9db5-753781c4f41f', 'Client-Secret'=>'3Er4kHXZTJ', 'Content-Type'=>'application/json', 'Accept'=>'application/json', ]); $response = $client->send($request); echo "Response HTTP : " . $response->getStatusCode(); } catch (RequestException $e) { echo "HTTP Request failed\n"; echo $e->getRequest(); if ($e->hasResponse()) { echo $e->getResponse(); } } }
Response
{ "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 49 }, "Vouchers": [ { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "Description": "Kundfaktura Anders Svensson (36)", "ReferenceNumber": "36", "ReferenceType": "INVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 25, "VoucherSeries": "B", "Year": 1 }, [...] { "@url": "https://api.fortnox.se/3/vouchers/D/6?financialyear=1", "Description": "Kundfaktura Sven Andersson (58)", "ReferenceNumber": "58", "ReferenceType": "SUPPLIERINVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 6, "VoucherSeries": "D", "Year": 1 } ] }
Request
require 'net/http' def send_request # Vouchers (GET ) begin uri = URI('https://api.fortnox.se/3/vouchers') # Create client http = Net::HTTP.new(uri.host, uri.port) # Create Request req = Net::HTTP::Get.new(uri) # Add headers req.add_field "Access-Token", "61cf63ae-4ab9-4a95-9db5-753781c4f41f" # Add headers req.add_field "Client-Secret", "3Er4kHXZTJ" # Add headers req.add_field "Content-Type", "application/json" # Add headers req.add_field "Accept", "application/json" # Fetch Request res = http.request(req) puts "Response HTTP Status Code: #{res.code}" puts "Response HTTP Response Body: #{res.body}" rescue Exception => e puts "HTTP Request failed (#{e.message})" end end
Response
{ "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 49 }, "Vouchers": [ { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "Description": "Kundfaktura Anders Svensson (36)", "ReferenceNumber": "36", "ReferenceType": "INVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 25, "VoucherSeries": "B", "Year": 1 }, [...] { "@url": "https://api.fortnox.se/3/vouchers/D/6?financialyear=1", "Description": "Kundfaktura Sven Andersson (58)", "ReferenceNumber": "58", "ReferenceType": "SUPPLIERINVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 6, "VoucherSeries": "D", "Year": 1 } ] }
Request
# Install the Python Requests library: # `pip install requests` import requests def send_request(): # Vouchers (GET https://api.fortnox.se/3/vouchers) try: r = requests.get( url="https://api.fortnox.se/3/vouchers", headers = { "Access-Token":"61cf63ae-4ab9-4a95-9db5-753781c4f41f", "Client-Secret":"3Er4kHXZTJ", "Content-Type":"application/json", "Accept":"application/json", }, ) print('Response HTTP Status Code : {status_code}'.format(status_code=r.status_code)) print('Response HTTP Response Body : {content}'.format(content=r.content)) except requests.exceptions.RequestException as e: print('HTTP Request failed')
Response
{ "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 49 }, "Vouchers": [ { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "Description": "Kundfaktura Anders Svensson (36)", "ReferenceNumber": "36", "ReferenceType": "INVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 25, "VoucherSeries": "B", "Year": 1 }, [...] { "@url": "https://api.fortnox.se/3/vouchers/D/6?financialyear=1", "Description": "Kundfaktura Sven Andersson (58)", "ReferenceNumber": "58", "ReferenceType": "SUPPLIERINVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 6, "VoucherSeries": "D", "Year": 1 } ] }
Using our .NET SDK
VoucherConnector connector = new VoucherConnector(); Vouchers result = connector.Find();
List all vouchers in a series
Retrieves a list of vouchers in a specific voucher series. The vouchers are returned sorted by voucher number with the lowest number appearing first.
To retrieve a list of vouchers based on a voucher series we use something called sublist, this is added to the URL together with the voucher series.
Examples
Request
curl -X "GET" "https://api.fortnox.se/3/vouchers/sublist/B" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json"
Response
{ "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 30 }, "Vouchers": [ { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "ReferenceNumber": "36", "ReferenceType": "INVOICE", "VoucherNumber": 25, "VoucherSeries": "B", "Year": 1 }, [...] { "@url": "https://api.fortnox.se/3/vouchers/B/30?financialyear=1", "ReferenceNumber": "48", "ReferenceType": "INVOICE", "VoucherNumber": 30, "VoucherSeries": "B", "Year": 1 } ] }
Request
Using Guzzle
// Include Guzzle. If using Composer: // require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; function send_request() { // Vouchers Sublist (GET https://api.fortnox.se/3/vouchers/sublist/B) $client = new Client(); $request = $client->createRequest('GET', 'https://api.fortnox.se/3/vouchers/sublist/B'); try { $request->addHeaders([ 'Access-Token'=>'61cf63ae-4ab9-4a95-9db5-753781c4f41f', 'Client-Secret'=>'3Er4kHXZTJ', 'Content-Type'=>'application/json', 'Accept'=>'application/json', ]); $response = $client->send($request); echo "Response HTTP : " . $response->getStatusCode(); } catch (RequestException $e) { echo "HTTP Request failed\n"; echo $e->getRequest(); if ($e->hasResponse()) { echo $e->getResponse(); } } }
Response
{ "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 30 }, "Vouchers": [ { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "ReferenceNumber": "36", "ReferenceType": "INVOICE", "VoucherNumber": 25, "VoucherSeries": "B", "Year": 1 }, [...] { "@url": "https://api.fortnox.se/3/vouchers/B/30?financialyear=1", "ReferenceNumber": "48", "ReferenceType": "INVOICE", "VoucherNumber": 30, "VoucherSeries": "B", "Year": 1 } ] }
Request
require 'net/http' def send_request # Vouchers Sublist (GET ) begin uri = URI('https://api.fortnox.se/3/vouchers/sublist/B') # Create client http = Net::HTTP.new(uri.host, uri.port) # Create Request req = Net::HTTP::Get.new(uri) # Add headers req.add_field "Access-Token", "61cf63ae-4ab9-4a95-9db5-753781c4f41f" # Add headers req.add_field "Client-Secret", "3Er4kHXZTJ" # Add headers req.add_field "Content-Type", "application/json" # Add headers req.add_field "Accept", "application/json" # Fetch Request res = http.request(req) puts "Response HTTP Status Code: #{res.code}" puts "Response HTTP Response Body: #{res.body}" rescue Exception => e puts "HTTP Request failed (#{e.message})" end end
Response
{ "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 30 }, "Vouchers": [ { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "ReferenceNumber": "36", "ReferenceType": "INVOICE", "VoucherNumber": 25, "VoucherSeries": "B", "Year": 1 }, [...] { "@url": "https://api.fortnox.se/3/vouchers/B/30?financialyear=1", "ReferenceNumber": "48", "ReferenceType": "INVOICE", "VoucherNumber": 30, "VoucherSeries": "B", "Year": 1 } ] }
Request
# Install the Python Requests library: # `pip install requests` import requests def send_request(): # Vouchers Sublist (GET https://api.fortnox.se/3/vouchers/sublist/B) try: r = requests.get( url="https://api.fortnox.se/3/vouchers/sublist/B", headers = { "Access-Token":"61cf63ae-4ab9-4a95-9db5-753781c4f41f", "Client-Secret":"3Er4kHXZTJ", "Content-Type":"application/json", "Accept":"application/json", }, ) print('Response HTTP Status Code : {status_code}'.format(status_code=r.status_code)) print('Response HTTP Response Body : {content}'.format(content=r.content)) except requests.exceptions.RequestException as e: print('HTTP Request failed')
Response
{ "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 30 }, "Vouchers": [ { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "ReferenceNumber": "36", "ReferenceType": "INVOICE", "VoucherNumber": 25, "VoucherSeries": "B", "Year": 1 }, [...] { "@url": "https://api.fortnox.se/3/vouchers/B/30?financialyear=1", "ReferenceNumber": "48", "ReferenceType": "INVOICE", "VoucherNumber": 30, "VoucherSeries": "B", "Year": 1 } ] }
Using our .NET SDK
VoucherConnector connector = new VoucherConnector(); connector.VoucherSeries = "B"; Vouchers result = connector.Find();
Retrieve a voucher
Retrieves the details of a voucher. To get a unique voucher you need to supply the voucher series and the voucher number, in addition to this you also need to supply the financial year in which the voucher exists.
Examples
Request
curl -X "GET" "https://api.fortnox.se/3/vouchers/B/25?financialyear=1" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json"
Response
{ "Voucher": { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "Comments": null, "CostCenter": "", "Description": "Kundfaktura Anders Svensson (36)", "Project": 0, "ReferenceNumber": "36", "ReferenceType": "INVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 25, "VoucherRows": [ { "Account": 3011, "CostCenter": "", "Credit": 499, "Debit": 0, "Description": "F\u00f6rs\u00e4ljning tillverkade produkter 25% moms", "Project": "", "Removed": false, "TransactionInformation": "" }, { "Account": 1510, "CostCenter": "", "Credit": 0, "Debit": 499, "Description": "Kundfordringar", "Project": "", "Removed": false, "TransactionInformation": "" } ], "VoucherSeries": "B", "Year": 1 } }
Request
Using Guzzle
// Include Guzzle. If using Composer: // require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; function send_request() { // Voucher (GET https://api.fortnox.se/3/vouchers/B/25) $client = new Client(); $request = $client->createRequest('GET', 'https://api.fortnox.se/3/vouchers/B/25'); try { $query = $request->getQuery(); $query->replace([ 'financialyear' => '1', ]); $request->addHeaders([ 'Access-Token'=>'61cf63ae-4ab9-4a95-9db5-753781c4f41f', 'Client-Secret'=>'3Er4kHXZTJ', 'Content-Type'=>'application/json', 'Accept'=>'application/json', ]); $response = $client->send($request); echo "Response HTTP : " . $response->getStatusCode(); } catch (RequestException $e) { echo "HTTP Request failed\n"; echo $e->getRequest(); if ($e->hasResponse()) { echo $e->getResponse(); } } }
Response
{ "Voucher": { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "Comments": null, "CostCenter": "", "Description": "Kundfaktura Anders Svensson (36)", "Project": 0, "ReferenceNumber": "36", "ReferenceType": "INVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 25, "VoucherRows": [ { "Account": 3011, "CostCenter": "", "Credit": 499, "Debit": 0, "Description": "F\u00f6rs\u00e4ljning tillverkade produkter 25% moms", "Project": 0, "Removed": false, "TransactionInformation": "" }, { "Account": 1510, "CostCenter": "", "Credit": 0, "Debit": 499, "Description": "Kundfordringar", "Project": 0, "Removed": false, "TransactionInformation": "" } ], "VoucherSeries": "B", "Year": 1 } }
Request
require 'net/http' def send_request # Voucher (GET ) begin uri = URI('https://api.fortnox.se/3/vouchers/B/25?financialyear=1') # Create client http = Net::HTTP.new(uri.host, uri.port) # Create Request req = Net::HTTP::Get.new(uri) # Add headers req.add_field "Access-Token", "61cf63ae-4ab9-4a95-9db5-753781c4f41f" # Add headers req.add_field "Client-Secret", "3Er4kHXZTJ" # Add headers req.add_field "Content-Type", "application/json" # Add headers req.add_field "Accept", "application/json" # Fetch Request res = http.request(req) puts "Response HTTP Status Code: #{res.code}" puts "Response HTTP Response Body: #{res.body}" rescue Exception => e puts "HTTP Request failed (#{e.message})" end end
Response
{ "Voucher": { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "Comments": null, "CostCenter": "", "Description": "Kundfaktura Anders Svensson (36)", "Project": 0, "ReferenceNumber": "36", "ReferenceType": "INVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 25, "VoucherRows": [ { "Account": 3011, "CostCenter": "", "Credit": 499, "Debit": 0, "Description": "F\u00f6rs\u00e4ljning tillverkade produkter 25% moms", "Project": 0, "Removed": false, "TransactionInformation": "" }, { "Account": 1510, "CostCenter": "", "Credit": 0, "Debit": 499, "Description": "Kundfordringar", "Project": 0, "Removed": false, "TransactionInformation": "" } ], "VoucherSeries": "B", "Year": 1 } }
Request
# Install the Python Requests library: # `pip install requests` import requests def send_request(): # Voucher (GET https://api.fortnox.se/3/vouchers/B/25) try: r = requests.get( url="https://api.fortnox.se/3/vouchers/B/25", params = { "financialyear":"1", }, headers = { "Access-Token":"61cf63ae-4ab9-4a95-9db5-753781c4f41f", "Client-Secret":"3Er4kHXZTJ", "Content-Type":"application/json", "Accept":"application/json", }, ) print('Response HTTP Status Code : {status_code}'.format(status_code=r.status_code)) print('Response HTTP Response Body : {content}'.format(content=r.content)) except requests.exceptions.RequestException as e: print('HTTP Request failed')
Response
{ "Voucher": { "@url": "https://api.fortnox.se/3/vouchers/B/25?financialyear=1", "Comments": null, "CostCenter": "", "Description": "Kundfaktura Anders Svensson (36)", "Project": 0, "ReferenceNumber": "36", "ReferenceType": "INVOICE", "TransactionDate": "2014-06-10", "VoucherNumber": 25, "VoucherRows": [ { "Account": 3011, "CostCenter": "", "Credit": 499, "Debit": 0, "Description": "F\u00f6rs\u00e4ljning tillverkade produkter 25% moms", "Project": 0, "Removed": false, "TransactionInformation": "" }, { "Account": 1510, "CostCenter": "", "Credit": 0, "Debit": 499, "Description": "Kundfordringar", "Project": 0, "Removed": false, "TransactionInformation": "" } ], "VoucherSeries": "B", "Year": 1 } }
Using our .NET SDK
VoucherConnector connector = new VoucherConnector(); connector.FinancialYearID = "1"; Voucher result = connector.Get("B", "25");
Create a voucher
The created voucher will be returned if everything succeeded, if there was any problems an error will be returned.
Examples
Request
curl -X "POST" "https://api.fortnox.se/3/vouchers" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d $'{ "Voucher": { "TransactionDate": "2015-02-01", "Description": "Example transaction", "VoucherRows": [ { "Account": "1930", "Debit": "1500", "Credit": "0" }, { "Account": "1910", "Debit": "0", "Credit": "1500" } ], "VoucherSeries": "A" } }'
Response
{ "Voucher": { "@url": "https://api.fortnox.se/3/vouchers/A/1?financialyear=2", "Comments": null, "CostCenter": "", "Description": "Example transaction", "Project": 0, "ReferenceNumber": "", "ReferenceType": "MANUAL", "TransactionDate": "2015-02-01", "VoucherNumber": 1, "VoucherRows": [ { "Account": 1930, "CostCenter": "", "Credit": 0, "Debit": 1500, "Description": "F\u00f6retagskonto / checkkonto / aff\u00e4rskonto", "Project": "", "Removed": false, "TransactionInformation": "" }, { "Account": 1910, "CostCenter": "", "Credit": 1500, "Debit": 0, "Description": "Kassa", "Project": "", "Removed": false, "TransactionInformation": "" } ], "VoucherSeries": "A", "Year": 2 } }
Request
Using Guzzle
// Include Guzzle. If using Composer: // require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Post\PostBody; use GuzzleHttp\Stream\StreamInterface; use GuzzleHttp\Exception\RequestException; function send_request() { // Voucher (POST https://api.fortnox.se/3/vouchers) $client = new Client(); $request = $client->createRequest('POST', 'https://api.fortnox.se/3/vouchers'); $postBody = $request->getBody(); try { $request->addHeaders([ 'Access-Token'=>'61cf63ae-4ab9-4a95-9db5-753781c4f41f', 'Client-Secret'=>'3Er4kHXZTJ', 'Content-Type'=>'application/json', 'Accept'=>'application/json', ]); $body = [ "Voucher" => [ "Description" => "Example transaction", "VoucherSeries" => "A", "TransactionDate" => "2015-02-01", "VoucherRows" => [ [ "Description" => "Företagskonto / checkkonto / affärskonto", "Debit" => "1500", "Account" => "1930", "Credit" => "0" ], [ "Description" => "Kassa", "Debit" => "0", "Account" => "1910", "Credit" => "1500" ] ] ] ]; $request->setBody(GuzzleHttp\Stream\Stream::factory(json_encode($body))); $response = $client->send($request); echo "Response HTTP : " . $response->getStatusCode(); } catch (RequestException $e) { echo "HTTP Request failed\n"; echo $e->getRequest(); if ($e->hasResponse()) { echo $e->getResponse(); } } }
Response
{ "Voucher": { "@url": "https://api.fortnox.se/3/vouchers/A/1?financialyear=2", "Comments": null, "CostCenter": "", "Description": "Example transaction", "Project": 0, "ReferenceNumber": "", "ReferenceType": "MANUAL", "TransactionDate": "2015-02-01", "VoucherNumber": 1, "VoucherRows": [ { "Account": 1930, "CostCenter": "", "Credit": 0, "Debit": 1500, "Description": "F\u00f6retagskonto / checkkonto / aff\u00e4rskonto", "Project": 0, "Removed": false, "TransactionInformation": "" }, { "Account": 1910, "CostCenter": "", "Credit": 1500, "Debit": 0, "Description": "Kassa", "Project": 0, "Removed": false, "TransactionInformation": "" } ], "VoucherSeries": "A", "Year": 2 } }
Request
require 'net/http' require 'json' def send_request # Voucher (POST ) begin uri = URI('https://api.fortnox.se/3/vouchers') # Create client http = Net::HTTP.new(uri.host, uri.port) dict = { "Voucher" => { "Description" => "Example transaction", "VoucherSeries" => "A", "TransactionDate" => "2015-02-01", "VoucherRows" => [ { "Description" => "Företagskonto / checkkonto / affärskonto", "Debit" => "1500", "Account" => "1930", "Credit" => "0" }, { "Description" => "Kassa", "Debit" => "0", "Account" => "1910", "Credit" => "1500" } ] } } body = JSON.dump(dict) # Create Request req = Net::HTTP::Post.new(uri) # Add headers req.add_field "Access-Token", "61cf63ae-4ab9-4a95-9db5-753781c4f41f" # Add headers req.add_field "Client-Secret", "3Er4kHXZTJ" # Add headers req.add_field "Content-Type", "application/json" # Add headers req.add_field "Accept", "application/json" # Set header and body req.add_field "Content-Type", "application/json" req.body = body # Fetch Request res = http.request(req) puts "Response HTTP Status Code: #{res.code}" puts "Response HTTP Response Body: #{res.body}" rescue Exception => e puts "HTTP Request failed (#{e.message})" end end
Response
{ "Voucher": { "@url": "https://api.fortnox.se/3/vouchers/A/1?financialyear=2", "Comments": null, "CostCenter": "", "Description": "Example transaction", "Project": 0, "ReferenceNumber": "", "ReferenceType": "MANUAL", "TransactionDate": "2015-02-01", "VoucherNumber": 1, "VoucherRows": [ { "Account": 1930, "CostCenter": "", "Credit": 0, "Debit": 1500, "Description": "F\u00f6retagskonto / checkkonto / aff\u00e4rskonto", "Project": 0, "Removed": false, "TransactionInformation": "" }, { "Account": 1910, "CostCenter": "", "Credit": 1500, "Debit": 0, "Description": "Kassa", "Project": 0, "Removed": false, "TransactionInformation": "" } ], "VoucherSeries": "A", "Year": 2 } }
Request
# Install the Python Requests library: # `pip install requests` import requests import json def send_request(): # Voucher (POST https://api.fortnox.se/3/vouchers) try: r = requests.post( url="https://api.fortnox.se/3/vouchers", headers = { "Access-Token":"61cf63ae-4ab9-4a95-9db5-753781c4f41f", "Client-Secret":"3Er4kHXZTJ", "Content-Type":"application/json", "Accept":"application/json", }, data = json.dumps({ "Voucher": { "Description": "Example transaction", "VoucherSeries": "A", "TransactionDate": "2015-02-01", "VoucherRows": [ { "Description": "Företagskonto / checkkonto / affärskonto", "Debit": "1500", "Account": "1930", "Credit": "0" }, { "Description": "Kassa", "Debit": "0", "Account": "1910", "Credit": "1500" } ] } }) ) print('Response HTTP Status Code : {status_code}'.format(status_code=r.status_code)) print('Response HTTP Response Body : {content}'.format(content=r.content)) except requests.exceptions.RequestException as e: print('HTTP Request failed')
Response
{ "Voucher": { "@url": "https://api.fortnox.se/3/vouchers/A/1?financialyear=2", "Comments": null, "CostCenter": "", "Description": "Example transaction", "Project": 0, "ReferenceNumber": "", "ReferenceType": "MANUAL", "TransactionDate": "2015-02-01", "VoucherNumber": 1, "VoucherRows": [ { "Account": 1930, "CostCenter": "", "Credit": 0, "Debit": 1500, "Description": "F\u00f6retagskonto / checkkonto / aff\u00e4rskonto", "Project": 0, "Removed": false, "TransactionInformation": "" }, { "Account": 1910, "CostCenter": "", "Credit": 1500, "Debit": 0, "Description": "Kassa", "Project": 0, "Removed": false, "TransactionInformation": "" } ], "VoucherSeries": "A", "Year": 2 } }
Using our .NET SDK
VoucherConnector connector = new VoucherConnector(); List<VoucherRow> rows = new List<VoucherRow>(); rows.Add(new VoucherRow() { Account = "1930", Description = "Företagskonto / checkkonto / affärskonto", Debit = "1500", Credit = "0" }); rows.Add(new VoucherRow() { Account = "1910", Description = "Kassa", Debit = "0", Credit = "1500" }); Voucher result = connector.Create(new Voucher() { TransactionDate = "2015-02-01", Description = "Example transaction", VoucherRows = rows, VoucherSeries = "A" });
Properties
Voucher
Property | Description |
Url | string, read-only Direct URL to the record. |
Comments | string, 1000 characters Comments of the voucher. |
CostCenter | string, searchable Code of the cost center. The code must be of an existing cost center. |
Description | string, 200 characters, required Description of the voucher. |
Project | string Code of the project. The code must be of an existing project. |
ReferenceNumber | string, sortable, read-only Reference number, for example an invoice number. |
ReferenceType | string, read-only Reference type. Can be INVOICE SUPPLIERINVOICE INVOICEPAYMENT SUPPLIERPAYMENT MANUAL CASHINVOICE or ACCRUAL |
TransactionDate | date, required Date of the transaction. Must be a valid date according to our date format. |
VoucherNumber | integer, sortable, read-only Number of the voucher |
VoucherRows | array The properties for the object in this array is listed in the table for “Voucher Rows”. |
VoucherSeries | string, sortable Code of the voucher series. The code must be of an existing voucher series. |
Year | integer, read-only Id of the year of the voucher. |
ApprovalState | integer, read-only The approval state f the voucher. Not for approval: 0 Not ready for approval: 1 Not approved: 2 Approved: 3 |
Voucher Rows
Property | Description |
Account | integer, 4 digits Account number. The number must be of an existing active account. |
CostCenter | string Code of the cost center. The code must be of an existing cost center. |
Credit | float, 14 digits (incl. decimals) Amount of credit. |
Description | string, read-only The description of the account. |
Debit | float, 14 digits (incl. decimals) Amount of debit. |
Project | string Code of the project. The code must be of an existing project. |
Removed | boolean, read-only If the row is marked as removed. |
TransactionInformation | string, 100 characters Transaction information regarding the row. |