Goto APIs

Stocktake API

General:

Basics:

Base-URL: https://capi.lagerkoll.com/v1/stocktake/
Parameters in the url should all be encoded and all data sent should be UTF-8

MAX number of requests per minute is set to 200.
When the limit is hit an error with code 429 is returned, with the header "Retry-After" containing the number of seconds you have to wait for your next request.

Headers:

There are 2 ways to be authenticated when using this API. in both ways you add headers to the request.
1) Use an API-key together with store-id. This would be used when communicating machine to machine and no real person is involved. The API-key is available from where you activated the API. The store-id is also available in the same place.
2) Use a user_id and user_token together with a store-id. You get these values from the login-request. The values are connected to a person and are gained when an actual login to the system has been made.
store: <<STORE>>
user_id: <<USER_ID>>
user_token: <<USER_TOKEN>>
api_key: <<API_KEY>>
Accept: application/json
Content-Type: application/json

Errors:

Code Description
900001 Credentials don't match
900101 Common error
900429 Too many requests
902001 Error when getting stocktake
902011 Error when creating stocktake
902012 Error when updating stocktake
902002 Error when getting stocktake articles
902003 Error when registering inventory
{
  "errorCode" : 900101,
  "errorMessage" : "Something went wrong on the server",
  "errorField" : null,
  "errorData" : null
}

Stocktake API:

Stocktake

Get stocktakes

GETUrl: /state/{state}
Headers:
Accept: application/json or application/xml
Get a list of new, ongoing or finished stocktakes

Valid parameters:

Parameter Description Default value Allowed values
page 0
limit 25

Body:
Successfull response:

{"stocktakes": [{ "stockValue": 4790.693723478822, "itemsTotal": 7195, "stockValueFIFO": 9218.726186807471, "dueDate": 1711647019813, "annualAccount": true, "name": "name", "description": "description", "id": 3643, "state": "state", "accounts": [{}], "storeId": 5411, "itemsLeft": 8944 }]}

Get stocktake

GETUrl: /{id}
Headers:
Accept: application/json or application/xml
Get a single stocktake
Body:
Successfull response:

{"stocktakes": [{ "stockValue": 1879.5899445131258, "itemsTotal": 4320, "stockValueFIFO": 2520.8255434265925, "dueDate": 1711647019813, "annualAccount": true, "name": "name", "description": "description", "id": 9080, "state": "state", "accounts": [{}], "storeId": 199, "itemsLeft": 7479 }]}

Get finished stocktake

GETUrl: /finished/{finished_list_id}
Headers:
Accept: application/json or application/xml
Get a single finished stocktake
Body:
Successfull response:

{"stocktakes": [{ "stockValue": 7959.896142570565, "itemsTotal": 3814, "stockValueFIFO": 654.5262090835502, "dueDate": 1711647019814, "annualAccount": false, "name": "name", "description": "description", "id": 4944, "state": "state", "accounts": [{}], "storeId": 578, "itemsLeft": 291 }]}

Print stocktake receipt

GETUrl: /finished/{finished_list_id}/receipt/print
Headers:
Accept: application/json
Print stocktake receipt to PDF and emails it to requesting user
Body:
Successfull response:

Print stocktake

GETUrl: /{id}/print
Headers:
Accept: application/pdf or application/json
Print stocktake to PDF. If stocktake contains more than 1000 articles the result be sent by email when done. If no email is provided in the request, the mail is sent to logged in user

Valid parameters:

Parameter Description Default value Allowed values
order asc asc,desc
sort_column art art,name,bundled,cat,unit,stock_place,stock_place_article,desc,price,order,warning_order,stock,reserved,supplier,is_stock,type,status,active
email

Body:
Successfull response:

Create stocktake

POSTUrl:
Headers:
Accept: application/json or application/xml
Create a new inventory list
Body:

{ "dueDate": 1711647019814, "annualAccount": true, "name": "name", "description": "description" }
Successfull response:

{"stocktakes": [{ "stockValue": 7948.912839803676, "itemsTotal": 5580, "stockValueFIFO": 2172.2300795104366, "dueDate": 1711647019815, "annualAccount": true, "name": "name", "description": "description", "id": 6396, "state": "state", "accounts": [{}], "storeId": 1341, "itemsLeft": 4498 }]}

Copy stocktake

POSTUrl: /{id}/copy
Headers:
Accept: application/json or application/xml
Copy a specific inventory list and set state to NEW
Body:
Successfull response:

