Generate location history token
curl --request POST \
--url https://apiweb.mile.app/api/v3/location-history/generate-token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "example@mile.app",
"date": "2024-02-20"
}
'import requests
url = "https://apiweb.mile.app/api/v3/location-history/generate-token"
payload = {
"email": "example@mile.app",
"date": "2024-02-20"
}
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({email: 'example@mile.app', date: '2024-02-20'})
};
fetch('https://apiweb.mile.app/api/v3/location-history/generate-token', 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/location-history/generate-token",
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([
'email' => 'example@mile.app',
'date' => '2024-02-20'
]),
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/location-history/generate-token"
payload := strings.NewReader("{\n \"email\": \"example@mile.app\",\n \"date\": \"2024-02-20\"\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/location-history/generate-token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"example@mile.app\",\n \"date\": \"2024-02-20\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/location-history/generate-token")
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 \"email\": \"example@mile.app\",\n \"date\": \"2024-02-20\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success.",
"token": "eyJkYXRhIjoiZXlKcGRpSTZJa1JQYkhKTVFraGtNMFpKV21SRmQxZHFkSEZWTkVFOVBTSXNJblpoYkhWbElqb2lheXRMVVc5aFEzRTJNR28zWjJ0UE1rbFdRa1pUYVU0eU9VbElTa2huVFZOT05WUTVMMko0UkZSVVVWQXlSbXRUVGxOcWJWWmpVVTA1SzBSS1FqTm5SRkppYWl0MWMzSXlWMEZSYVZCbFMydHdlbE15TlhwUVkyeExSa053ZUhoUk5FNTFlWFZIYzNwWVJtWjFNVWRKWm1WSmRWUmliRWs0Tm1KSGFWSXpRVTFpUkZwMWNqRlpNVWNyYVZkNmNXUkhkMU5GTVRaRVIzTlJlakZPTkd0amNFOTRhbEZxTVVKallXWTBQU0lzSW0xaFl5STZJamczTXpBeE9UVTFNalUzTkRGbFlUbGlOMkZsT0dOaU1EWXhZVEkzTWpVek9EQXdObVU0WW1FMU5HTXhOelJrWkdFMk1tSXlZV1JqT1RZeFptUXpPR0lpTENKMFlXY2lPaUlpZlE9PSIsImV4cGlyYXRpb24iOiIyMDI0LTAyLTI3VDA5OjU5OjMzLjA1OTA0OVoifQ=="
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Location History
Generate location history token
This endpoint is used to generate tracking token, which are utilized by guest users or public users to view a user’s last known location based on the specified date. These token expire 7 days after the creation of the tracking token.
POST
/
location-history
/
generate-token
Generate location history token
curl --request POST \
--url https://apiweb.mile.app/api/v3/location-history/generate-token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "example@mile.app",
"date": "2024-02-20"
}
'import requests
url = "https://apiweb.mile.app/api/v3/location-history/generate-token"
payload = {
"email": "example@mile.app",
"date": "2024-02-20"
}
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({email: 'example@mile.app', date: '2024-02-20'})
};
fetch('https://apiweb.mile.app/api/v3/location-history/generate-token', 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/location-history/generate-token",
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([
'email' => 'example@mile.app',
'date' => '2024-02-20'
]),
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/location-history/generate-token"
payload := strings.NewReader("{\n \"email\": \"example@mile.app\",\n \"date\": \"2024-02-20\"\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/location-history/generate-token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"example@mile.app\",\n \"date\": \"2024-02-20\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/location-history/generate-token")
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 \"email\": \"example@mile.app\",\n \"date\": \"2024-02-20\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success.",
"token": "eyJkYXRhIjoiZXlKcGRpSTZJa1JQYkhKTVFraGtNMFpKV21SRmQxZHFkSEZWTkVFOVBTSXNJblpoYkhWbElqb2lheXRMVVc5aFEzRTJNR28zWjJ0UE1rbFdRa1pUYVU0eU9VbElTa2huVFZOT05WUTVMMko0UkZSVVVWQXlSbXRUVGxOcWJWWmpVVTA1SzBSS1FqTm5SRkppYWl0MWMzSXlWMEZSYVZCbFMydHdlbE15TlhwUVkyeExSa053ZUhoUk5FNTFlWFZIYzNwWVJtWjFNVWRKWm1WSmRWUmliRWs0Tm1KSGFWSXpRVTFpUkZwMWNqRlpNVWNyYVZkNmNXUkhkMU5GTVRaRVIzTlJlakZPTkd0amNFOTRhbEZxTVVKallXWTBQU0lzSW0xaFl5STZJamczTXpBeE9UVTFNalUzTkRGbFlUbGlOMkZsT0dOaU1EWXhZVEkzTWpVek9EQXdObVU0WW1FMU5HTXhOelJrWkdFMk1tSXlZV1JqT1RZeFptUXpPR0lpTENKMFlXY2lPaUlpZlE9PSIsImV4cGlyYXRpb24iOiIyMDI0LTAyLTI3VDA5OjU5OjMzLjA1OTA0OVoifQ=="
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Authorizations
Use a valid Bearer token to authenticate.
Body
application/json
⌘I