API Documentation

Suffix to alla paths are: /api

Authentication

Token for API is created in the page "Inställningar > Tillägg". This permanent token can be used to create an access token by a call to /auth with header attribute with the name "token" and the token as value. An access token will be returned and should used in call to the other API endpoints. The access token should be supplied in an header attribute named "Authorization" using the syntax "Bearer <access token>".

PaXML

Tidtransaktioner

/tidtransaktioner/<token> [POST] - Postar XML enligt PaXML i request body

Löntransaktioner

/lontransaktioner/<token> [POST] - Postar XML enligt PaXML i request body

Native API



Checksum is a HMAC encoded hash produced by your orgid using sha256 algorithm and a key provided by us.

Organization

/organization [GET] - Returns an array of organizations

/organization/<orgid> [GET] - Returns single organization

/organization [POST] - Add new organization

/organization/<orgid> [POST] - Updates existing organization

{ 
                        "orgid": "22",
                        "name": "Testföretag", 
                        "orgno": "5523455678",
                        "address": "Storgatan 1",
                        "zipcode": "12345", 
                        "bank_account": "170125121233",
                        "promikbook" : {
                            "api_key": "ABCDEFG",
                            "username": "username",
                            "password": "password"
                        }
                    }

User

/user/<personid> [GET] - Returns single user

/organization/<orgid>/users [GET] - Returns an array of users in given organization

/user [POST] - Add new user

/user/<personid> [POST] - Updates existing user

{ 
                        "personid": "23",    
                        "email": "test@gmail.com",
                        "firstname": "Kalle",
                        "surname": "Anka",
                        "password": "abc123",
                        "orgids": ["22","146"]  
                    }

Employee

/employee/<orgid>/<empid> [GET] - Returns single employee

/employees/<orgid> [GET] - Returns an array of employees in given organization

/employee/<orgid> [POST] - Add new employee

/employee/<orgid>/<empid> [POST] - Updates existing employee

{ 
                        "empid" : "23",
                        "firstname": "Kalle",
                        "lastname": "Anka",
                        "postaddress": "Storgatan 1",
                        "postalcode": "12345",
                        "email": "test@gmail.com",
                        "clearingno": "1701",
                        "account": "123456789",
                        "period": "30",
                        "salary": "25000",
                        "taxtable": "32",
                        "taxexemption": { "percentage": "20", "amount": "1000" }
                    }

Transaction

/transaction/<token> [POST] - Adds (array of) payroll transactions

{ 
    "transid": "1",
    "empid": "23",    
    "payrollcode": "1132",
    "datefrom": "2015-06-16",
    "dateto": "2015-06-16",
    "counts": "5",
    "unitprice": "23",
    "vat" : "5",
    "extent" : "100",
    "note" : "sample text",
    "attachment_extension" : "pdf",
    "attachment" : "content",
    "childId" : "34",
    "dimensions": [{"dimid":1, "value":"8780"}, {"dimid":2, "value":"NIS"}]
}

Returns array of transaction ids

Sales transaction

/sales/<token> [POST] - Adds (array of) sales transactions

{ 
    "empid": "23",    
    "transid": "123",
    "payrollcode": "14212",
    "timestamp": "2019-09-05 10:07:30",
    "amount": "519.40"
}

Payslip rows

/row/<orgid>/<empid> [GET] - Returns (array of) payslip rows for given organization and employee

{ 
    "rowid": 3,
    "payrollcode": "1132",
    "datefrom": "2015-06-16",
    "dateto": "2015-06-16",
    "counts": "5",
    "unitprice": "23",
    "extent": "100",
    "transid": 2
}

Accounting

/accounting/<orgid> [POST] - Updates (array of) accounting for payslip rows

[
    { 
        "empid": 23,
        "transid": 3,
        "dimensions": [
        	{"dimid": "1", "value":"8780"},
        	{"dimid": "2", "value":"XA"}
        ],
        "percent": "50"
    },
    { 
        "empid": 23,
        "transid": 3,
        "dimensions": [
        	{"dimid": "1", "value":"8780"},
        	{"dimid": "2", "value":"XA"}
        ],
        "percent": "50"
    }
]

Period

/period/<orgid>/<periodid> [GET] - Returns information about a period

/period/<orgid> [POST] - Adds new period

{ 
    "from": "2016-01-01",    
    "to": "2016-01-31",
    "paydate": "2016-01-25",
    "confirmed": true
}

Arbetsgivardeklaration

/arbetsgivardeklaration/<orgid>/<periodid> [GET] - Returns arbetsgivardeklaration for given organization and period

