curl --request POST \
--url https://apiweb.mile.app/api/v4/data \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dataId": "OutletAdi",
"dataTypeId": "63f854cff2bd7b342a098962",
"hubId": "63c63ab1b6972d3150348172",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClose": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": true,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00"
}
'import requests
url = "https://apiweb.mile.app/api/v4/data"
payload = {
"dataId": "OutletAdi",
"dataTypeId": "63f854cff2bd7b342a098962",
"hubId": "63c63ab1b6972d3150348172",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClose": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": True,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00"
}
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({
dataId: 'OutletAdi',
dataTypeId: '63f854cff2bd7b342a098962',
hubId: '63c63ab1b6972d3150348172',
outletName: 'Cabang Jakarta Pusat',
outletHours: 12,
outletType: 'minimarket',
outletOpen: '09:00',
outletClose: '17:00',
outletContractExpired: '2023-02-02',
outletOpenInWeekend: true,
outletGeolocation: '-6.171702325136309,106.81775093078615',
outletPhoneNumber: '+62 123 456 789',
outletCloseOrder: '2023-02-02 17:00:00'
})
};
fetch('https://apiweb.mile.app/api/v4/data', 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/data",
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([
'dataId' => 'OutletAdi',
'dataTypeId' => '63f854cff2bd7b342a098962',
'hubId' => '63c63ab1b6972d3150348172',
'outletName' => 'Cabang Jakarta Pusat',
'outletHours' => 12,
'outletType' => 'minimarket',
'outletOpen' => '09:00',
'outletClose' => '17:00',
'outletContractExpired' => '2023-02-02',
'outletOpenInWeekend' => true,
'outletGeolocation' => '-6.171702325136309,106.81775093078615',
'outletPhoneNumber' => '+62 123 456 789',
'outletCloseOrder' => '2023-02-02 17:00:00'
]),
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/data"
payload := strings.NewReader("{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\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/data")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/data")
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 \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"_id": "6aec2e6974e959b1f2094655",
"dataTypeId": "6abcadb6a138a6318d023ec5",
"hubId": "65c1f68ea735b522d370ea25",
"dataId": "OUT-0012",
"outletName": "Toko Sumber Rejeki",
"channel": "retail",
"region": "6abcadb6a138a6318d02a001",
"limitUser": [
"all"
],
"organizationId": "65c1f4eeca7c4816d94587b2",
"createdBy": "admin@example.com",
"createdTime": "2026-11-05 07:21:13",
"updatedTime": "2026-11-05 07:21:13",
"data_type": {
"_id": "6abcadb6a138a6318d023ec5",
"name": "Outlet"
}
},
"alsoCreated": [
{
"hubId": "68dc01a7094228379a0d7511",
"_id": "6aec2e6974e959b1f2094700"
}
],
"alsoFailed": [
{
"hubId": "68dc01a7094228379a0d7512",
"message": "Outlet Code OUT-0012 is already used."
}
]
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Create data
Creates one record. Send dataTypeId, hubId, dataId and the field values as top-level keys.
Also create in. alsoCreateIn (up to 20 hub ids) creates an independent copy of the record in each of those hubs after the first, each through the same checks. The response adds alsoCreated (hubId and _id of each copy) and alsoFailed (hubId and message, for example a Title already used in that hub). A failed copy does not undo the others.
Extension records. For a Master Data extension type, send entityId (the user, hub, vehicle or role _id) instead of a Title. One record per entity, or per entity and hub for a per-hub extension (failedCode data-041 for a second one).
One hub per record. A record belongs to one hub, hubId (a string). A hub list in the body collapses to its first hub. A data type with commonData true has no hub, and sending hubId for it is refused with failedCode data-032.
The Title. dataId is the record’s Title and key, unique within its data type and hub. On a v4-only type it may contain spaces between words; on a v3-compatible type only letters, digits, - and _.
Field rules. On a v4-only data type the v4 field rules apply: validations, unique and uniqueTogether (per hub), multiOption, boolean and relation values (a belongsTo field takes the target record _id, a belongsToMany field a list of ids). On a v3-compatible type, the v3 rules apply. Keys that are not fields of the data type are refused. While the record’s data type is being prepared or registering unique values, writes answer 409 with failedCode dtype-036.
Requires permission add/data.
curl --request POST \
--url https://apiweb.mile.app/api/v4/data \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dataId": "OutletAdi",
"dataTypeId": "63f854cff2bd7b342a098962",
"hubId": "63c63ab1b6972d3150348172",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClose": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": true,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00"
}
'import requests
url = "https://apiweb.mile.app/api/v4/data"
payload = {
"dataId": "OutletAdi",
"dataTypeId": "63f854cff2bd7b342a098962",
"hubId": "63c63ab1b6972d3150348172",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClose": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": True,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00"
}
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({
dataId: 'OutletAdi',
dataTypeId: '63f854cff2bd7b342a098962',
hubId: '63c63ab1b6972d3150348172',
outletName: 'Cabang Jakarta Pusat',
outletHours: 12,
outletType: 'minimarket',
outletOpen: '09:00',
outletClose: '17:00',
outletContractExpired: '2023-02-02',
outletOpenInWeekend: true,
outletGeolocation: '-6.171702325136309,106.81775093078615',
outletPhoneNumber: '+62 123 456 789',
outletCloseOrder: '2023-02-02 17:00:00'
})
};
fetch('https://apiweb.mile.app/api/v4/data', 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/data",
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([
'dataId' => 'OutletAdi',
'dataTypeId' => '63f854cff2bd7b342a098962',
'hubId' => '63c63ab1b6972d3150348172',
'outletName' => 'Cabang Jakarta Pusat',
'outletHours' => 12,
'outletType' => 'minimarket',
'outletOpen' => '09:00',
'outletClose' => '17:00',
'outletContractExpired' => '2023-02-02',
'outletOpenInWeekend' => true,
'outletGeolocation' => '-6.171702325136309,106.81775093078615',
'outletPhoneNumber' => '+62 123 456 789',
'outletCloseOrder' => '2023-02-02 17:00:00'
]),
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/data"
payload := strings.NewReader("{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\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/data")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/data")
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 \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"_id": "6aec2e6974e959b1f2094655",
"dataTypeId": "6abcadb6a138a6318d023ec5",
"hubId": "65c1f68ea735b522d370ea25",
"dataId": "OUT-0012",
"outletName": "Toko Sumber Rejeki",
"channel": "retail",
"region": "6abcadb6a138a6318d02a001",
"limitUser": [
"all"
],
"organizationId": "65c1f4eeca7c4816d94587b2",
"createdBy": "admin@example.com",
"createdTime": "2026-11-05 07:21:13",
"updatedTime": "2026-11-05 07:21:13",
"data_type": {
"_id": "6abcadb6a138a6318d023ec5",
"name": "Outlet"
}
},
"alsoCreated": [
{
"hubId": "68dc01a7094228379a0d7511",
"_id": "6aec2e6974e959b1f2094700"
}
],
"alsoFailed": [
{
"hubId": "68dc01a7094228379a0d7512",
"message": "Outlet Code OUT-0012 is already used."
}
]
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Body
The identifier of data type.
Use GET /data-types API to get the list of Data Type IDs.
Example: 63db2fb476bc679c540369c4
The dynamic field, outlet name. Use GET /data-types API to get detail fields of data source.
Example: Cabang Jakarta Pusat
The dynamic field, outlet hours. Use GET /data-types API to get detail fields of data source.
Example: 12
The dynamic field, outlet type. Use GET /data-types API to get detail fields of data source.
Example: minimarket
The dynamic field, outlet open. Use GET /data-types API to get detail fields of data source.
Example: 09:00
The dynamic field, outlet closed. Use GET /data-types API to get detail fields of data source.
Example: 17:00
The dynamic field, outlet contract expired. Use GET /data-types API to get detail fields of data source.
Example: 2023-02-02
The dynamic field, outlet open in weekend. Use GET /data-types API to get detail fields of data source.
Example: true
The dynamic field, outlet geolocation. Use GET /data-types API to get detail fields of data source.
Example: -6.171702325136309,106.81775093078615
Response
Created
The response is of type object.