{"stocktakes": [{ "stockValue": 1852.8677407840833, "itemsTotal": 7266, "stockValueFIFO": 7838.235867778239, "dueDate": 1711647019815, "annualAccount": false, "name": "name", "description": "description", "id": 5387, "state": "state", "accounts": [{}], "storeId": 8948, "itemsLeft": 7034 }]}

Copy finished stocktake

POSTUrl: /finished/{finished_list_id}/copy
Headers:
Accept: application/json or application/xml
Copy a specific finished inventory list and set state to NEW
Body:
Successfull response:

{"stocktakes": [{ "stockValue": 7802.492840857165, "itemsTotal": 352, "stockValueFIFO": 1173.3153263814422, "dueDate": 1711647019815, "annualAccount": false, "name": "name", "description": "description", "id": 4401, "state": "state", "accounts": [{}], "storeId": 3744, "itemsLeft": 9023 }]}

Update stocktake

PUTUrl: /{id}
Headers:
Accept: application/json or application/xml
Update an existing inventory list
Body:

{ "stockValue": 3808.4414276786783, "itemsTotal": 7313, "stockValueFIFO": 9949.043343575871, "dueDate": 1711647019815, "annualAccount": false, "name": "name", "description": "description", "id": 2598, "state": "state", "accounts": [{}], "storeId": 3274, "itemsLeft": 8906 }
Successfull response:

{"stocktakes": [{ "stockValue": 4555.57176497863, "itemsTotal": 7481, "stockValueFIFO": 3329.884457277561, "dueDate": 1711647019815, "annualAccount": true, "name": "name", "description": "description", "id": 3008, "state": "state", "accounts": [{}], "storeId": 6947, "itemsLeft": 9964 }]}

Start stocktake

PUTUrl: /{id}/start
Headers:
Accept: application/json or application/xml
Start a specific inventory list
Body:
Successfull response:

Finish stocktake

PUTUrl: /{id}/finish
Headers:
Accept: application/json or application/xml
Finish a specific inventory list

Valid parameters:

Parameter Description Default value Allowed values
zero_unhandled_articles false

Body:
Successfull response:

Reopen stocktake

PUTUrl: /finished/{finished_list_id}/reopen
Headers:
Accept: application/json or application/xml
Reopen a finished inventory list
Body:
Successfull response:

{"stocktakes": [{ "stockValue": 2110.3323821448985, "itemsTotal": 7362, "stockValueFIFO": 3299.8573201588956, "dueDate": 1711647019816, "annualAccount": true, "name": "name", "description": "description", "id": 5803, "state": "state", "accounts": [{}], "storeId": 6416, "itemsLeft": 230 }]}

Remove stocktake

DELETEUrl: /{id}
Headers:
Accept: application/json or application/xml
Remove a single stocktake
Body:
Successfull response:

Remove finished stocktake

DELETEUrl: /finished/{finished_list_id}
Headers:
Accept: application/json or application/xml
Remove a single finished stocktake
Body:
Successfull response:

Stocktake articles

Get finished stocktake articles

GETUrl: /finished/{id}/articles
Headers:
Accept: application/json or application/xml
Get articles for a finished stocktake

Valid parameters:

Parameter Description Default value Allowed values
query Search for barcode and article name
page 0
limit 25
order asc asc,desc
sort_column art art,name,bundled,cat,unit,stock_place,stock_place_article,desc,price,order,warning_order,stock,reserved,supplier,is_stock,type,status,active

Body:
Successfull response:

{ "pages": 1712, "pageSize": 5253, "page": 576, "articlesCount": 1830, "articles": [{ "isBundled": true, "inventoryAmount": 1484.9480144583981, "serialNr": "serialNr", "amount": 7239.649971819997, "inventoried": true, "barcodeType": "barcodeType", "articleId": "articleId", "active": true, "description": "description", "fifos": [{ "date": 1711647019818, "supplierName": "supplierName", "amount": 6493.706633666737, "supplierOrderId": 144, "supplierId": 2164, "poRef": "poRef", "description": "description", "purchasePrice": 2797.745351339045, "userName": "userName", "userId": 3348, "amountInStock": 3710.9023389387585, "purchaseRate": 1534.549389707587, "id": 4784 }], "stockPlace": "stockPlace", "batchId": "batchId", "type": 5390, "unit": { "name": "name", "externalId": "externalId", "id": 8267 }, "reserved": 769.0300886011992, "name": "name", "barcode": "barcode", "group": { "name": "name", "id": 4386, "articles": 6007 }, "isStock": false, "stockWarning": 5916.115295267198 }], "since": 3828 }

