curl --request POST \
--url https://api.ugps.io/api/alerts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alertTriggerId": "<string>",
"name": "<string>",
"assets": [
"<string>"
],
"users": [
"<string>"
],
"speedLimit": 123,
"pushUsers": [
"<string>"
],
"socketUsers": [
"<string>"
],
"emails": [
"jsmith@example.com"
],
"phones": [
"<string>"
],
"state": true,
"description": "<string>",
"minDuration": 123
}
'import requests
url = "https://api.ugps.io/api/alerts"
payload = {
"alertTriggerId": "<string>",
"name": "<string>",
"assets": ["<string>"],
"users": ["<string>"],
"speedLimit": 123,
"pushUsers": ["<string>"],
"socketUsers": ["<string>"],
"emails": ["jsmith@example.com"],
"phones": ["<string>"],
"state": True,
"description": "<string>",
"minDuration": 123
}
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({
alertTriggerId: '<string>',
name: '<string>',
assets: ['<string>'],
users: ['<string>'],
speedLimit: 123,
pushUsers: ['<string>'],
socketUsers: ['<string>'],
emails: ['jsmith@example.com'],
phones: ['<string>'],
state: true,
description: '<string>',
minDuration: 123
})
};
fetch('https://api.ugps.io/api/alerts', 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/alerts",
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([
'alertTriggerId' => '<string>',
'name' => '<string>',
'assets' => [
'<string>'
],
'users' => [
'<string>'
],
'speedLimit' => 123,
'pushUsers' => [
'<string>'
],
'socketUsers' => [
'<string>'
],
'emails' => [
'jsmith@example.com'
],
'phones' => [
'<string>'
],
'state' => true,
'description' => '<string>',
'minDuration' => 123
]),
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://api.ugps.io/api/alerts"
payload := strings.NewReader("{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"pushUsers\": [\n \"<string>\"\n ],\n \"socketUsers\": [\n \"<string>\"\n ],\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\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://api.ugps.io/api/alerts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"pushUsers\": [\n \"<string>\"\n ],\n \"socketUsers\": [\n \"<string>\"\n ],\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/alerts")
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 \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"pushUsers\": [\n \"<string>\"\n ],\n \"socketUsers\": [\n \"<string>\"\n ],\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"alertTriggerId": "<string>",
"name": "<string>",
"assets": [
"<string>"
],
"users": [
"<string>"
],
"clientId": "<string>",
"pushUsers": [
"<string>"
],
"socketUsers": [
"<string>"
],
"emails": [
"jsmith@example.com"
],
"phones": [
"<string>"
],
"typeNotification": {
"email": true,
"whatsapp": true,
"app": true,
"browser": true
},
"state": true,
"description": "<string>",
"speedLimit": 123,
"minDuration": 123,
"geofences": [
"<string>"
],
"geofenceActivationType": "entrance",
"calculatorId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"message": "Error interno del servidor"
}Crear una nueva alerta
Crea una nueva alerta. El payload se valida según el tipo de trigger (alertTriggerId):
- speed_limit: Requiere speedLimit (km/h); minDuration opcional. Crea calculator en Flespi.
- geofence: Requiere geofences (array de ObjectIds, al menos una) y geofenceActivationType (entrance, exit o both).
- ignition y lost_connection: Solo campos base; no requieren campos adicionales. Los canales de notificación (typeNotification) exigen que los arrays emails/phones/users no estén vacíos cuando el canal está activo.
curl --request POST \
--url https://api.ugps.io/api/alerts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alertTriggerId": "<string>",
"name": "<string>",
"assets": [
"<string>"
],
"users": [
"<string>"
],
"speedLimit": 123,
"pushUsers": [
"<string>"
],
"socketUsers": [
"<string>"
],
"emails": [
"jsmith@example.com"
],
"phones": [
"<string>"
],
"state": true,
"description": "<string>",
"minDuration": 123
}
'import requests
url = "https://api.ugps.io/api/alerts"
payload = {
"alertTriggerId": "<string>",
"name": "<string>",
"assets": ["<string>"],
"users": ["<string>"],
"speedLimit": 123,
"pushUsers": ["<string>"],
"socketUsers": ["<string>"],
"emails": ["jsmith@example.com"],
"phones": ["<string>"],
"state": True,
"description": "<string>",
"minDuration": 123
}
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({
alertTriggerId: '<string>',
name: '<string>',
assets: ['<string>'],
users: ['<string>'],
speedLimit: 123,
pushUsers: ['<string>'],
socketUsers: ['<string>'],
emails: ['jsmith@example.com'],
phones: ['<string>'],
state: true,
description: '<string>',
minDuration: 123
})
};
fetch('https://api.ugps.io/api/alerts', 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/alerts",
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([
'alertTriggerId' => '<string>',
'name' => '<string>',
'assets' => [
'<string>'
],
'users' => [
'<string>'
],
'speedLimit' => 123,
'pushUsers' => [
'<string>'
],
'socketUsers' => [
'<string>'
],
'emails' => [
'jsmith@example.com'
],
'phones' => [
'<string>'
],
'state' => true,
'description' => '<string>',
'minDuration' => 123
]),
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://api.ugps.io/api/alerts"
payload := strings.NewReader("{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"pushUsers\": [\n \"<string>\"\n ],\n \"socketUsers\": [\n \"<string>\"\n ],\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\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://api.ugps.io/api/alerts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"pushUsers\": [\n \"<string>\"\n ],\n \"socketUsers\": [\n \"<string>\"\n ],\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/alerts")
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 \"alertTriggerId\": \"<string>\",\n \"name\": \"<string>\",\n \"assets\": [\n \"<string>\"\n ],\n \"users\": [\n \"<string>\"\n ],\n \"speedLimit\": 123,\n \"pushUsers\": [\n \"<string>\"\n ],\n \"socketUsers\": [\n \"<string>\"\n ],\n \"emails\": [\n \"jsmith@example.com\"\n ],\n \"phones\": [\n \"<string>\"\n ],\n \"state\": true,\n \"description\": \"<string>\",\n \"minDuration\": 123\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"alertTriggerId": "<string>",
"name": "<string>",
"assets": [
"<string>"
],
"users": [
"<string>"
],
"clientId": "<string>",
"pushUsers": [
"<string>"
],
"socketUsers": [
"<string>"
],
"emails": [
"jsmith@example.com"
],
"phones": [
"<string>"
],
"typeNotification": {
"email": true,
"whatsapp": true,
"app": true,
"browser": true
},
"state": true,
"description": "<string>",
"speedLimit": 123,
"minDuration": 123,
"geofences": [
"<string>"
],
"geofenceActivationType": "entrance",
"calculatorId": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"message": "Error interno del servidor"
}Authorizations
Body
- Option 1
- Option 2
- Option 3
- Option 4
Payload de creación/edición de alerta según tipo (discriminado por alertTriggerId). La validación exige los campos del tipo correspondiente.
IDs de los usuarios de la alerta que reciben push (App móvil), elegidos por usuario. Opcional: sin la lista, push va a todos los users si typeNotification.app es true. Cada id tiene que estar en users (si no, 400). Una edición que trae users sin esta lista conserva lo elegido para los que siguen y suma a los nuevos.
Teléfonos para notificaciones (whatsapp). Cada uno se guarda con + y su código de país (954095508 y +56 9 5409 5508 quedan +56954095508) y una sola vez. Sin +, solo se aceptan números de Chile: 9 dígitos, o 11 que empiezan con 56. Con +56, el número lleva los 9 dígitos de Chile. Un teléfono vacío o inválido se rechaza con 400. Si typeNotification.whatsapp es true, es obligatorio y debe tener al menos un elemento.

