API

Introduktion

Det här dokumentet beskriver hur du använder vårt REST API för att integrera med vårt system. API ger åtkomst till funktionalitet såsom att skapa försäljningsorder. API:et utvecklas kontinuerligt och fler resurser läggs in.

Autentisering och auktorisering

För att använda API behöver du autentisera dig med en giltig API-nyckel. Autentisering sker genom OAuth 2.0, och varje anrop kräver en Bearer Token i Authorization-huvudet.

Din klient behöver registreras i GKS4 vilket är något Simutek hjälper till med. Därefter får du ett client_id och en client_secret som används för att erhålla en åtkomsttoken.

Exempel på hämtning av åtkomsttoken

Ett exempel hur access token kan hämtas med curl.


curl 'https://id.simutek.se/connect/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'client_id=your_client_id' \
  --data-urlencode 'client_secret=your_client_secret' \
  --data-urlencode 'grant_type=client_credentials'

Headers

Om inte annat angivet kräver varje anrop åtminstone följande headers:

Key
Value
Description

Authorization

Bearer eyJ...

Byt ut värdet eyJ... med din access token.

Content-Type

application/json

Dokumentation

Creates a customer

post
Authorizations
Body
namestringRequired
numberstring | nullableRequired
invoiceEmailstring | nullableRequired
corporateIdentityNumberstringRequired
Responses
200
Success. The customer was created.
post
POST /api/v1/customers HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 245

{
  "name": "text",
  "number": "text",
  "invoiceEmail": "text",
  "postalAddress": {
    "address1": "Storgatan 1",
    "address2": "Garageinfart 2",
    "address3": "text",
    "city": "Stockholm",
    "zipCode": "114 44",
    "state": "FL",
    "countryCode": "SE"
  },
  "corporateIdentityNumber": "text"
}

No content

Gets a customer by customer number.

get
Authorizations
Path parameters
customerNumberstringRequired

The customer number.

Responses
200
Success. The approval status was received.
application/json
get
GET /api/v1/customers/{customerNumber} HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
  "name": "text",
  "number": "text",
  "invoiceEmail": "text",
  "postalAddress": {
    "address1": "Storgatan 1",
    "address2": "Garageinfart 2",
    "address3": "text",
    "city": "Stockholm",
    "zipCode": "114 44",
    "state": "FL",
    "countryCode": "SE"
  },
  "corporateIdentityNumber": "text"
}

Places a sales order.

post
Authorizations
Body
customerNumberstring · min: 1Required

The customer number in GKS of the buyer. A company with this customer number must exist in GKS.

Example: K100421
billingCompanyInfoany of | nullableRequired
nullOptional
or
billToany of | nullableRequired
nullOptional
or
shipToany of | nullableRequired
nullOptional
or
orderTitlestring | nullableRequired

Optional name of the sales order that will be useful when searching for the order.

promisedDeliveryDatestring · date-time | nullableRequired
orderedstring · date-time | nullableRequired

Obsolete. We do not see a business need to change the date of purchase. It should always be the same date as the order request is received.

purchaseOrderNumberstringRequired

An optional purchase order number from the buyer. In PlaceSimpleOrder API, "CustOrderNo".

isExportbooleanRequired
isExportWithinEubooleanRequired
languageCodestring | nullableRequired

The preferred language (ISO 639-1) of documents communicated with the buyer, i.e. order confirmation. Accepted values: sv, no, en

currencyCodestring | nullableRequired

The currency of the amounts in this sales order. ISO 4217.

Example: SEK
noteFromCustomerstring | nullableRequired

A comment added by the customer during placement of the order. Commonly with instructions to the seller.

hasAllotmentsbooleanRead-onlyRequired
Responses
200
Success. The sales order was created.
application/json
post
POST /api/v1/salesorders HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 1009

{
  "customerNumber": "K100421",
  "billingContact": {
    "firstName": "text",
    "lastName": "text",
    "email": "text",
    "phone": "text",
    "phoneMobile": "text",
    "eInvoiceCode": "text"
  },
  "billingCompanyInfo": null,
  "billTo": null,
  "shipTo": null,
  "orderTitle": "text",
  "promisedDeliveryDate": "2025-07-04T23:22:42.354Z",
  "ordered": "2025-07-04T23:22:42.354Z",
  "purchaseOrderNumber": "text",
  "isExport": true,
  "isExportWithinEu": true,
  "languageCode": "text",
  "currencyCode": "SEK",
  "noteFromCustomer": "text",
  "salesOrderlines": [
    {
      "articleNumber": "text",
      "description": "text",
      "quantity": 1,
      "salesUnit": "text",
      "unitPrice": 1,
      "vatPercent": 1,
      "discountPercent": 1,
      "costWork": 1,
      "costMaterial": 1,
      "costSubcontractWork": 1,
      "profitCenterCode": "14",
      "weightPerUnit": 1,
      "shipOrderline": true,
      "allotments": [
        {
          "qtyToShip": 1,
          "shipTo": {
            "recipientName": "text",
            "address": {
              "address1": "Storgatan 1",
              "address2": "Garageinfart 2",
              "address3": "text",
              "city": "Stockholm",
              "zipCode": "114 44",
              "state": "FL",
              "countryCode": "SE"
            },
            "contactName": "text",
            "contactMobilePhone": "text",
            "contactEmail": "text"
          }
        }
      ]
    }
  ]
}
{
  "orderNumber": 1
}

Last updated