Copy v3 data type to v4
curl --request POST \
--url https://apiweb.mile.app/api/v4/data-type/{dataTypeId}/copy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "OutletDetail (V4)",
"withRecords": true
}
'import requests
url = "https://apiweb.mile.app/api/v4/data-type/{dataTypeId}/copy"
payload = {
"name": "OutletDetail (V4)",
"withRecords": True
}
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: 'OutletDetail (V4)', withRecords: true})
};
fetch('https://apiweb.mile.app/api/v4/data-type/{dataTypeId}/copy', 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-type/{dataTypeId}/copy",
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' => 'OutletDetail (V4)',
'withRecords' => true
]),
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-type/{dataTypeId}/copy"
payload := strings.NewReader("{\n \"name\": \"OutletDetail (V4)\",\n \"withRecords\": true\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-type/{dataTypeId}/copy")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"OutletDetail (V4)\",\n \"withRecords\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/data-type/{dataTypeId}/copy")
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\": \"OutletDetail (V4)\",\n \"withRecords\": true\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data_type": {
"_id": "6710a3c2e4b0a1f2c3d4e5f6",
"name": "OutletDetail (V4)",
"provider": "internal",
"limitUser": false,
"commonData": true,
"fields": [
{
"id": "dataId",
"title": "Data ID",
"type": "string",
"required": true
},
{
"id": "outletName",
"title": "Outlet Name",
"type": "string",
"required": true
}
],
"migration": {
"mode": "copy",
"status": "running",
"total": 1250,
"done": 0,
"failed": 0,
"lastId": null,
"startedAt": "2026-10-16T08:30:00+00:00",
"heartbeatAt": "2026-10-16T08:30:00+00:00",
"finishedAt": null,
"sourceDataTypeId": "640a45dd089dc95a0a09ef14"
}
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Data type is being migrated."
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Data Type
Copy v3 data type to v4
Create a new v4 data type from an existing v3 data type. The v3 original is left unchanged. Its primaryKey field becomes the v4 title field, and limitUser and commonData are kept.
When withRecords is true (default) the records are copied in the background; follow progress in the migration object of the new data type (status is running, then ready). With no records to copy, status is ready at once.
Refused when the source is already a v4 data type, a migration of it is still running, or an import into it is running.
Permission: add/dataType.
Available on /api/v4 only.
POST
/
data-type
/
{dataTypeId}
/
copy
Copy v3 data type to v4
curl --request POST \
--url https://apiweb.mile.app/api/v4/data-type/{dataTypeId}/copy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "OutletDetail (V4)",
"withRecords": true
}
'import requests
url = "https://apiweb.mile.app/api/v4/data-type/{dataTypeId}/copy"
payload = {
"name": "OutletDetail (V4)",
"withRecords": True
}
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: 'OutletDetail (V4)', withRecords: true})
};
fetch('https://apiweb.mile.app/api/v4/data-type/{dataTypeId}/copy', 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-type/{dataTypeId}/copy",
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' => 'OutletDetail (V4)',
'withRecords' => true
]),
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-type/{dataTypeId}/copy"
payload := strings.NewReader("{\n \"name\": \"OutletDetail (V4)\",\n \"withRecords\": true\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-type/{dataTypeId}/copy")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"OutletDetail (V4)\",\n \"withRecords\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/data-type/{dataTypeId}/copy")
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\": \"OutletDetail (V4)\",\n \"withRecords\": true\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data_type": {
"_id": "6710a3c2e4b0a1f2c3d4e5f6",
"name": "OutletDetail (V4)",
"provider": "internal",
"limitUser": false,
"commonData": true,
"fields": [
{
"id": "dataId",
"title": "Data ID",
"type": "string",
"required": true
},
{
"id": "outletName",
"title": "Outlet Name",
"type": "string",
"required": true
}
],
"migration": {
"mode": "copy",
"status": "running",
"total": 1250,
"done": 0,
"failed": 0,
"lastId": null,
"startedAt": "2026-10-16T08:30:00+00:00",
"heartbeatAt": "2026-10-16T08:30:00+00:00",
"finishedAt": null,
"sourceDataTypeId": "640a45dd089dc95a0a09ef14"
}
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Data type is being migrated."
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Authorizations
Use a valid Bearer token to authenticate.
Path Parameters
Unique identifier of the data type, generated by the system.
Example: 640a45dd089dc95a0a09ef14
Body
application/json