Obtener viajes por Flespi ID
curl --request GET \
--url https://api.ugps.io/api/trips/{flespiId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ugps.io/api/trips/{flespiId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ugps.io/api/trips/{flespiId}', 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://api.ugps.io/api/trips/{flespiId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ugps.io/api/trips/{flespiId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ugps.io/api/trips/{flespiId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/trips/{flespiId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "success",
"data": [
{
"avg_speed": 123,
"begin": 123,
"distance": 123,
"duration": 123,
"end": 123,
"end_battery_level": 123,
"id": "<string>",
"max_speed": 123,
"positions": [
{
"alt": 123,
"dir": 123,
"lat": 123,
"lng": 123,
"speed": 123,
"timestamp": 123
}
],
"route": "<string>",
"start_battery_level": 123,
"timestamp": 123,
"type": "<string>",
"clientId": "<string>",
"assetId": "<string>"
}
]
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "Recurso no encontrado"
}{
"message": "Error interno del servidor"
}Tracking - Viajes
Obtener viajes por Flespi ID
Obtiene los viajes de un dispositivo específico. Si se proporcionan parámetros de fecha, filtra los viajes por el rango especificado.
Formatos de fecha aceptados:
DD/MM/YYYY- Solo fecha (desde las 00:00:00 hasta las 23:59:59 del día)DD/MM/YYYY HH:mm- Fecha con hora y minutos específicosDD/MM/YYYY HH:mm:ss- Fecha con hora, minutos y segundos específicos
Ejemplos:
- Solo fecha:
01/01/2025→ Desde 01/01/2025 00:00:00 hasta 01/01/2025 23:59:59 - Con hora:
01/01/2025 08:30→ Desde 01/01/2025 08:30:00 - Con hora completa:
01/01/2025 08:30:45→ Desde 01/01/2025 08:30:45
Nota: Si no se proporciona hora en el parámetro to, automáticamente se ajusta a las 23:59:59 del día.
GET
/
api
/
trips
/
{flespiId}
Obtener viajes por Flespi ID
curl --request GET \
--url https://api.ugps.io/api/trips/{flespiId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ugps.io/api/trips/{flespiId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ugps.io/api/trips/{flespiId}', 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://api.ugps.io/api/trips/{flespiId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.ugps.io/api/trips/{flespiId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.ugps.io/api/trips/{flespiId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/trips/{flespiId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "success",
"data": [
{
"avg_speed": 123,
"begin": 123,
"distance": 123,
"duration": 123,
"end": 123,
"end_battery_level": 123,
"id": "<string>",
"max_speed": 123,
"positions": [
{
"alt": 123,
"dir": 123,
"lat": 123,
"lng": 123,
"speed": 123,
"timestamp": 123
}
],
"route": "<string>",
"start_battery_level": 123,
"timestamp": 123,
"type": "<string>",
"clientId": "<string>",
"assetId": "<string>"
}
]
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "Recurso no encontrado"
}{
"message": "Error interno del servidor"
}Authorizations
Token de sesión Better Auth o API token (atk_...) en el header Authorization: Bearer <token>. Los JWT legacy ya no son válidos.
Path Parameters
ID del dispositivo en Flespi
Query Parameters
Fecha de inicio. Formatos aceptados - DD/MM/YYYY, DD/MM/YYYY HH:mm, DD/MM/YYYY HH:mm:ss (ejemplo solo fecha: 01/01/2025, con hora: 01/01/2025 08:30)
Fecha de fin. Formatos aceptados - DD/MM/YYYY, DD/MM/YYYY HH:mm, DD/MM/YYYY HH:mm:ss (ejemplo solo fecha: 31/01/2025, con hora: 31/01/2025 17:45)