Get stocktake articles

GETUrl: /{id}/articles
Headers:
Accept: application/json or application/xml
Get articles for a specific stocktake

Valid parameters:

Parameter Description Default value Allowed values
query Search for barcode and article name
page 0
limit 25
order asc asc,desc
sort_column art art,name,bundled,cat,unit,stock_place,stock_place_article,desc,price,order,warning_order,stock,reserved,supplier,is_stock,type,status,active

Body:
Successfull response:

{ "pages": 1018, "pageSize": 6733, "page": 5111, "articlesCount": 1014, "articles": [{ "isBundled": false, "inventoryAmount": 5908.6264112361605, "serialNr": "serialNr", "amount": 4121.703200361274, "inventoried": true, "barcodeType": "barcodeType", "articleId": "articleId", "active": false, "description": "description", "fifos": [{ "date": 1711647019819, "supplierName": "supplierName", "amount": 240.0854949878939, "supplierOrderId": 1167, "supplierId": 2079, "poRef": "poRef", "description": "description", "purchasePrice": 5377.915773025501, "userName": "userName", "userId": 3901, "amountInStock": 9208.84261365949, "purchaseRate": 3448.8054827647297, "id": 1169 }], "stockPlace": "stockPlace", "batchId": "batchId", "type": 9706, "unit": { "name": "name", "externalId": "externalId", "id": 6190 }, "reserved": 418.68028978160663, "name": "name", "barcode": "barcode", "group": { "name": "name", "id": 542, "articles": 8939 }, "isStock": true, "stockWarning": 2842.8964008276293 }], "since": 451 }

Search articles

GETUrl: /{id}/articles/search
Headers:
Accept: application/json or application/xml
Search article in stock and get flag to show if the article is already part of the stocktake

Valid parameters:

Parameter Description Default value Allowed values
query Search for barcode and article name
supplier_id
page 0
limit 25
order asc asc,desc
sort_column art art,name,bundled,cat,unit,stock_place,stock_place_article,desc,price,order,warning_order,stock,reserved,supplier,is_stock,type,status,active

Body:
Successfull response:

{ "pages": 79, "pageSize": 72, "page": 7631, "articlesCount": 9541, "articles": [{ "amount": 7702.655604267658, "bundled": false, "barcodeType": "barcodeType", "articleId": "articleId", "active": true, "description": "description", "stockPlace": "stockPlace", "type": 8574, "unit": { "name": "name", "externalId": "externalId", "id": 9467 }, "reserved": 1097.619151797925, "name": "name", "includedInStocktake": false, "barcode": "barcode", "group": { "name": "name", "id": 1251, "articles": 2747 }, "isStock": true, "stockWarning": 2183.8827242818484 }], "since": 6924 }

Get stocktake article

GETUrl: /{id}/articles/{article_id : .+}
Headers:
Accept: application/json or application/xml
Get a specific article from a stocktake

Valid parameters:

Parameter Description Default value Allowed values
batch_id
serial_nr

Body:
Successfull response:

{ "isBundled": true, "inventoryAmount": 1779.9499241983885, "serialNr": "serialNr", "amount": 3250.1173107500913, "inventoried": false, "barcodeType": "barcodeType", "articleId": "articleId", "active": false, "description": "description", "fifos": [{ "date": 1711647019823, "supplierName": "supplierName", "amount": 643.7706577001223, "supplierOrderId": 3878, "supplierId": 3025, "poRef": "poRef", "description": "description", "purchasePrice": 6984.391972976194, "userName": "userName", "userId": 728, "amountInStock": 7182.986251313684, "purchaseRate": 8266.25089590002, "id": 6966 }], "stockPlace": "stockPlace", "batchId": "batchId", "type": 3569, "unit": { "name": "name", "externalId": "externalId", "id": 2326 }, "reserved": 4763.275110054401, "name": "name", "barcode": "barcode", "group": { "name": "name", "id": 2722, "articles": 1974 }, "isStock": true, "stockWarning": 7265.063468059332 }

Add articles

POSTUrl: /{id}/articles
Headers:
Accept: application/json or application/xml
Add new articles to an existing stocktake. The stocktake must be in state NEW
Body:

{"articles": [{}]}
Successfull response:

