Skip to main content

Ladu20 API

API structure

Ladu20 API is REST based, queries are processed via CURL POST requests.

API base URL: henceforth BASEURL, will be provided by KMA.
API key: henceforth APIKEY, will be provided by KMA
Request data is posted in CURLOPT_POSTFIELDS as JSON.
Response data is JSON formatted and returns request status, request type, result data and rowcount.

HTTP header Content-Type needs to be set to application/json

PHP sample request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://baseurl/product',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{"id":"21161"}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'x-api-key: APIKEY'
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Result handling

Query success or failure is defined in the boolean response field "ok". Response data and error descriptions are available in the field "data".

Successful response with results:
{"timestamp":"2023-10-13T10:00:35.133","ok":true,"query":"customer","row_count":1,"data":[{"customer_code":"1234","main_customer_code":"1234","receiving_customer_code":"1234","last_update":"2023-10-06T10:35:56.177","name":"TEST OÜ","reg_code":"1234568","vat_in_use":1,"vat_no":"EE1234567","is_private_person":0,"is_customer":1,"is_supplier":0,"is_producer":0,"is_transporter":0,"is_owner":0,"phone":"555555555","address1":"Mustamäe tee 46","address2":"Harjumaa","address3":"Tallinn","postcode":"10612","country":"EE","language":"","email":"info@kma.ee","currency":"EUR","ref_no":"0","old":0,"rowno":1}]}

Successful response with no results:
{"timestamp":"2023-10-13T09:54:22.303","ok":true,"query":"customer","row_count":0}

Unsuccessful request:
{"timestamp":"2023-10-13T09:56:54.410","ok":false,"query":"customer","data":{"message":"Technical error occurred"}}

Data output requests

API requests serve data from Ladu20 by predefined filterable POST requests. Filter parameters are defined per request and are not mandatory.

Currently the following standard outputs are available:

  • Customer data
  • Product data
  • Stocklevels
  • Order
  • Dispatch
  • Invoice

Customer data

URL: BASEURL/customer

Returns customer data from Ladu20 database. Ladu20 defines customers as one collection of data with several statuses. The latter means the customer cards for suppliers, customers, producers etc are the same data unit, with several statuses defining the customer state (eg is_supplier=1 means that the customer is also regarded a supplier in Ladu20).

Filter parameters
PARAMETER NAME TYPE DESCRIPTION Default value
last_update string returns data which is update later than the timestamp;
format: 2023-10-11T00:00:00
last 240 hours
old bool returns results marked as old in Ladu20; false
id string customer id in Ladu20  
page int Range 1-n 1
rowcount int Range 1-1000 300
Sample request data

'{"last_update":"2023-10-11T00:00:00","rowcount":2,"page":1}'

Response data
FIELD NAME TYPE DESCRIPTION
customer_code int  
main_customer_code int payer customer code
receiving_customer_code int  
last_update date format: 2023-10-11T00:00:00, created date
name string  
reg_code string  
vat_in_use int  
vat_no string  
is_private_person boolean  
customer boolean customer status
supplier boolean customer status
producer boolean customer status
transporter boolean customer status
owner string  
info string  
phone string  
address1 string street
address2 string city
address3 string county
postcode string  
country string  
language string  
email string  
currency decimal  
bank string bank name
bankaccount string  
ref_no int reference no
glncode int  
lat int latitude
long int longitude
credit_limit decimal  
debt_min_amount decimal  
debt_from int debt from days
owner_customer string  

Product data

URL: BASEURL/product

Returns customer data from Ladu20 database. Ladu20 defines customers as one collection of data with several statuses.

Filter parameters
PARAMETER NAME TYPE DESCRIPTION Default value
last_update string returns data which is update later than the timestamp;
format: 2023-10-11T00:00:00
last 240 hours
old bool returns results marked as old in Ladu20; false
id string customer id in Ladu20  
page int Range 1-n 1
rowcount int Range 1-1000 300
group1 string    
group2 string    
group3 string    
group4 string    
Sample request data

'{"last_update":"2023-10-11T00:00:00","rowcount":10,"page":4}'

Response data
FIELD NAME TYPE DESCRIPTION
product_id int product code
product_code int siffer
barcode string  
product_name string  
baseunit string  
large_unit string  
large_unit_multiplier string  
aidunit string  
aidunit_multiplier string aidunits in one package
min_sales_qty decimal minimum quantity on sale
sales_qty_step decimal minimum quantity step on sale
is_expireable boolean product is expirable or not (1,0)
product_shelf_life string  
cn8 string cn8 code
coo string country of origin
min_temp string minimum temperature
max_temp string maximum temperature
stock_qty decimal stock quantity
ordered_qty decimal ordered quantity
reserved_qty decimal reserved quantity
netweight int  
brutweight int  
volume int  
price decimal  
vat int vat on sale
group1 boolean product qroup
group2 boolean product qroup
group3 boolean product qroup
group4 boolean product qroup
group5 boolean product qroup
last_update date format: 2023-10-11T00:00:00
web_groups/group_id int product webgroup id
web_groups/group_code int product group id
web_groups/group_name string product group name
flex_groups/group_id int product webgroup id
flex_groups/group_code int product group id
flex_groups/group_name string product group name

Stockbalance

URL: BASEURL/stockbalance

Returns customerstockbalance data from Ladu20 database. 

Filter parameters
PARAMETER NAMETYPEDESCRIPTIONDefault value
idintproduct id 
pageintRange 1-n1
rowcountstringRange 1-1000300
Sample request data

'{"last_update":"2023-10-11T00:00:00","rowcount":10,"page":4}'

