Invoices API
General:
Basics:
Base-URL: https://capi.lagerkoll.com/v1/invoices/
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 |
901801 | Error when getting invoice draft |
901802 | Error when adding invoice draft |
901803 | Error when updating invoice draft |
901804 | Error when deleting invoice draft |
901805 | Error when invoicing draft |
{ "errorCode" : 900101, "errorMessage" : "Something went wrong on the server", "errorField" : null, "errorData" : null }
Invoices API:
Invoice drafts
Get invoice drafts
GETUrl: /drafts
Headers:
Accept: application/json or application/xml
Get a list of invoice drafts
Valid parameters:
Parameter | Description | Default value | Allowed values |
---|---|---|---|
query | |||
type | ALL | ALL, PROJECT, CUSTOMER_ORDER | |
return_invoiced_rows | true | ||
page | 0 | ||
limit | 100 | ||
sort_column | created | type, article_id, article_name, user, created | |
sort_order | desc | asc,desc |
Body:
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 9249.74145218904, "articleName": "articleName", "pricelistId": 3262, "endDate": 1758149009283, "rentalAmount": 5063.29281864575, "created": 1758149009283, "dataType": "dataType", "articleId": "articleId", "isInvoiced": true, "rentalCurrency": "rentalCurrency", "dataId": 9309, "price": 6092.8775003042065, "isProcessed": false, "dataArticleId": 6537, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 1489, "startDate": 1758149009283, "createdById": 6969 }], "ordersCount": 4345, "pages": 4752, "pageSize": 9603, "page": 3546 }
Create invoice draft
POSTUrl: /drafts/customer_order/{order_id}
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Create invoice drafts for articles in customer order
Body:
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 3907.1192578449786, "articleName": "articleName", "pricelistId": 7271, "endDate": 1758149009284, "rentalAmount": 6869.326872158686, "created": 1758149009284, "dataType": "dataType", "articleId": "articleId", "isInvoiced": false, "rentalCurrency": "rentalCurrency", "dataId": 8425, "price": 9657.092103979405, "isProcessed": true, "dataArticleId": 4784, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 9632, "startDate": 1758149009284, "createdById": 6804 }], "ordersCount": 9132, "pages": 5329, "pageSize": 4520, "page": 4447 }
Invoice drafts
PUTUrl: /drafts/invoice
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Send existing invoice drafts to external integrations and sets the draft to invoiced
Body:
{ "type": "type", "invoiceDraftIds": [{}] }
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 8899.039125595058, "articleName": "articleName", "pricelistId": 1840, "endDate": 1758149009284, "rentalAmount": 5826.4494001396815, "created": 1758149009284, "dataType": "dataType", "articleId": "articleId", "isInvoiced": false, "rentalCurrency": "rentalCurrency", "dataId": 8762, "price": 6674.792848830865, "isProcessed": false, "dataArticleId": 8211, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 4959, "startDate": 1758149009284, "createdById": 4495 }], "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 6437.2747402586065, "batchSnBestBefore": 3898, "accountName": "accountName", "articleId": "articleId", "priceListId": 8815, "purchasePrice": 3915.740338110748, "batchId": "batchId", "rental": false, "rentalCurrency": "rentalCurrency", "accountId": 2974, "checkoutDate": 660, "price": 3273.0373008363576, "comment": "comment", "id": 6549, "projectId": 3626, "checkoutAmount": 3799.7114798767807, "events": [{ "date": 1758149009284, "amount": 3798.595237822777, "type": "type" }], "checkinConsumeDate": 1758149009284, "checkinAmount": 115.72822043417142, "consumedAmount": 1542.7047541998472 }] }
Classes:
InvoiceDraftDto
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
id | long | R | |||||
dataType | String | R | |||||
dataId | Long | R | |||||
dataArticleId | Long | R | |||||
articleId | String | R | |||||
articleName | String | R | |||||
amount | Double | R | |||||
price | Double | R | |||||
pricelistId | long | R | |||||
currency | String | R | |||||
rentalCurrency | String | R | |||||
startDate | Date | R | |||||
endDate | Date | R | |||||
rentalAmount | Double | R | |||||
comment | String | R | |||||
isInvoiced | boolean | Indicates if row has been marked as invoiced | R | ||||
isProcessed | boolean | Indicates if row has been completely processed as invoiced | R | ||||
invoiceId | String | If row has been invoiced, this is id of the created invoice | R | ||||
createdById | Long | R | |||||
createdByName | String | R | |||||
created | Date | R |
InvoiceDraftIdsRequestDto
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
invoiceDraftIds | List | R,W | |||||
type | String | invoice, cash, card, ag | R |
InvoiceDraftsResponseDto
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
page | int | R | |||||
pages | int | R | |||||
pageSize | int | R | |||||
ordersCount | int | R | |||||
invoiceDrafts | List | R |
InvoiceProjectArticlesResponseDto
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
articles | List | R | |||||
invoiceDrafts | List | R |
ProjectArticleDto
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
id | long | R,W | |||||
projectId | long | R,W | |||||
articleId | String | R,W | |||||
articleName | String | R,W | |||||
batchId | String | R,W | |||||
snId | String | R,W | |||||
batchSnBestBefore | Long | R,W | |||||
checkoutAmount | Double | R,W | |||||
checkinAmount | Double | R,W | |||||
consumedAmount | Double | R,W | |||||
invoicedAmount | Double | R,W | |||||
priceListId | long | R,W | |||||
rental | boolean | R,W | |||||
price | double | R,W | |||||
rentalCurrency | String | R,W | |||||
comment | String | R,W | |||||
purchasePrice | Double | R,W | |||||
events | List | R,W | |||||
accountId | long | R,W | |||||
accountName | String | R,W | |||||
checkoutDate | Long | R,W | |||||
checkinConsumeDate | Date | R,W |
ProjectArticleEventDto
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
type | String | R,W | |||||
amount | double | R,W | |||||
date | Date | R,W |