Add stockplace articles

POSTUrl: /{id}/stockplace/{stockplace : .+}
Headers:
Accept: application/json or application/xml
Add articles from a stockplace to an existing stocktake. The stocktake must be in state NEW
Body:
Successfull response:

Add all articles

POSTUrl: /{id}/articles/all
Headers:
Accept: application/json or application/xml
Add all articles from store to an existing stocktake. The stocktake must be in state NEW
Body:
Successfull response:

Inventory an article

PUTUrl: /{id}/articles
Headers:
Accept: application/json or application/xml
Report inventory of an article for a specific stocktake
Body:

{ "addedAmount": 4565.001026521261, "serialNr": "serialNr", "articleId": "articleId", "batchId": "batchId", "addToExisting": "true" }
Successfull response:

Remove article

DELETEUrl: /{id}/articles/{articleId : .+}
Headers:
Accept: application/json or application/xml
Remove article from an existing stocktake. The stocktake must be in state NEW
Body:
Successfull response:

Remove stockplace articles

DELETEUrl: /{id}/stockplace/{stockplace : .+}
Headers:
Accept: application/json or application/xml
Remove articles from a stockplace in an existing stocktake. The stocktake must be in state NEW

Valid parameters:

Parameter Description Default value Allowed values
stockplace

Body:
Successfull response:

Classes:

ArticleIds

Field Type Description Default Mandatory Accepted values Example values Access
articles List List of article ids R,W

Category

Field Type Description Default Mandatory Accepted values Example values Access
id long R
name String Name of category R,W
articles Integer Number of articles that include this category R

FIFO

Field Type Description Default Mandatory Accepted values Example values Access
id long R
date Date R
amount double R
amountInStock double R
supplierId long R
supplierName String R
purchasePrice double R
purchaseRate double R
supplierOrderId long R
poRef String R
description String R
userId long R
userName String R

Stocktake

Field Type Description Default Mandatory Accepted values Example values Access
id Long Id of stocktake list R
name String Name of stocktake list R,W
storeId long R
description String Description of stocktake list R,W
dueDate Date Date when stocktake should be finished R,W
itemsTotal int Number of products included in the stock take list R
itemsLeft int Number of products left to check in the stocktake list R
annualAccount Boolean Flag to indicate if this is a annual stocktake. If flag is set to true when creating a stocktake, all articles in the store are added automatically to the list R,W
state String NEW,ONGOING,FINISHED R
stockValueFIFO Double Value only available for finished stocktakes R
stockValue Double Value only available for finished stocktakes R
accounts List Value only available for finished stocktakes R

StocktakeArticle

Field Type Description Default Mandatory Accepted values Example values Access
articleId String R
batchId String R
serialNr String R
active boolean R
isBundled boolean R
name String R
description String R
group Category R
unit Unit R
amount double R
reserved double R
barcode String R
barcodeType String R
inventoryAmount double R
inventoried boolean R
type int R
isStock boolean R
stockPlace String R
stockWarning double R
fifos List FIFO is only available for finished stocktakes R

StocktakeArticleRequest

Field Type Description Default Mandatory Accepted values Example values Access
articleId String R,W
batchId String R,W
serialNr String R,W
addedAmount double Inventoried amount. Use addToExisting-flag to control how the value is set R,W
addToExisting Boolean If flag is set to true the inventoried value is added to already inventoried value. If flag is false the inventoried value is set true R,W

StocktakeArticlesResponse

Field Type Description Default Mandatory Accepted values Example values Access
page int R
pages int R
pageSize int R
articlesCount int R
since long R
articles List R

StocktakeSearchArticleResponse

Field Type Description Default Mandatory Accepted values Example values Access
articleId String R
active boolean R
bundled boolean R
name String R
description String R
group Category R
unit Unit R
amount double R
reserved double R
barcode String R
barcodeType String R
type int R
isStock boolean R
stockPlace String R
stockWarning double R
includedInStocktake boolean Flag to indicate if article is included in stocktake list used in request R

StocktakeSearchArticlesResponse

Field Type Description Default Mandatory Accepted values Example values Access
page int R
pages int R
pageSize int R
articlesCount int R
since long R
articles List R

StocktakesResponse

Field Type Description Default Mandatory Accepted values Example values Access
stocktakes List R

Unit

Field Type Description Default Mandatory Accepted values Example values Access
id Long R,W
externalId String R
name String Name of unit R,W