curl --request POST \
--url https://apiweb.mile.app/api/v4/order-type \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Express Delivery",
"code": "EXP",
"description": "Same-day parcel delivery"
}
'import requests
url = "https://apiweb.mile.app/api/v4/order-type"
payload = {
"name": "Express Delivery",
"code": "EXP",
"description": "Same-day parcel delivery"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Express Delivery', code: 'EXP', description: 'Same-day parcel delivery'})
};
fetch('https://apiweb.mile.app/api/v4/order-type', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiweb.mile.app/api/v4/order-type",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Express Delivery',
'code' => 'EXP',
'description' => 'Same-day parcel delivery'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v4/order-type"
payload := strings.NewReader("{\n \"name\": \"Express Delivery\",\n \"code\": \"EXP\",\n \"description\": \"Same-day parcel delivery\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apiweb.mile.app/api/v4/order-type")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Express Delivery\",\n \"code\": \"EXP\",\n \"description\": \"Same-day parcel delivery\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/order-type")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Express Delivery\",\n \"code\": \"EXP\",\n \"description\": \"Same-day parcel delivery\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Order Type created",
"data": {
"_id": "6710a2f4c1d2e3f4a5b6c7d8",
"name": "Express Delivery",
"code": "EXP",
"description": "Same-day parcel delivery",
"schemaVersion": 1,
"state": "draft",
"draftRevision": 1,
"hasUnpublishedChanges": true,
"publishedVersion": null,
"publishedAt": null,
"publishedBy": null,
"fields": [
{
"id": "orderNo",
"title": "Order number",
"type": "string",
"required": true,
"unique": true,
"show": true
},
{
"id": "customerName",
"title": "Customer name",
"type": "string",
"required": false,
"show": true
},
{
"id": "weight",
"title": "Weight (kg)",
"type": "number",
"required": false,
"show": true,
"min": 0
}
],
"statuses": [
{
"id": "new",
"label": "New",
"category": "new",
"order": 1,
"color": "#6C757D"
},
{
"id": "onDelivery",
"label": "On delivery",
"category": "inProgress",
"order": 2
},
{
"id": "completed",
"label": "Completed",
"category": "completed",
"order": 3
},
{
"id": "cancelled",
"label": "Cancelled",
"category": "completed",
"order": 4
}
],
"configuration": {
"uniqueBy": [
"orderNo"
],
"cancelStatusId": "cancelled"
},
"orderSteps": [
{
"id": "start",
"type": "string",
"title": "Order created",
"position": {
"x": 0,
"y": 0
},
"event": "onOrderCreated",
"next": {
"next": [
"pickup"
]
}
},
{
"id": "pickup",
"type": "string",
"title": "Pickup",
"position": {
"x": 240,
"y": 0
},
"taskTypeId": "66f1b2c3d4e5f6a7b8c9d0e1",
"assignee": {
"mode": "unassigned"
},
"hub": {
"mode": "order"
},
"quantity": {
"mode": "perOrder"
},
"taskData": [
{
"target": "title",
"source": {
"ref": "$order.values.orderNo"
}
}
],
"saveToOrder": [],
"next": {
"next": [
"done"
]
}
},
{
"id": "done",
"type": "string",
"title": "Finish",
"position": {
"x": 480,
"y": 0
},
"statusId": "completed"
}
],
"canvas": {
"viewport": {
"x": 0,
"y": 0,
"zoom": 1
}
},
"createdTime": "2026-10-01T02:00:00.000+00:00",
"createdBy": "[email protected]",
"updatedTime": "2026-10-07T03:15:22.000+00:00",
"updatedBy": "[email protected]"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Create order type
Creates a new order type as a draft. Requires permission add/orderType.
Send only name and code to get the empty starter (statuses new and completed, no fields, no steps), or send fields, statuses, configuration and orderSteps too (for example to duplicate an existing type).
A malformed structure is refused with 400 and a checks list. A name or code already used answers 409.
curl --request POST \
--url https://apiweb.mile.app/api/v4/order-type \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Express Delivery",
"code": "EXP",
"description": "Same-day parcel delivery"
}
'import requests
url = "https://apiweb.mile.app/api/v4/order-type"
payload = {
"name": "Express Delivery",
"code": "EXP",
"description": "Same-day parcel delivery"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Express Delivery', code: 'EXP', description: 'Same-day parcel delivery'})
};
fetch('https://apiweb.mile.app/api/v4/order-type', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiweb.mile.app/api/v4/order-type",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Express Delivery',
'code' => 'EXP',
'description' => 'Same-day parcel delivery'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v4/order-type"
payload := strings.NewReader("{\n \"name\": \"Express Delivery\",\n \"code\": \"EXP\",\n \"description\": \"Same-day parcel delivery\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apiweb.mile.app/api/v4/order-type")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Express Delivery\",\n \"code\": \"EXP\",\n \"description\": \"Same-day parcel delivery\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/order-type")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Express Delivery\",\n \"code\": \"EXP\",\n \"description\": \"Same-day parcel delivery\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Order Type created",
"data": {
"_id": "6710a2f4c1d2e3f4a5b6c7d8",
"name": "Express Delivery",
"code": "EXP",
"description": "Same-day parcel delivery",
"schemaVersion": 1,
"state": "draft",
"draftRevision": 1,
"hasUnpublishedChanges": true,
"publishedVersion": null,
"publishedAt": null,
"publishedBy": null,
"fields": [
{
"id": "orderNo",
"title": "Order number",
"type": "string",
"required": true,
"unique": true,
"show": true
},
{
"id": "customerName",
"title": "Customer name",
"type": "string",
"required": false,
"show": true
},
{
"id": "weight",
"title": "Weight (kg)",
"type": "number",
"required": false,
"show": true,
"min": 0
}
],
"statuses": [
{
"id": "new",
"label": "New",
"category": "new",
"order": 1,
"color": "#6C757D"
},
{
"id": "onDelivery",
"label": "On delivery",
"category": "inProgress",
"order": 2
},
{
"id": "completed",
"label": "Completed",
"category": "completed",
"order": 3
},
{
"id": "cancelled",
"label": "Cancelled",
"category": "completed",
"order": 4
}
],
"configuration": {
"uniqueBy": [
"orderNo"
],
"cancelStatusId": "cancelled"
},
"orderSteps": [
{
"id": "start",
"type": "string",
"title": "Order created",
"position": {
"x": 0,
"y": 0
},
"event": "onOrderCreated",
"next": {
"next": [
"pickup"
]
}
},
{
"id": "pickup",
"type": "string",
"title": "Pickup",
"position": {
"x": 240,
"y": 0
},
"taskTypeId": "66f1b2c3d4e5f6a7b8c9d0e1",
"assignee": {
"mode": "unassigned"
},
"hub": {
"mode": "order"
},
"quantity": {
"mode": "perOrder"
},
"taskData": [
{
"target": "title",
"source": {
"ref": "$order.values.orderNo"
}
}
],
"saveToOrder": [],
"next": {
"next": [
"done"
]
}
},
{
"id": "done",
"type": "string",
"title": "Finish",
"position": {
"x": 480,
"y": 0
},
"statusId": "completed"
}
],
"canvas": {
"viewport": {
"x": 0,
"y": 0,
"zoom": 1
}
},
"createdTime": "2026-10-01T02:00:00.000+00:00",
"createdBy": "[email protected]",
"updatedTime": "2026-10-07T03:15:22.000+00:00",
"updatedBy": "[email protected]"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Authorizations
Use a valid Bearer token to authenticate.
Body
Name of the order type, unique in the organization. Max 100 characters.
Example: Express Delivery
Short code, 1-10 uppercase letters or digits, unique in the organization. Cannot change once the order type has orders.
Example: EXP
List of order fields. The first field is the order number: it must be type text or number, and it is always required and unique within the order type.
Each field: id (letters, digits, _, -), title, type, and optional description, required, show, unique, default, archived.
type is one of text, number, option, date, dateTime, time, phoneNumber, geolocation, reference, lineItems, user, boolean. Type-specific keys: maxLength (text, phoneNumber), min/max (number, date, dateTime, time), options (option, list of unique strings), reference (reference), columns (lineItems).
List of order statuses. Each status: id, label, category, order (integer), and optional color, publicLabel, viewAccess ({ "roles": [roleId] }, empty means every role).
category is one of new, inProgress, completed. Exactly one status must be new and at least one must be completed before the order type can be published.
Order type configuration: cancelStatusId (a status of category completed used by Cancel order; null when cancelling is not allowed) and uniqueBy (derived from the first field on save).
The order steps graph, at most 200 steps. Every step has id (lowercase letters, digits and -, max 40 characters), type, title (max 80 characters), position ({ x, y }) and next (port name to list of step ids; not used on finishOrder).
Step type:
trigger:eventisonOrderCreatedoronTaskFinished. ForonTaskFinishedalsotaskTypeId(the task type, flowId, whose finished tasks create orders),onlyIf,quantity(modeperTaskorperRow) andmapping.createTask:taskTypeId(task type, flowId),assignee(modeunassigned,userorfield),hub(modeorderorfixed),quantity(modeperOrderorperRow),taskData,saveToOrder,retry(maxAttempts1-10).condition:rules(max 20 rules, max 20 conditions each; operatorseq,neq,gt,gte,lt,lte,contains,isEmpty). Each rule is a portrule:.updateOrder:set(mapping rows) andstatus(modefixedormap).finishOrder:statusId.callWebhook:request(url,methodPOSTorPUT,headers,timeoutSec1-30,bodywithmodeorderortemplate) andsaveResponse. Portssuccessandfailed. Secret header values are never returned (value: null,hasValue: true). Mapping rows (max 50) are{ target, source }; a source is{ "value": ... }or{ "ref": "$..." }.