Skip to main content

Ladu20 API

API structure

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

API base URL: henceforth henceforth BASEURL, will be provided by KMA.
API key: henceforth 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 =  curl_init();
curl_setopt_array($curl, array(   CURLOPT_URL array(
  CURLOPT_URL =>  'https://baseurl/product'baseurl/product',
  CURLOPT_RETURNTRANSFER 
  CURLOPT_RETURNTRANSFER => true,   CURLOPT_ENCODING true,
  CURLOPT_ENCODING =>  '',
  CURLOPT_MAXREDIRS 
  CURLOPT_MAXREDIRS =>  10,
  CURLOPT_TIMEOUT 
  CURLOPT_TIMEOUT =>  0,
  CURLOPT_FOLLOWLOCATION 
  CURLOPT_FOLLOWLOCATION => true,   CURLOPT_HTTP_VERSION true,
  CURLOPT_HTTP_VERSION =>  CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST 
  CURLOPT_CUSTOMREQUEST =>  'POST',
  CURLOPT_POSTFIELDS 
  CURLOPT_POSTFIELDS =>'{"id":"21161"}',
  CURLOPT_HTTPHEADER 
  CURLOPT_HTTPHEADER =>  array(
    
    'Content-Type:  application/json',
    
    'x-api-key: APIKEY'APIKEY'
  
  ),
));
$response response =  curl_exec($curl);
curl_close($curl);
echo 
echo $response;

Result handling

Response data

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"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 NOno results:

{"timestamp":"2023-10-13T09:54:22.303","ok":true,"query":"customer","row_count":0}

Unsuccessful response: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
  • Stock levels
  • 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 stringint   
main_customer_code stringint payer customer code
receiving_customer_code stringint   
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  
countystringcounty
country string country 
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 product data from Ladu20 database. Ladu20 defines all product information with prices, replacements, parameters, lots, images and price agreements. In addition, the current state of the products, ordered and reserved quantities.  
The price of the products ("price excluding VAT") is usually the main selling price. To classify products more easily, we have created groups of products. You can also add subgroups to item groups. For example product group1 no is 1 and, code V1 and description vegetables then subgroup for group1 may be V12(apples), V13 (citrus) etc.  

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 productcustomer 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 stringint siffer
barcode string   
product_name string   
baseunit string   
large_unit string   
large_unit_multiplier decimalstring   
aidunit string   
aidunit_multiplier decimalstring 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 intstring product lifetime in days
cn8 string cn8 code
coo string country of origin
min_temp intstring minimum temperature
max_temp intstring maximum temperature
stock_qty decimal stock quantity
ordered_qty decimal ordered quantity
reserved_qty decimal reserved quantity
netweight decimalint   
brutweight decimalint   
volume decimalint   
price decimal   
vat int vat on sale
group1 stringboolean product qroup
group2 stringboolean product qroup
group3 stringboolean product qroup
group4 stringboolean product qroup
group5 stringboolean product qroup
last_update datetimedate format: 2023-10-11T00:00:00
web_groups/group_id int product webgroup id
web_groups/group_code stringint product group codeid
web_groups/group_name string product group name
flex_groups/group_id int flexgroupproduct webgroup id
flex_groups/group_code stringint product group codeid
flex_groups/group_name string product group name

Stockbalance

URL: BASEURL/stockbalance

Returns stockbalance data from Ladu20 database - product amounts in different warehouses (balance, ordered, reserved). Owner is usually main warehouse.  

Filter parameters

PARAMETER NAME TYPE DESCRIPTION Default value
id int product id   
page int Range 1-n 1
rowcount int Range 1-1000 300

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 string siffer
stock_balance decimal   
ordered_amount decimal   
reserved_amount decimal   
product_id int   
rows/owner string   
rows/owner_stock_balance decimal   

Order

URL: BASEURL/order

Returns order data from Ladu20 database. Order = sales order, which is in most cases, the primary document for the sales side for the warehouse.    

Filter parameters

PARAMETER NAME TYPE DESCRIPTION Default value
start string date from,  
format: 2023-10-11T00:00:00
 l
id int order id   
end date date until, format: 2023-10-11T00:00:00   
customer_id string order customer idcode   
page int Range 1-n 1
rowcount int Range 1-1000 300

Sample request data

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

Response data

 
FIELD NAME TYPE DESCRIPTION
customer_code stringint   
doc_no string order no
doc_date date order date, format: 2023-10-11T00:00:00
del_due date delivery date, format: 2023-10-11T00:00:00
status string order status
additional_info string   
inserter string   
dicount_per decimal discount percent
doc_no2 string customer order no
confirmed boolean   
currency decimal   
currency_rate decimal   
customer_date date format: 2023-10-11T00:00:00
pre_order boolean   
payer string payer customer
warning string   
xml_done boolean   
owner string   

salesman

stringsalesman name

customer

string customer who placed the order
phone string customer phone no
countystringcustomer county
country string customer country
picking_in_prog boolean picking in progress
payment_due date format: 2023-10-11T00:00:00
payment_type string cash, transfer etc
weborder_id int   
customer_name string customer contact who placed the order
doc_sum decimal   
recip_customer string recipient customer
original_quantity decimal   
quantity decimal   
price decimal   
baseprice decimal  

Order Status

URL: BASEURL/orderstatus

Returns order status information from Ladu20 database.

Filter parameters

PARAMETER NAMETYPEDESCRIPTIONDefault value
doc_nostringorder number in WMS 
idintorder id 
startstringstatus date from, 
format: 2023-10-11T00:00:00
 
customer_idstringorder customer id 
pageintRange 1-n1
rowcountintRange 1-1000300

Sample request data

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

Response data

FIELD NAMETYPEDESCRIPTION
customer_codestring 
doc_nostringorder no
doc_datedateorder date, format: 2023-10-11T00:00:00
del_duedatedelivery date, format: 2023-10-11T00:00:00
statusintorder status id
status_textstringhuman-readable status info
status_timedatestatus timestamp: format: 2023-10-11T00:00:00 status int  

Dispatch

URL: BASEURL/dispatch

Returns order data from Ladu20 database - dispatch of the products from Ladu20 warehouses.  

Filter parameters

PARAMETER NAME TYPE DESCRIPTION Default value
start string date from,  
format: 2023-10-11T00:00:00
 l
id int dispatch id   
end stringdate date until, format: 2023-10-11T00:00:00   
customer_id string customer code   
page int Range 1-n 1
rowcount int Range 1-1000 300

Sample request data

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

Response data

FIELD NAME TYPE DESCRIPTION
dispatch_code int   
customer_id int   
dispatch_type_id string   
date date format: 2023-10-11T00:00:00
doc_no string dispatch document no
discount_per int discount percent
inserter string   
sum_net decimal   
sum_incl_vat decimal sum including vat
due string payment due
payer string payer customer
additional_info string   
currency decimal   
payment_type string cash, transfer etc
warehouse_aadress string   
account string bank account
countystring 
country string   
rec_customer string recipient customer
needed_due date   
owner string   
ship_customer string   
tracking_no string   
paid decimal   
amount_of_boxes decimal   
product_id string   
batch int batch code
amount decimal   
discount_per int discount percent
price decimal product price
net_value int   
discount_price decimal   
base_price decimal   
brut_weight int   
set string set of products
account string bank account
row_amount decimal   
stockaddress string   
set_amount decimal how many products in set
pieces int   
warning string   
sales_id int saleorder id
pricelist_id int   
price_type string   
vat_sale string   
fix_net_value string   
warehouse_agent string warehouse agent name
added boolean dispatch added (1,0)
package_id string   
picker string warehouse agent who picked products
agent string agent on sale
base_code string   
batch_id int   
description string   
expiration_date date format: 2023-10-11T00:00:00

Invoice

URL: BASEURL/invoice

Returns invoice data from Ladu20 database. Invoices are accounting outputs from dispatches.

Filter parameters

PARAMETER NAME TYPE DESCRIPTION Default value
startlast_update string returns data which is update later than the timestamp;
format: 2023-10-11T00:00:00
last 240 hours
end stringdate format: 2023-10-11T00:00:00   
customer_id string customer code   
id int invoice id   
page int Range 1-n 1
rowcount int Range 1-1000 300

Sample request data

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

Response data

FIELD NAME TYPE DESCRIPTION
customer_code stringint   
invoice_date date invoice (document created) date
invoice_no string invoice number
total decimal total sum
paid decimal   
paid_date date format: 2023-10-11T00:00:00
fine_for_delay String   
deadline date format: 2023-10-11T00:00:00
paym_meth string payment method
printed boolean   
post_date date format: 2023-10-11T00:00:00
partial string partial payment
cred_invoice_no string credit invoice no
from_stock string sent out from stock
report_done boolean   
warning string   
owner string   
ref_no string reference no
add_info string additional information
prepaym_amount decimal   
prepaym_info string   
returned boolean   
product_id long   
batch long products batch
amount decimal   
discount_percent int %
price decimal   
net_value int   
discount_price decimal   
base_price decimal   
brut_weight int   
set string set of products
account string   
row_amount decimal   
stockaddress string   
set_amount decimal how many products in set
pieces int   
vat_sale boolean   

Importing data

Salesorder

URL: BASEURL/salesorder

With salesorder access point, you can import sales orders to Ladu20. Posting is identical to data output requests.

Important notes:

  • If no customer code is defined, Ladu20 uses a generic customer code for the order.
  • Delivery information blocks are used for postal services integrations;
  • If you are using the API for B2B orders services, do not fill the subblocks customer and delivery;
  • VAT percentages are especially important for cross border sales;
  • Transportation fees should be added to document rows with product codes according to the product database.

Input data

FIELD NAMETYPEDESCRIPTIONREQUIRED
customer_codestringcustomer code in Ladu20 
customer/namestringcustomer name 
customer/streetstringdelivery address street 
customer/citystringdelivery address city 
customer/postalcodestringdelivery address postal code 
customer/countystringcounty code 
customer/countrystringcountry code 
customer/emailstringemail 
customer/phonestringaddress 
customer/is_companybityes/no 
customer/company_namestringCustomer company name 
customer/company_regnostringMandtory if is_company=1 
customer/company_vatnostring  
delivery/typestring

"Parcel machine", "Courier" or "Self pickup"

 
delivery/delivery_partnerstringDelivery partner name for courier and parcel machinesparcel and courier
delivery/namestringcustomer name 
delivery/company_namestring

company name

 
delivery/streetstringdelivery address street 
delivery/citystringdelivery address city 
delivery/postalcodestringdelivery address postal code 
delivery/countystringcounty  
delivery/countrystringcountry 

delivery/email

stringemail 
delivery/phonestringphone number 
delivery/parcel_codestringparcel machine numberparcel only
doc_nostringorder number in external system*
project_codestringorder project code for Ladu20 
doc_sellerstringSeller code for whole document 
doc_datestring

order date in external system,

format "2019-12-31T11:14:25.473"

defaults to now

 
del_duestring

delivery deadline,
format "2019-12-31T11:14:25.473"

defaults to now+1

 
currencystring

order currency code

 
currency_ratedecimal

order rate

 
order_sumdecimal

 

 
order_sum_with_vatdecimal

 

 
payment_partnerstring

payment partner or account code. Used for accounting purposes.

 
payment_sumdecimal

sum of prepayament

 
payment_typeint

 

 
rows/product_codestring

row product code in Ladu20

*
rows/product_namestring

product name, if required as additional info; if not filled, default product name will be used

 
rows/quantitydecimal

order row quantity

*
rows/pricedecimal

netprice

*
rows/vatint

vat percentage of order row

 
rows/sellerstring

row based seller code

 

Sample data

{
   "customer_code":"kaupmees#",
   "customer":{
      "name":"kaupmees nimi",
      "street":"kase 1",
      "city":"tallinn",
      "postalcode":"12345",
      "county":"harjumaa",
      "country":"ee",
      "email":"info@mail. Ee",
      "phone":"55 123 123"
   },
   "delivery":{
      "delivery_partner":"Omniva",      
      "email":"info@mail.Ee",
      "phone":"55 123 123"     ,
      "name":"Name on parcel",       
      "country":"ee",
     /* FOR PARCEL MACHINE */
      "type":"Parcel machine",
      "parcel_code":"444569",    ,     
      /* FOR COURIER */          
      "type":"Courier",                
      "street":"kase 1",
      "city":"tallinn",
      "county":"harjumaa"
      "postalcode":"12345"      
   },  
   "doc_no":"10001",
   "project_code":"WEBSHOP_01"
   "doc_date":"2019-12-31t11:14:25.473",
   "del_due":"2019-12-31t00:00:00",
   "currency":"eur",
   "currency_rate":1,
   "order_sum":134.15,
   "order_sum_with_vat":154.15,
   "payment_type":1,   
   "payment_partner":'Maksekeskus",   
   "payment_sum":154.15,   
   "rows":[
      {
         "product_code":"digi",
         "product_name":"ajakiri digi",
         "quantity":1,
         "vat":20,
         "price":4.185
      },
      {
         "product_code":"digi-2",
         "product_name":"ajakiri digi",
         "quantity":2,
         "vat":20,
         "price":4.185
      },
      {
         "product_code":"digi-3",
         "product_name":"ajakiri digi",
         "quantity":3,
         "vat":0,        
         "price":14.185
      }
   ]
}

Order payment

URL: BASEURL/order_payment

Adding a payment to an existing order.

Input data

FIELD NAMETYPEDESCRIPTIONREQUIRED
doc_nostringDocument number in Ladu20*
order_idintOrder ID in Ladu20 
payment_sumdecimalSum of made payment*

Sample data

{
  "payment_sum":145.67,
  "doc_no":"11145",
  "order_id":12455
}