Response data
FIELD NAMETYPEDESCRIPTION
product_idint 
product_codestring 
stock_balancedecimal 
ordered_amountdecimal 
reserved_amountdecimal 
product_idint 
rows/ownerstring 
rows/owner_stock_balancedecimal 

Order

URL: BASEURL/order

Returns order data from Ladu20 definesdatabase. 

customers
Filter asparameters
onecollection
PARAMETER NAMETYPEDESCRIPTIONDefault value
startstringdate from, 
format: 2023-10-11T00:00:00
l
idintorder id 
enddatedate until, format: 2023-10-11T00:00:00 
customer_idstringcustomer code 
pageintRange 1-n1
rowcountintRange 1-1000300
Sample request data

'{"last_update":"2023-10-11T00:00:00","rowcount":10,"page":4}'

Response data
FIELD NAMETYPEDESCRIPTION
customer_codeint 
doc_nostringorder no
doc_datedateorder date, format: 2023-10-11T00:00:00
del_duedatedelivery date, format: 2023-10-11T00:00:00
statusstringorder status
additional_infostring 
inserterstring 
dicount_perdecimaldiscount percent
doc_no2stringcustomer order no
confirmedboolean 
currencydecimal 
currency_ratedecimal 
customer_datedateformat: 2023-10-11T00:00:00
pre_orderboolean 
payerstringpayer customer
warningstring 
xml_doneboolean 
ownerstring 
customerstringcustomer who placed the order
phonestringcustomer phone no
countrystringcustomer country
picking_in_progbooleanpicking in progress
payment_duedateformat: 2023-10-11T00:00:00
payment_typestringcash, transfer etc
weborder_idint 
customer_namestringcustomer contact who placed the order
doc_sumdecimal 
recip_customerstringrecipient customer
original_quantitydecimal 
quantitydecimal 
pricedecimal 
basepricedecimal 

Dispatch

URL: BASEURL/dispatch

Returns order data from Ladu20 database. 

Filter parameters
PARAMETER NAMETYPEDESCRIPTIONDefault value
startstringdate from, 
format: 2023-10-11T00:00:00
l
idintdispatch id 
enddatedate until, format: 2023-10-11T00:00:00 
customer_idstringcustomer code 
pageintRange 1-n1
rowcountintRange 1-1000300
Sample request data

'{"last_update":"2023-10-11T00:00:00","rowcount":10,"page":4}'

Response data
FIELD NAMETYPEDESCRIPTION
dispatch_codeint 
customer_idint 
dispatch_type_idstring 
datedateformat: 2023-10-11T00:00:00
doc_nostringdispatch document no
discount_perintdiscount percent
inserterstring 
sum_netdecimal 
sum_incl_vatdecimalsum including vat
duestringpayment due
payerstringpayer customer
additional_infostring 
currencydecimal 
payment_typestringcash, transfer etc
warehouse_aadressstring 
accountstringbank account
countrystring 
rec_customerstringrecipient customer
needed_duedate 
ownerstring 
ship_customerstring 
tracking_nostring 
paiddecimal 
amount_of_boxesdecimal 
product_idstring 
batchintbatch code
amountdecimal 
discount_perintdiscount percent
pricedecimalproduct price
net_valueint 
discount_pricedecimal 
base_pricedecimal 
brut_weightint 
setstringset of products
accountstringbank account
row_amountdecimal 
stockaddressstring 
set_amountdecimalhow many products in set
piecesint 
warningstring 
sales_idintsaleorder id
pricelist_idint 
price_typestring 
vat_salestring 
fix_net_valuestring 
warehouse_agentstringwarehouse agent name
addedbooleandispatch added (1,0)
package_idstring 
pickerstringwarehouse agent who picked products
agentstringagent on sale
base_codestring 
batch_idint 
descriptionstring 
expiration_datedateformat: 2023-10-11T00:00:00

Invoice

URL: BASEURL/invoice

Returns invoice data withfrom severalLadu20 statuses.database. 

Filter parameters
PARAMETER NAME TYPE DESCRIPTION Default value
last_update string returns data which is update later than the timestamp;
format: 2023-10-11T00:00:00
last 240 hours
oldend booldate returnsformat: results marked as old in Ladu20;2023-10-11T00:00:00 false 
customer_idstringcustomer code 
id stringint customerinvoice id in Ladu20  
page int Range 1-n 1
rowcount intstring Range 1-1000 300
group1string  
group2string  
group3string  
group4string  
Sample request data

'{"last_update":"2023-10-11T00:00:00","rowcount":10,"page":4}'

Response data

Order

Dispatch

Invoice

FIELD NAMETYPEDESCRIPTION
customer_codeint 
invoice_datedateinvoice (document created) date
invoice_nostringinvoice number
totaldecimaltotal sum
paiddecimal 
paid_datedateformat: 2023-10-11T00:00:00
fine_for_delayString 
deadlinedateformat: 2023-10-11T00:00:00
paym_methstringpayment method
printedboolean 
post_datedateformat: 2023-10-11T00:00:00
partialstringpartial payment
cred_invoice_nostringcredit invoice no
from_stockstringsent out from stock
report_doneboolean 
warningstring 
ownerstring 
ref_nostringreference no
add_infostringadditional information
prepaym_amountdecimal 
prepaym_infostring 
returnedboolean 
product_idlong 
batchlongproducts batch
amountdecimal 
discount_percentint%
pricedecimal 
net_valueint 
discount_pricedecimal 
base_pricedecimal 
brut_weightint 
setstringset of products
accountstring 
row_amountdecimal 
stockaddressstring 
set_amountdecimalhow many products in set
piecesint 
vat_saleboolean