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.
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.
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": 8151.83967071439, "itemsTotal": 1836, "stockValueFIFO": 1169.3027448354599, "dueDate": 1732183464074, "annualAccount": false, "name": "name", "description": "description", "id": 6546, "state": "state", "accounts": [{}], "storeId": 2552, "itemsLeft": 7640 }]}
Get stocktake
GETUrl: /{id}
Headers:
Accept: application/json or application/xml
Get a single stocktake
Body:
Successfull response:
{"stocktakes": [{ "stockValue": 3662.239378151859, "itemsTotal": 3576, "stockValueFIFO": 790.1133643436619, "dueDate": 1732183464075, "annualAccount": false, "name": "name", "description": "description", "id": 6098, "state": "state", "accounts": [{}], "storeId": 3418, "itemsLeft": 323 }]}
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": 5574.6479330982165, "itemsTotal": 5680, "stockValueFIFO": 4944.899379385815, "dueDate": 1732183464076, "annualAccount": false, "name": "name", "description": "description", "id": 8554, "state": "state", "accounts": [{}], "storeId": 9322, "itemsLeft": 3945 }]}
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 | |
Create stocktake
POSTUrl:
Headers:
Accept: application/json or application/xml
Create a new inventory list
Body:
{ "dueDate": 1732183464076, "annualAccount": false, "name": "name", "description": "description" }
Successfull response:
{"stocktakes": [{ "stockValue": 794.5435379366206, "itemsTotal": 7260, "stockValueFIFO": 1565.0530045970268, "dueDate": 1732183464076, "annualAccount": false, "name": "name", "description": "description", "id": 876, "state": "state", "accounts": [{}], "storeId": 6731, "itemsLeft": 8760 }]}
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": 7278.61567167877, "itemsTotal": 8631, "stockValueFIFO": 6242.373178765894, "dueDate": 1732183464076, "annualAccount": true, "name": "name", "description": "description", "id": 8166, "state": "state", "accounts": [{}], "storeId": 4703, "itemsLeft": 3950 }]}
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": 9673.530215070074, "itemsTotal": 6996, "stockValueFIFO": 1130.0508831519862, "dueDate": 1732183464077, "annualAccount": false, "name": "name", "description": "description", "id": 6972, "state": "state", "accounts": [{}], "storeId": 3003, "itemsLeft": 4236 }]}
Update stocktake
PUTUrl: /{id}
Headers:
Accept: application/json or application/xml
Update an existing inventory list
Body:
{ "stockValue": 5059.651811681457, "itemsTotal": 6035, "stockValueFIFO": 6738.200128067106, "dueDate": 1732183464077, "annualAccount": true, "name": "name", "description": "description", "id": 6996, "state": "state", "accounts": [{}], "storeId": 7078, "itemsLeft": 6971 }
Successfull response:
{"stocktakes": [{ "stockValue": 6136.509854563425, "itemsTotal": 4745, "stockValueFIFO": 8028.105561819929, "dueDate": 1732183464077, "annualAccount": false, "name": "name", "description": "description", "id": 2349, "state": "state", "accounts": [{}], "storeId": 634, "itemsLeft": 944 }]}
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": 3344.2833131961056, "itemsTotal": 5753, "stockValueFIFO": 9213.953089722709, "dueDate": 1732183464078, "annualAccount": false, "name": "name", "description": "description", "id": 335, "state": "state", "accounts": [{}], "storeId": 5284, "itemsLeft": 7351 }]}
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": 7323, "pageSize": 2622, "page": 1664, "articlesCount": 2791, "articles": [{ "isBundled": true, "inventoryAmount": 4733.563649866511, "serialNr": "serialNr", "amount": 9478.02322555226, "inventoried": false, "barcodeType": "barcodeType", "articleId": "articleId", "active": false, "description": "description", "fifos": [{ "date": 1732183464079, "supplierName": "supplierName", "amount": 7986.3303254516795, "supplierOrderId": 7902, "supplierId": 6516, "poRef": "poRef", "description": "description", "purchasePrice": 303.11677143071256, "userName": "userName", "userId": 5732, "amountInStock": 2419.3760741021706, "purchaseRate": 1637.85425585797, "id": 4350 }], "stockPlace": "stockPlace", "batchId": "batchId", "type": 1830, "unit": { "name": "name", "externalId": "externalId", "id": 5142 }, "reserved": 8092.754316267471, "name": "name", "barcode": "barcode", "group": { "name": "name", "id": 8391, "articles": 95 }, "isStock": true, "stockWarning": 7379.998396105256 }], "since": 6973 }
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,stock,stock_place,desc,inventoried |
Body:
Successfull response:
{ "pages": 3963, "pageSize": 5144, "page": 972, "articlesCount": 604, "articles": [{ "isBundled": false, "inventoryAmount": 1812.628103762105, "serialNr": "serialNr", "amount": 6824.002948172423, "inventoried": false, "barcodeType": "barcodeType", "articleId": "articleId", "active": false, "description": "description", "fifos": [{ "date": 1732183464083, "supplierName": "supplierName", "amount": 5341.293623699914, "supplierOrderId": 16, "supplierId": 4317, "poRef": "poRef", "description": "description", "purchasePrice": 5758.2115624793705, "userName": "userName", "userId": 6525, "amountInStock": 6382.14034198202, "purchaseRate": 4222.077365036463, "id": 5661 }], "stockPlace": "stockPlace", "batchId": "batchId", "type": 7736, "unit": { "name": "name", "externalId": "externalId", "id": 9040 }, "reserved": 201.13000971638817, "name": "name", "barcode": "barcode", "group": { "name": "name", "id": 2546, "articles": 1431 }, "isStock": false, "stockWarning": 452.8322775644089 }], "since": 8421 }
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": 3317, "pageSize": 9455, "page": 4837, "articlesCount": 9095, "articles": [{ "amount": 9259.982540282372, "bundled": false, "barcodeType": "barcodeType", "articleId": "articleId", "active": false, "description": "description", "stockPlace": "stockPlace", "type": 2709, "unit": { "name": "name", "externalId": "externalId", "id": 6985 }, "reserved": 2565.7293951313754, "name": "name", "includedInStocktake": true, "barcode": "barcode", "group": { "name": "name", "id": 1969, "articles": 9015 }, "isStock": false, "stockWarning": 1206.2920771288877 }], "since": 5691 }
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": 1236.2327628739522, "serialNr": "serialNr", "amount": 8066.632061524179, "inventoried": false, "barcodeType": "barcodeType", "articleId": "articleId", "active": false, "description": "description", "fifos": [{ "date": 1732183464087, "supplierName": "supplierName", "amount": 4452.033946975012, "supplierOrderId": 7320, "supplierId": 3062, "poRef": "poRef", "description": "description", "purchasePrice": 18.540368219007732, "userName": "userName", "userId": 2477, "amountInStock": 5667.404462854918, "purchaseRate": 5527.084182392269, "id": 8727 }], "stockPlace": "stockPlace", "batchId": "batchId", "type": 1946, "unit": { "name": "name", "externalId": "externalId", "id": 554 }, "reserved": 2973.1176284180883, "name": "name", "barcode": "barcode", "group": { "name": "name", "id": 7390, "articles": 9506 }, "isStock": true, "stockWarning": 7632.840544275783 }
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
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": 8800.975754387026, "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 |