List all customers
Retrieves a list of customers. The customers are returned sorted by customer number with the lowest number appearing first.
Examples
Request
curl -X "GET" "https://api.fortnox.se/3/customers" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json"
Response
{ "Customers": [ { "@url": "https://api.fortnox.se/3/customers/102", "Address1": "Halltorpsgatan", "Address2": "", "City": "KLIPPAN", "CustomerNumber": "102", "Email": "a.s@example.com", "Name": "Anders Svensson", "OrganisationNumber": "", "Phone": "0435-9249236", "ZipCode": "264 32" }, [...] { "@url": "https://api.fortnox.se/3/customers/110", "Address1": "Bjurtjärn åsviken", "Address2": "", "City": "ÄLMHULT", "CustomerNumber": "102", "Email": "s.v@example.com", "Name": "Stina Velander", "OrganisationNumber": "", "Phone": "0476-1352274", "ZipCode": "343 90" } ], "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 10 } }
Request
Using Guzzle
// Include Guzzle. If using Composer: // require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; function send_request() { // Customers (GET https://api.fortnox.se/3/customers) $client = new Client(); $request = $client->createRequest('GET', 'https://api.fortnox.se/3/customers'); 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
{ "Customers": [ { "@url": "https://api.fortnox.se/3/customers/102", "Address1": "Halltorpsgatan", "Address2": "", "City": "KLIPPAN", "CustomerNumber": "102", "Email": "a.s@example.com", "Name": "Anders Svensson", "OrganisationNumber": "", "Phone": "0435-9249236", "ZipCode": "264 32" }, [...] { "@url": "https://api.fortnox.se/3/customers/110", "Address1": "Bjurtjärn åsviken", "Address2": "", "City": "ÄLMHULT", "CustomerNumber": "102", "Email": "s.v@example.com", "Name": "Stina Velander", "OrganisationNumber": "", "Phone": "0476-1352274", "ZipCode": "343 90" } ], "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 10 } }
Request
require 'net/http' def send_request # Customers (GET ) begin uri = URI('https://api.fortnox.se/3/customers') # 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
{ "Customers": [ { "@url": "https://api.fortnox.se/3/customers/102", "Address1": "Halltorpsgatan", "Address2": "", "City": "KLIPPAN", "CustomerNumber": "102", "Email": "a.s@example.com", "Name": "Anders Svensson", "OrganisationNumber": "", "Phone": "0435-9249236", "ZipCode": "264 32" }, [...] { "@url": "https://api.fortnox.se/3/customers/110", "Address1": "Bjurtjärn åsviken", "Address2": "", "City": "ÄLMHULT", "CustomerNumber": "102", "Email": "s.v@example.com", "Name": "Stina Velander", "OrganisationNumber": "", "Phone": "0476-1352274", "ZipCode": "343 90" } ], "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 10 } }
Request
# Install the Python Requests library: # `pip install requests` import requests def send_request(): # Customers (GET https://api.fortnox.se/3/customers) try: r = requests.get( url="https://api.fortnox.se/3/customers", 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
{ "Customers": [ { "@url": "https://api.fortnox.se/3/customers/102", "Address1": "Halltorpsgatan", "Address2": "", "City": "KLIPPAN", "CustomerNumber": "102", "Email": "a.s@example.com", "Name": "Anders Svensson", "OrganisationNumber": "", "Phone": "0435-9249236", "ZipCode": "264 32" }, [...] { "@url": "https://api.fortnox.se/3/customers/110", "Address1": "Bjurtjärn åsviken", "Address2": "", "City": "ÄLMHULT", "CustomerNumber": "102", "Email": "s.v@example.com", "Name": "Stina Velander", "OrganisationNumber": "", "Phone": "0476-1352274", "ZipCode": "343 90" } ], "MetaInformation": { "@CurrentPage": 1, "@TotalPages": 1, "@TotalResources": 10 } }
Using our .NET SDK
CustomerConnector connector = new CustomerConnector(); Customers result = connector.Find();
Retrieve a customer
Retrieves the details of a customer. You need to supply the unique customer number that was returned when the customer was created or retrieved from the list of customers.
Examples
Request
curl -X "GET" "https://api.fortnox.se/3/customers/102" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json"
Response
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/102", "Active": true, "Address1": "Halltorpsgatan", "Address2": null, "City": "KLIPPAN", "Comments": null, "CostCenter": null, "Country": "Sverige", "CountryCode": "SE", "Currency": "SEK", "CustomerNumber": "102", "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "a.s@example.com", "EmailInvoice": "a.s@example.com", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "a.s@example.com", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "a.s@example.com", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "GLN": null, "GLNDelivery": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Anders Svensson", "OrganisationNumber": "", "OurReference": "", "Phone1": "0435-9249236", "Phone2": null, "PriceList": "A", "Project": "", "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "PRIVATE", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": "264 32" } }
Request
Using Guzzle
// Include Guzzle. If using Composer: // require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; function send_request() { // Customer (GET https://api.fortnox.se/3/customers/102) $client = new Client(); $request = $client->createRequest('GET', 'https://api.fortnox.se/3/customers/102'); 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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/102", "Address1": "Halltorpsgatan", "Address2": null, "City": "KLIPPAN", "Comments": null, "CostCenter": null, "Country": "Sverige", "CountryCode": "SE", "Currency": "SEK", "CustomerNumber": "102", "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "a.s@example.com", "EmailInvoice": "a.s@example.com", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "a.s@example.com", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "a.s@example.com", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Anders Svensson", "OrganisationNumber": "", "OurReference": "", "Phone1": "0435-9249236", "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "PRIVATE", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": "264 32" } }
Request
require 'net/http' def send_request # Customer (GET ) begin uri = URI('https://api.fortnox.se/3/customers/102') # 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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/102", "Address1": "Halltorpsgatan", "Address2": null, "City": "KLIPPAN", "Comments": null, "CostCenter": null, "Country": "Sverige", "CountryCode": "SE", "Currency": "SEK", "CustomerNumber": "102", "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "a.s@example.com", "EmailInvoice": "a.s@example.com", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "a.s@example.com", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "a.s@example.com", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Anders Svensson", "OrganisationNumber": "", "OurReference": "", "Phone1": "0435-9249236", "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "PRIVATE", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": "264 32" } }
Request
# Install the Python Requests library: # `pip install requests` import requests def send_request(): # Customer (GET https://api.fortnox.se/3/customers/102) try: r = requests.get( url="https://api.fortnox.se/3/customers/102", 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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/102", "Address1": "Halltorpsgatan", "Address2": null, "City": "KLIPPAN", "Comments": null, "CostCenter": null, "Country": "Sverige", "CountryCode": "SE", "Currency": "SEK", "CustomerNumber": "102", "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "a.s@example.com", "EmailInvoice": "a.s@example.com", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "a.s@example.com", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "a.s@example.com", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Anders Svensson", "OrganisationNumber": "", "OurReference": "", "Phone1": "0435-9249236", "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "PRIVATE", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": "264 32" } }
Using our .NET SDK
CustomerConnector connector = new CustomerConnector(); Customer result = connector.Get("102");
Create a customer
The created customer 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/customers" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d $'{ "Customer":{ "Name": "Klara Norström" } }'
Response
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/115", "Active": true, "Address1": null, "Address2": null, "City": null, "Comments": null, "CostCenter": null, "Country": null, "CountryCode": null, "Currency": "SEK", "CustomerNumber": 115, "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "", "EmailInvoice": "", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "GLN": null, "GLNDelivery": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Klara Norstr\u00f6m", "OrganisationNumber": "", "OurReference": "", "Phone1": null, "Phone2": null, "PriceList": "A", "Project": "", "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "COMPANY", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": null } }
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() { // Customer (POST https://api.fortnox.se/3/customers) $client = new Client(); $request = $client->createRequest('POST', 'https://api.fortnox.se/3/customers'); $postBody = $request->getBody(); try { $request->addHeaders([ 'Access-Token'=>'61cf63ae-4ab9-4a95-9db5-753781c4f41f', 'Client-Secret'=>'3Er4kHXZTJ', 'Content-Type'=>'application/json', 'Accept'=>'application/json', ]); $body = [ "Customer" => [ "Name" => "Klara Norström" ] ]; $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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/115", "Address1": null, "Address2": null, "City": null, "Comments": null, "CostCenter": null, "Country": null, "CountryCode": null, "Currency": "SEK", "CustomerNumber": 115, "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "", "EmailInvoice": "", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Klara Norstr\u00f6m", "OrganisationNumber": "", "OurReference": "", "Phone1": null, "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "COMPANY", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": null } }
Request
require 'net/http' require 'json' def send_request # Customer (POST ) begin uri = URI('https://api.fortnox.se/3/customers') # Create client http = Net::HTTP.new(uri.host, uri.port) dict = { "Customer" => { "Name" => "Klara Norström" } } 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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/115", "Address1": null, "Address2": null, "City": null, "Comments": null, "CostCenter": null, "Country": null, "CountryCode": null, "Currency": "SEK", "CustomerNumber": 115, "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "", "EmailInvoice": "", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Klara Norstr\u00f6m", "OrganisationNumber": "", "OurReference": "", "Phone1": null, "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "COMPANY", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": null } }
Request
# Install the Python Requests library: # `pip install requests` import requests import json def send_request(): # Customer (POST https://api.fortnox.se/3/customers) try: r = requests.post( url="https://api.fortnox.se/3/customers", headers = { "Access-Token":"61cf63ae-4ab9-4a95-9db5-753781c4f41f", "Client-Secret":"3Er4kHXZTJ", "Content-Type":"application/json", "Accept":"application/json", }, data = json.dumps({ "Customer": { "Name": "Klara Norström" } }) ) 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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/115", "Address1": null, "Address2": null, "City": null, "Comments": null, "CostCenter": null, "Country": null, "CountryCode": null, "Currency": "SEK", "CustomerNumber": 115, "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "", "EmailInvoice": "", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Klara Norstr\u00f6m", "OrganisationNumber": "", "OurReference": "", "Phone1": null, "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "COMPANY", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": null } }
Using our .NET SDK
CustomerConnector connector = new CustomerConnector(); Customer result = connector.Create(new Customer() { Name = "Klara Norström" });
Update a customer
The updated customer will be returned if everything succeeded, if there was any problems an error will be returned.
You need to supply the unique customer number of the customer that you want to update.
Only the properties provided in the request body will be updated, properties not provided will left unchanged.
Examples
Request
curl -X "PUT" "https://api.fortnox.se/3/customers/115" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d $'{ "Customer":{ "Address1": "Hällesjö", "City": "Hultsfred", "ZipCode": "57737", "CountryCode": "SE" } }'
Response
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/115", "Active": true, "Address1": "H\u00e4llesj\u00f6", "Address2": null, "City": "Hultsfred", "Comments": null, "CostCenter": null, "Country": "Sverige", "CountryCode": "SE", "Currency": "SEK", "CustomerNumber": "115", "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "", "EmailInvoice": "", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "GLN": null, "GLNDelivery": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Klara Norstr\u00f6m", "OrganisationNumber": "", "OurReference": "", "Phone1": null, "Phone2": null, "PriceList": "A", "Project": "", "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "COMPANY", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": "57737" } }
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() { // Customer (PUT https://api.fortnox.se/3/customers/115) $client = new Client(); $request = $client->createRequest('PUT', 'https://api.fortnox.se/3/customers/115'); $postBody = $request->getBody(); try { $request->addHeaders([ 'Access-Token'=>'61cf63ae-4ab9-4a95-9db5-753781c4f41f', 'Client-Secret'=>'3Er4kHXZTJ', 'Content-Type'=>'application/json', 'Accept'=>'application/json', ]); $body = [ "Customer" => [ "Address1" => "Hällesjö", "City" => "Hultsfred", "CountryCode" => "SE", "ZipCode" => "57737" ] ]; $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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/115", "Address1": "H\u00e4llesj\u00f6", "Address2": null, "City": "Hultsfred", "Comments": null, "CostCenter": null, "Country": "Sverige", "CountryCode": "SE", "Currency": "SEK", "CustomerNumber": "115", "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "", "EmailInvoice": "", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Klara Norstr\u00f6m", "OrganisationNumber": "", "OurReference": "", "Phone1": null, "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "COMPANY", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": "57737" } }
Request
require 'net/http' require 'json' def send_request # Customer (PUT ) begin uri = URI('https://api.fortnox.se/3/customers/115') # Create client http = Net::HTTP.new(uri.host, uri.port) dict = { "Customer" => { "Address1" => "Hällesjö", "City" => "Hultsfred", "CountryCode" => "SE", "ZipCode" => "57737" } } body = JSON.dump(dict) # Create Request req = Net::HTTP::Put.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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/115", "Address1": "H\u00e4llesj\u00f6", "Address2": null, "City": "Hultsfred", "Comments": null, "CostCenter": null, "Country": "Sverige", "CountryCode": "SE", "Currency": "SEK", "CustomerNumber": "115", "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "", "EmailInvoice": "", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Klara Norstr\u00f6m", "OrganisationNumber": "", "OurReference": "", "Phone1": null, "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "COMPANY", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": "57737" } }
Request
# Install the Python Requests library: # `pip install requests` import requests import json def send_request(): # Customer (PUT https://api.fortnox.se/3/customers/115) try: r = requests.put( url="https://api.fortnox.se/3/customers/115", headers = { "Access-Token":"61cf63ae-4ab9-4a95-9db5-753781c4f41f", "Client-Secret":"3Er4kHXZTJ", "Content-Type":"application/json", "Accept":"application/json", }, data = json.dumps({ "Customer": { "Address1": "Hällesjö", "City": "Hultsfred", "CountryCode": "SE", "ZipCode": "57737" } }) ) 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
{ "Customer": { "@url": "https://api.fortnox.se/3/customers/115", "Address1": "H\u00e4llesj\u00f6", "Address2": null, "City": "Hultsfred", "Comments": null, "CostCenter": null, "Country": "Sverige", "CountryCode": "SE", "Currency": "SEK", "CustomerNumber": "115", "DefaultDeliveryTypes": { "Invoice": "PRINT", "Offer": "PRINT", "Order": "PRINT" }, "DefaultTemplates": { "CashInvoice": "DEFAULTTEMPLATE", "Invoice": "DEFAULTTEMPLATE", "Offer": "DEFAULTTEMPLATE", "Order": "DEFAULTTEMPLATE" }, "DeliveryAddress1": null, "DeliveryAddress2": null, "DeliveryCity": null, "DeliveryCountry": null, "DeliveryCountryCode": null, "DeliveryFax": null, "DeliveryName": null, "DeliveryPhone1": null, "DeliveryPhone2": null, "DeliveryZipCode": null, "Email": "", "EmailInvoice": "", "EmailInvoiceBCC": "", "EmailInvoiceCC": "", "EmailOffer": "", "EmailOfferBCC": "", "EmailOfferCC": "", "EmailOrder": "", "EmailOrderBCC": "", "EmailOrderCC": "", "Fax": null, "InvoiceAdministrationFee": null, "InvoiceDiscount": null, "InvoiceFreight": null, "InvoiceRemark": "", "Name": "Klara Norstr\u00f6m", "OrganisationNumber": "", "OurReference": "", "Phone1": null, "Phone2": null, "PriceList": "A", "Project": null, "SalesAccount": null, "ShowPriceVATIncluded": false, "TermsOfDelivery": "", "TermsOfPayment": "", "Type": "COMPANY", "VATNumber": "", "VATType": "SEVAT", "VisitingAddress": null, "VisitingCity": null, "VisitingCountry": null, "VisitingCountryCode": null, "VisitingZipCode": null, "WWW": "", "WayOfDelivery": "", "YourReference": "", "ZipCode": "57737" } }
Using our .NET SDK
CustomerConnector connector = new CustomerConnector(); Customer result = connector.Update(new Customer() { CustomerNumber = "115", Address1 = "Hällesjö", City = "Hultsfred", ZipCode = "57737", CountryCode = "SE" });
Delete a customer
Deletes the customer permanently. If everything succeeded the response will be of the type “204 – No content” and the response body will be empty. If there was any problems an error will be returned.
You need to supply the unique customer number of the customer that you want to delete.
Examples
Request
curl -X "DELETE" "https://api.fortnox.se/3/customers/115" \ -H "Access-Token: 61cf63ae-4ab9-4a95-9db5-753781c4f41f" \ -H "Client-Secret: 3Er4kHXZTJ" \ -H "Content-Type: application/json" \ -H "Accept: application/json"
Request
Using Guzzle
// Include Guzzle. If using Composer: // require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; function send_request() { // Customer (DELETE https://api.fortnox.se/3/customers/115) $client = new Client(); $request = $client->createRequest('DELETE', 'https://api.fortnox.se/3/customers/115'); 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(); } } }
Request
require 'net/http' def send_request # Customer (DELETE ) begin uri = URI('https://api.fortnox.se/3/customers/115') # Create client http = Net::HTTP.new(uri.host, uri.port) # Create Request req = Net::HTTP::Delete.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
Request
# Install the Python Requests library: # `pip install requests` import requests def send_request(): # Customer (DELETE https://api.fortnox.se/3/customers/115) try: r = requests.delete( url="https://api.fortnox.se/3/customers/115", 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')
Using our .NET SDK
CustomerConnector connector = new CustomerConnector(); connector.Delete("115");
Filter
Filter the search on active or inactive customers.
?filter=active displays only active customers
?filter=inactive displays only inactive customers
- Example: https://api.fortnox.se/3/customers?filter=active
Properties
Customer
Property | Description |
Url | string, read-only Direct URL to the record. |
Active | boolean, true/false If the customer is active or not |
Address1 | string, 1024 characters Address 1 of the customer. |
Address2 | string, 1024 characters Address 2 of the customer. |
City | string, 1024 characters, searchable City of the customer. |
Country | string, read-only Country name for the customer. |
Comments | string, 1024 characters Comments of the customer. |
Currency | string, 3 characters Code of the currency for the customer. This will be used as the predefined currency for documents for the customer. The code must be of an existing currency. |
CostCenter | string Code of the cost center for the customer. The code must be of a an existing currency. |
CountryCode | string, 2 characters Code of the country for the customer. The code must be of an existing country according to ISO 3166-1 Alpha-2. |
CustomerNumber | string, 1024 characters, searchable, sortable Customer number of the customer. If no customer number is provided, the next number in the series will be used. Only alpha numeric characters, with the addition of – + / and _, are allowed. |
DefaultDeliveryTypes | object The properties for this object is listed in the table for “Default Delivery Types”. |
DefaultTemplates | object The properties for this object is listed in the table for “Default Templates”. |
DeliveryAddress1 | string, 1024 characters Delivery address 1 for the customer. |
DeliveryAddress2 | string, 1024 characters DeliveryAddress 2 for the customer. |
DeliveryCity | string, 1024 characters Delivery city for the customer. |
DeliveryCountry | string, 1024 characters, read-only Delivery country for the customer. |
DeliveryCountryCode | string, 2 characters Code of the delivery country for the customer. The code must be of an existing country according to ISO 3166-1 Alpha-2. |
DeliveryFax | string, 1024 characters Delivery fax number of the customer. |
DeliveryName | string, 1024 characters Delivery name for the customer. |
DeliveryPhone1 | string, 1024 characters Delivery phone number 1 for the customer. |
DeliveryPhone2 | string, 1024 characters Delivery phone number 2 for the customer. |
DeliveryZipCode | string, 10 characters Delivery zip code for the customer. |
string, 1024 characters, searchable Email address for the customer. This must be a valid email address. |
|
EmailInvoice | string, 1024 characters Specific email address used for invoices sent to the customer. This must be a valid email address. |
EmailInvoiceBCC | string, 1024 characters Specific blind carbon copy email address used for invoices sent to the customer. This must be a valid email address. |
EmailInvoiceCC | string, 1024 characters Specific carbon copy email address used for invoices sent to the customer. This must be a valid email address. |
EmailOffer | string, 1024 characters Specific email address used for offers sent to the customer. This must be a valid email address. |
EmailOfferBCC | string, 1024 characters Specific blind carbon copy email address used for offers sent to the customer. This must be a valid email address. |
EmailOfferCC | string, 1024 characters Specific carbon copy email address used for offers sent to the customer. This must be a valid email address. |
EmailOrder | string, 1024 characters Specific email address used for orders sent to the customer. This must be a valid email address. |
EmailOrderBCC | string, 1024 characters Specific blind carbon copy email address used for orders sent to the customer. This must be a valid email address. |
EmailOrderCC | string, 1024 characters Specific carbon copy email address used for orders sent to the customer. This must be a valid email address. |
Fax | string, 1024 characters Fax number for the customer. |
GLN | string, 1024 characters, searchable Global Location Number of the customer |
GLNDelivery | string, 1024 characters, searchable Global Location Delivery Number |
InvoiceAdministrationFee | float, 11 digits Predefined invoice administration fee for the customer. |
InvoiceDiscount | float, 11 digits Predefined invoice discount for the customer. |
InvoiceFreight | float, 11 digits Predefined invoice freight fee for the customer. |
InvoiceRemark | string, 1024 characters Predefined invoice remark for the customer. |
Name | string, 1024 characters, searchable, sortable, required Name of the customer. |
OrganisationNumber | string, 30 characters, searchable Organisation number of the customer. It needs to be a valid organisation numer. |
OurReference | string, 50 characters Our reference of the customer. |
Phone1 | string, 1024 characters, searchable Phone number 1 of the customer. |
Phone2 | string, 1024 characters Phone number 2 of the customer. |
PriceList | string Code of the price list for the customer. The code must be of a an existing price list. |
Project | string Number of the project for the customer. The number must be of a an existing project. |
SalesAccount | string, 4 digits Predefined sales account of the customer. |
ShowPriceVATIncluded | boolean If prices should be displayed with VAT included. |
TermsOfDelivery | string Code of the terms of delivery for the customer. The code must be of a an existing terms of delivery. |
TermsOfPayment | string Code of the terms of payment for the customer. The code must be of a an existing terms of payment. |
Type | string Type of the customer. Can be PRIVATE or COMPANY. |
VATNumber | string VAT number for the customer. |
VATType | string VAT type of the customer. Can be SEVAT SEREVERSEDVAT EUREVERSEDVAT EUVAT or EXPORT. |
VisitingAddress | string, 128 characters Visiting address of the customer. |
VisitingCity | string, 128 characters Visiting city of the customer. |
VisitingCountry | string, read-only Visiting country of the customer. |
VisitingCountryCode | string, 2 characters Code of the visiting country for the customer. The code must be of an existing country according to ISO 3166-1 Alpha-2. |
VisitingZipCode | string, 10 characters Visiting zip code of the customer. |
WWW | string, 128 characters Website of the customer. |
WayOfDelivery | string Code of the way of delivery for the customer. The code must be of a an existing way of delivery. |
YourReference | string, 50 characters Your reference of the customer. |
ZipCode | string, 10 characters, searchable Zip code of the customers. |
Default Delivery Types
Property | Description |
Invoice | string Default delivery type for invoices. Can be PRINT EMAIL or PRINTSERVICE. |
Order | string Default delivery type for orders. Can be PRINT EMAIL or PRINTSERVICE. |
Offer | string Default delivery type for offers. Can be PRINT EMAIL or PRINTSERVICE. |
Default Templates
Property | Description |
Order | string Default template for orders. Must be a name of an existing print template. |
Offer | string Default template for offers. Must be a name of an existing print template. |
Invoice | string Default template for invoices. Must be a name of an existing print template. |
CashInvoice | string Default template for cash invoices. Must be a name of an existing print template. |