Generate insight report
curl --request POST \
--url https://apiweb.mile.app/api/v3/ai-insight/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"objectId": "<string>",
"startDate": "<string>",
"endDate": "<string>",
"objectType": "flow",
"timezone": "<string>",
"name": "<string>"
}
'import requests
url = "https://apiweb.mile.app/api/v3/ai-insight/generate"
payload = {
"objectId": "<string>",
"startDate": "<string>",
"endDate": "<string>",
"objectType": "flow",
"timezone": "<string>",
"name": "<string>"
}
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({
objectId: '<string>',
startDate: '<string>',
endDate: '<string>',
objectType: 'flow',
timezone: '<string>',
name: '<string>'
})
};
fetch('https://apiweb.mile.app/api/v3/ai-insight/generate', 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/v3/ai-insight/generate",
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([
'objectId' => '<string>',
'startDate' => '<string>',
'endDate' => '<string>',
'objectType' => 'flow',
'timezone' => '<string>',
'name' => '<string>'
]),
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/v3/ai-insight/generate"
payload := strings.NewReader("{\n \"objectId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"objectType\": \"flow\",\n \"timezone\": \"<string>\",\n \"name\": \"<string>\"\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/v3/ai-insight/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"objectId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"objectType\": \"flow\",\n \"timezone\": \"<string>\",\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/ai-insight/generate")
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 \"objectId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"objectType\": \"flow\",\n \"timezone\": \"<string>\",\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"data": {
"resultId": "670fa1b2c3d4e5f6a7b8c9d0",
"status": "pending"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}Insight
Generate insight report
Starts an insight report for one flow and date range. The report is written in the background: the response returns its resultId with status: pending; poll GET /ai-insight/results/{id} until it is done or failed.
The flow needs a saved context, and the range needs enough tasks (50 by default), otherwise 400 tells you how many were found. endDate can’t be before startDate. Dates are read in timezone (an IANA name, for example Asia/Jakarta); an unknown or empty timezone means UTC.
Requires the view/ai-insight permission.
POST
/
ai-insight
/
generate
Generate insight report
curl --request POST \
--url https://apiweb.mile.app/api/v3/ai-insight/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"objectId": "<string>",
"startDate": "<string>",
"endDate": "<string>",
"objectType": "flow",
"timezone": "<string>",
"name": "<string>"
}
'import requests
url = "https://apiweb.mile.app/api/v3/ai-insight/generate"
payload = {
"objectId": "<string>",
"startDate": "<string>",
"endDate": "<string>",
"objectType": "flow",
"timezone": "<string>",
"name": "<string>"
}
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({
objectId: '<string>',
startDate: '<string>',
endDate: '<string>',
objectType: 'flow',
timezone: '<string>',
name: '<string>'
})
};
fetch('https://apiweb.mile.app/api/v3/ai-insight/generate', 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/v3/ai-insight/generate",
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([
'objectId' => '<string>',
'startDate' => '<string>',
'endDate' => '<string>',
'objectType' => 'flow',
'timezone' => '<string>',
'name' => '<string>'
]),
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/v3/ai-insight/generate"
payload := strings.NewReader("{\n \"objectId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"objectType\": \"flow\",\n \"timezone\": \"<string>\",\n \"name\": \"<string>\"\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/v3/ai-insight/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"objectId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"objectType\": \"flow\",\n \"timezone\": \"<string>\",\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/ai-insight/generate")
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 \"objectId\": \"<string>\",\n \"startDate\": \"<string>\",\n \"endDate\": \"<string>\",\n \"objectType\": \"flow\",\n \"timezone\": \"<string>\",\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"data": {
"resultId": "670fa1b2c3d4e5f6a7b8c9d0",
"status": "pending"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}Body
application/json
Response
Success
The response is of type object.