{ 
    "ruta50" : "100000",
    "ruta51" : "20000",
    "ruta55" : "60000",
    "ruta56" : "18852",
    "ruta57" : "0",
    "ruta58" : "0",
    "ruta59" : "60000",
    "ruta60" : "9600",
    "ruta61" : "0",
    "ruta62" : "0",
    "ruta78" : "28452",
    "ruta81" : "0",
    "ruta82" : "120000",
    "ruta82" : "30000"
}

Payments

/payments/<orgid>/<periodid> [GET] - Returns payments for given organization and period

[
    {"empid": 23, "bank_account": "1234566", "amount": "25000" },
    {"empid": 24, "bank_account": "1234567", , "amount": "26000" }
]

Verifications

/verifications/<orgid>/<periodid> [GET] - Returns verifications for given organization and period

[
       	{
        	 "date": "2016-01-25", 
        	 "text": "Löneutbetalning",
        	 "parts" : [ 
        	             { "account" : "1930", "amount": -25000 },
        	             { "account" : "7210", "amount": 20000 },
        	             { "account" : "2710, "amount": 5000 }
        	           ]
        },
       	{
        	 "date": "2016-02-12", 
        	 "text": "Skattinbetalning",
        	 "parts" : [ 
        	             { "account" : "1930", "amount": -5000 },
        	             { "account" : "2710", "amount": 5000 }
        	           ]
        }
]

Dimension

/dimension/<orgid> [GET] - Returns accounting dimensions

[
	{ 
    	"dimid": "1",    
    	"name": "Kostnadsställe"
  	},
	{ 
    	"dimid": "2",    
    	"name": "Projekt"
  	}
]

Schedule

/schedule/<orgid> [POST] - Adds (array of) worktime shifts

{ 
   	"empid": "23",    
   	"date":"2016-07-02",
   	"starttime": "2016-07-02 08:00",
   	"endtime":"2016-07-02 17:00",
   	"breaks": [{"starttime":"2016-07-02 12:00", "length":"60"}]
}

Lönearter

/lonearter/<orgid> [GET] - Returns (array of) wage types

[
    {
        "loneart": "1001",
        "beskrivning": "Månadslön",
        "kalender": "0",
        "antalstyp": "3",
        "manadsavlonade" : "1",
        "timavlonade" : "0"
    },
    {
        "loneart": "1002",
        "beskrivning": "Årslön",
        "kalender": "0",
        "antalstyp": "4",
        "manadsavlonade" : "1",
        "timavlonade" : "0"
    }
]

Vacation

/vacation/<orgid>/<empid> [GET] - Returns vacation leave amount

    {
        "amount": 10
    }

Compensation Balance

/compensation_balance/<orgid>/<empid> [GET] - Returns compensation balance

    {
        "amountMinutes": 180, 
        "amountHours": 3
    }

Dimension Values

/dimension_values/<orgid>/<dimid> [GET] - Returns (array of) projects

    [
        {
            'value': 'A', 
            'description': 'Annual project'
        }, 
        {
            'value': 'B', 
            'description': 'Monthly project'
        }
    ]

Payslips

/payslips/<orgid>/<empid> [GET] - Returns (array of) available payslips

    [
        {
            "text":"Augusti  2022",
            "id":"34"
        },
        {
            "text":"Juli  2022",
            "id":"33"
        },
        {
            "text":"Juni  2022",
            "id":"32"
        }
    ]

Payslip

/payslip/<orgid>/<empid>/<korningid> [GET] - Returns a payslip pdf as a base64 encoded string

    {
        'content': 'JVBERi0xLj...'
    }

Expense Types

/expense_types/<orgid>/<empid/<languageCode> [GET] - Returns a company's available expense types for selfreporting

    [
        {
            'payrollcode': '9115', 
            'variant': '3', 
            'description': 'Drivmedel'
        }, 
        {
            'payrollcode': '9115', 
            'variant': '4', 
            'description': 'Hotell'
        }, 
        {
            'payrollcode': '9115', 
            'variant': '14', 
            'description': 'Momsfritt'
        }
    ]

Children

/children/<empid> [GET] - Returns an employees registered children

    [
        {
            'firstname': 'John', 
            'surname' : 'Doe'
            'ssn' : "200101010000" 
            'childId': '33'
        }, 
        {
            'firstname': 'Joan', 
            'surname' : 'Doe'
            'ssn' : "200202020101" 
            'childId': '34'
        }
    ]

Error handling

In case of error all services will return an error structure according to the pattern below.

			{
			    "errno": "1001"
			    "errstr": "Invalid zipcode"
			}