Function to create new order.
https://rest.crmango.com/api/CreateNewOrder
Bearer
varchar
Auth token (required in Authorization header)
rad_code
varchar
Document series code (e.g., OP, OV). Required
order_type
varchar
Order type (received, issued). Required
name
varchar
Order name or reference number
lang_id
varchar
Language ISO code (en, sk, cs)
notify
integer
Whether to notify stakeholders (0 = no, 1 = yes)
text_after_header
varchar
Optional text printed after header
text_before_footer
varchar
Optional text printed before footer
invoice_days
int
Invoice due days
taxable_date
date
Date of taxable
internal_number
string
Internal number
own_cols[0].id_own_col
integer
ID of custom field (own column)
own_cols[0].data
mixed
Value assigned to the custom field (can be string, number, etc.)
products_tables[0].table_name
varchar
Name/label of the product table (optional)
products_tables[0].products[0].name
varchar
Product name
products_tables[0].products[0].quantity
decimal
Product quantity
products_tables[0].products[0].price
decimal
Unit price (without VAT)
products_tables[0].products[0].vat
decimal
VAT percentage (e.g., 20)
products_tables[0].products[0].cost_price
decimal
Cost price (optional, for margin calculation)
products_tables[0].products[0].discount
decimal
Discount
transport.price
integer|float
Transport price
transport.points[0].type
varchar
Point type (start_point, load, unload, crossing_point, parking, gas_station, toll_station)
transport.points[0].lat
varchar
Latitude of the point (GPS)
transport.points[0].long
varchar
Longitude of the point (GPS)
transport.points[0].address
varchar
Address of the point
transport.points[0].postal
varchar
Postal code (optional)
transport.points[0].datetime
datetime
Scheduled date and time (format: Y-m-dTH:i)
transport.points[0].note
varchar
Short note for the point (optional)
transport.points[0].note_full
varchar
Full note/details (optional)
transport.points[0].product_name
varchar
Optional description of product(s)
transport.points[0].product_count
varchar
Total number of items
transport.points[0].product_weight
varchar
Total weight in kg (optional)
transport.points[0].product_volume
varchar
Total volume in m³ (optional)
transport.points[0].ldm
varchar
LDM value
transport.points[0].contact_person
varchar
Contact person at the location (optional)
transport.points[0].mobile_phone
varchar
Contact phone number (optional)
transport.points[0].reference_number
varchar
Internal or customer reference number (optional)
files
array
Optional. Array of files (base64) to attach to the order. Multiple files allowed.
files[0].filename
varchar
File name including extension (e.g., contract.pdf). Forbidden types: php, js, htm, html, css, htaccess, php3, php4, phtml, xml, bat
files[0].data
varchar
File content encoded in base64 (without data:...;base64, prefix)
Function to create new order
code
integer
HTTP status code (201 = Created)
message
varchar
Confirmation message
created_id
integer
ID of the newly created order
order_number
varchar
Order code of the newly created order
files
array
Result for each uploaded file (returned only if files were sent). The order is created even if some file fails
files[0].filename
varchar
File name from request
files[0].status
varchar
success or error
files[0].file_id
integer
ID of the stored file (only on success)
files[0].message
varchar
Error description (only on error)
curl --request POST \
--url 'https://rest.crmango.com/api/CreateNewOrder' \
--header 'Authorization: Bearer auth_token' \
--header 'Content-Type: application/json' \
--data '{
{
"rad_code": "OP",
"order_type": "received",
"name": "Order 1234",
"supplier_id": 1,
"purchaser_fa_id": 2,
"purchaser_os_id": 3,
"created_by": 2323,
"user_id": 2323,
"currency_id": 202,
"active_service_id": 0,
"lang_id": "en",
"notify": 0,
"text_after_header": "",
"text_before_footer": "",
"invoice_days": "14",
"taxable_date": "26.10.2025",
"internal_number": "",
"own_cols": [
{
"id_own_col": 1,
"data": ""
},
{
"id_own_col": 2,
"data": 1
},
{
"id_own_col": 3,
"data": ""
}
],
"products_tables": [
{
"table_name": "First table",
"products": [
{
"name": "Macbook air",
"mj_id": 1,
"quantity": 1,
"price": 1200,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
},
{
"name": "HP Elite",
"mj_id": 1,
"quantity": 1,
"price": 800,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
}
]
},
{
"table_name": "",
"products": [
{
"name": "USB dongle",
"mj_id": 1,
"quantity": 23,
"price": 10,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
}
]
}
],
"transport": {
"transporter_id": 23,
"vehicle_id": 8,
"trailer_id": 3,
"driver_id": 1,
"driver2_id": 1,
"price": "235.24",
"points": [
{
"type": "load",
"lat": "45.748184204102",
"long": "6.32590675354",
"note": "",
"address": "Chemin de Piezan, 74210 Val de Chaise, Francúzsko",
"postal": "92200",
"datetime": "2025-10-03T12:00",
"note_full": "",
"product_mj": "0",
"ldm": "",
"product_name": "",
"product_type": "1",
"product_count": "",
"product_weight": "5000",
"mobile_phone": "",
"contact_person": "",
"product_volume": "",
"reference_number": ""
},
{
"type": "unload",
"note": "",
"address": "Berlin",
"postal": "",
"datetime": "2025-10-03T12:00",
"note_full": "",
"product_mj": "0",
"ldm": "",
"product_name": "",
"product_type": "1",
"product_count": "",
"product_weight": "5000",
"mobile_phone": "",
"contact_person": "",
"product_volume": "",
"reference_number": ""
}
]
},
"files": [
{
"filename": "contract.pdf",
"data": "JVBERi0xLjQKJcfsj6IKJSVFT0YK"
},
{
"filename": "photo.jpg",
"data": "/9j/4AAQSkZJRgABAQEASABIAAD/2wBD..."
}
]
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/CreateNewOrder',
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 => '{
{
"rad_code": "OP",
"order_type": "received",
"name": "Order 1234",
"supplier_id": 1,
"purchaser_fa_id": 2,
"purchaser_os_id": 3,
"created_by": 2323,
"user_id": 2323,
"currency_id": 202,
"active_service_id": 0,
"lang_id": "en",
"notify": 0,
"text_after_header": "",
"text_before_footer": "",
"invoice_days": "14",
"taxable_date": "26.10.2025",
"internal_number": "",
"own_cols": [
{
"id_own_col": 1,
"data": ""
},
{
"id_own_col": 2,
"data": 1
},
{
"id_own_col": 3,
"data": ""
}
],
"products_tables": [
{
"table_name": "First table",
"products": [
{
"name": "Macbook air",
"mj_id": 1,
"quantity": 1,
"price": 1200,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
},
{
"name": "HP Elite",
"mj_id": 1,
"quantity": 1,
"price": 800,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
}
]
},
{
"table_name": "",
"products": [
{
"name": "USB dongle",
"mj_id": 1,
"quantity": 23,
"price": 10,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
}
]
}
],
"transport": {
"transporter_id": 23,
"vehicle_id": 8,
"trailer_id": 3,
"driver_id": 1,
"driver2_id": 1,
"price": "235.24",
"points": [
{
"type": "load",
"lat": "45.748184204102",
"long": "6.32590675354",
"note": "",
"address": "Chemin de Piezan, 74210 Val de Chaise, Francúzsko",
"postal": "92200",
"datetime": "2025-10-03T12:00",
"note_full": "",
"product_mj": "0",
"ldm": "",
"product_name": "",
"product_type": "1",
"product_count": "",
"product_weight": "5000",
"mobile_phone": "",
"contact_person": "",
"product_volume": "",
"reference_number": ""
},
{
"type": "unload",
"note": "",
"address": "Berlin",
"postal": "",
"datetime": "2025-10-03T12:00",
"note_full": "",
"product_mj": "0",
"ldm": "",
"product_name": "",
"product_type": "1",
"product_count": "",
"product_weight": "5000",
"mobile_phone": "",
"contact_person": "",
"product_volume": "",
"reference_number": ""
}
]
},
"files": [
{
"filename": "contract.pdf",
"data": "JVBERi0xLjQKJcfsj6IKJSVFT0YK"
},
{
"filename": "photo.jpg",
"data": "/9j/4AAQSkZJRgABAQEASABIAAD/2wBD..."
}
]
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer auth_token',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
var data = JSON.stringify({
{
"rad_code": "OP",
"order_type": "received",
"name": "Order 1234",
"supplier_id": 1,
"purchaser_fa_id": 2,
"purchaser_os_id": 3,
"created_by": 2323,
"user_id": 2323,
"currency_id": 202,
"active_service_id": 0,
"lang_id": "en",
"notify": 0,
"text_after_header": "",
"text_before_footer": "",
"invoice_days": "14",
"taxable_date": "26.10.2025",
"internal_number": "",
"own_cols": [
{
"id_own_col": 1,
"data": ""
},
{
"id_own_col": 2,
"data": 1
},
{
"id_own_col": 3,
"data": ""
}
],
"products_tables": [
{
"table_name": "First table",
"products": [
{
"name": "Macbook air",
"mj_id": 1,
"quantity": 1,
"price": 1200,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
},
{
"name": "HP Elite",
"mj_id": 1,
"quantity": 1,
"price": 800,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
}
]
},
{
"table_name": "",
"products": [
{
"name": "USB dongle",
"mj_id": 1,
"quantity": 23,
"price": 10,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
}
]
}
],
"transport": {
"transporter_id": 23,
"vehicle_id": 8,
"trailer_id": 3,
"driver_id": 1,
"driver2_id": 1,
"price": "235.24",
"points": [
{
"type": "load",
"lat": "45.748184204102",
"long": "6.32590675354",
"note": "",
"address": "Chemin de Piezan, 74210 Val de Chaise, Francúzsko",
"postal": "92200",
"datetime": "2025-10-03T12:00",
"note_full": "",
"product_mj": "0",
"ldm": "",
"product_name": "",
"product_type": "1",
"product_count": "",
"product_weight": "5000",
"mobile_phone": "",
"contact_person": "",
"product_volume": "",
"reference_number": ""
},
{
"type": "unload",
"note": "",
"address": "Berlin",
"postal": "",
"datetime": "2025-10-03T12:00",
"note_full": "",
"product_mj": "0",
"ldm": "",
"product_name": "",
"product_type": "1",
"product_count": "",
"product_weight": "5000",
"mobile_phone": "",
"contact_person": "",
"product_volume": "",
"reference_number": ""
}
]
},
"files": [
{
"filename": "contract.pdf",
"data": "JVBERi0xLjQKJcfsj6IKJSVFT0YK"
},
{
"filename": "photo.jpg",
"data": "/9j/4AAQSkZJRgABAQEASABIAAD/2wBD..."
}
]
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://rest.crmango.com/api/CreateNewOrder");
xhr.setRequestHeader("Authorization", "Bearer auth_token");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
import requests
import json
url = "https://rest.crmango.com/api/CreateNewOrder"
payload = json.dumps({
{
"rad_code": "OP",
"order_type": "received",
"name": "Order 1234",
"supplier_id": 1,
"purchaser_fa_id": 2,
"purchaser_os_id": 3,
"created_by": 2323,
"user_id": 2323,
"currency_id": 202,
"active_service_id": 0,
"lang_id": "en",
"notify": 0,
"text_after_header": "",
"text_before_footer": "",
"invoice_days": "14",
"taxable_date": "26.10.2025",
"internal_number": "",
"own_cols": [
{
"id_own_col": 1,
"data": ""
},
{
"id_own_col": 2,
"data": 1
},
{
"id_own_col": 3,
"data": ""
}
],
"products_tables": [
{
"table_name": "First table",
"products": [
{
"name": "Macbook air",
"mj_id": 1,
"quantity": 1,
"price": 1200,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
},
{
"name": "HP Elite",
"mj_id": 1,
"quantity": 1,
"price": 800,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
}
]
},
{
"table_name": "",
"products": [
{
"name": "USB dongle",
"mj_id": 1,
"quantity": 23,
"price": 10,
"vat": 20,
"price_type_id": 0,
"cost_price": 0,
"cost_type": 0,
"discount": 0
}
]
}
],
"transport": {
"transporter_id": 23,
"vehicle_id": 8,
"trailer_id": 3,
"driver_id": 1,
"driver2_id": 1,
"price": "235.24",
"points": [
{
"type": "load",
"lat": "45.748184204102",
"long": "6.32590675354",
"note": "",
"address": "Chemin de Piezan, 74210 Val de Chaise, Francúzsko",
"postal": "92200",
"datetime": "2025-10-03T12:00",
"note_full": "",
"product_mj": "0",
"ldm": "",
"product_name": "",
"product_type": "1",
"product_count": "",
"product_weight": "5000",
"mobile_phone": "",
"contact_person": "",
"product_volume": "",
"reference_number": ""
},
{
"type": "unload",
"note": "",
"address": "Berlin",
"postal": "",
"datetime": "2025-10-03T12:00",
"note_full": "",
"product_mj": "0",
"ldm": "",
"product_name": "",
"product_type": "1",
"product_count": "",
"product_weight": "5000",
"mobile_phone": "",
"contact_person": "",
"product_volume": "",
"reference_number": ""
}
]
},
"files": [
{
"filename": "contract.pdf",
"data": "JVBERi0xLjQKJcfsj6IKJSVFT0YK"
},
{
"filename": "photo.jpg",
"data": "/9j/4AAQSkZJRgABAQEASABIAAD/2wBD..."
}
]
}
})
headers = {
'Authorization': 'Bearer auth_token',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
{
"code": 201,
"message": "New order has been added",
"created_id": 36589,
"order_number": "OP-797-2025",
"files": [
{
"filename": "contract.pdf",
"status": "success",
"file_id": 112
},
{
"filename": "photo.jpg",
"status": "error",
"message": "Insufficient purchased disk space"
}
]
}
{
"code": "int",
"message": "string"
}