¿Tiene eventos? (por entidad)
curl --request GET \
--url http://api.gu1.ai/events/user/entity/has-events \
--header 'Authorization: Bearer <token>'import requests
url = "http://api.gu1.ai/events/user/entity/has-events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://api.gu1.ai/events/user/entity/has-events', 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 => "http://api.gu1.ai/events/user/entity/has-events",
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 := "http://api.gu1.ai/events/user/entity/has-events"
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("http://api.gu1.ai/events/user/entity/has-events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/events/user/entity/has-events")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"hasEvents": true,
"entityId": "<string>"
}Referencia API
¿Tiene eventos? (por entidad)
Comprobación rápida booleana de si una entidad tiene eventos de usuario vinculados — mismo alcance que listar por entidad, sin devolver filas ni totales.
GET
/
events
/
user
/
entity
/
has-events
¿Tiene eventos? (por entidad)
curl --request GET \
--url http://api.gu1.ai/events/user/entity/has-events \
--header 'Authorization: Bearer <token>'import requests
url = "http://api.gu1.ai/events/user/entity/has-events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://api.gu1.ai/events/user/entity/has-events', 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 => "http://api.gu1.ai/events/user/entity/has-events",
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 := "http://api.gu1.ai/events/user/entity/has-events"
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("http://api.gu1.ai/events/user/entity/has-events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/events/user/entity/has-events")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"hasEvents": true,
"entityId": "<string>"
}Descripción general
Usá este endpoint cuando solo necesitás saber si una entidad tiene eventos de usuario (badges en UI, visibilidad de pestañas, prechecks), no la línea de tiempo completa. Usa el mismo criterio de vinculación que Listar por entidad:entity_id, entity_external_id o tax_id dentro de tu organización.
Preferí este endpoint frente a listar con
limit=1 cuando solo necesitás sí/no — evita COUNT(*), ordenamiento y serializar payloads de eventos.Identificadores de entidad: podés consultar por query param sin conocer el UUID interno. Prioridad de búsqueda:
entity_id → entity_external_id → tax_id (si mandás más de uno, gana el de mayor prioridad). Para tax_id la comparación en DB normaliza caracteres no alfanuméricos (p. ej. 20-24245549-6 y 20242455496).La ruta legacy GET …/entity/{entityId}/has-events sigue disponible cuando ya tenés el UUID.Rendimiento
Pensado para baja latencia:| Aspecto | Comportamiento |
|---|---|
| Consultas | Dos viajes: lookup de entidad + una sonda LIMIT 1 en user_events |
| No hace | COUNT(*), ORDER BY, paginación ni devolver columnas completas de eventos/metadata |
| Índices | organization_id + entity_id usa idx_user_events_organization_entity_id; entity_external_id y tax_id tienen índices dedicados en sus ramas del OR |
Endpoint
GET https://api.gu1.ai/events/user/entity/has-events
Autenticación
Requiere API key válida en el header Authorization:Authorization: Bearer YOUR_API_KEY
Parámetros de consulta
Al menos uno es obligatorio. Si enviás varios, la prioridad esentity_id → entity_external_id → tax_id.
string
UUID de la entidad (máxima prioridad)Ejemplo:
?entity_id=550e8400-e29b-41d4-a716-446655440000string
Identificador externo de la entidad en tu sistemaEjemplo:
?entity_external_id=user_12345string
Documento fiscal (CUIT/CUIL/CPF/CNPJ, etc.). Comparación exacta y normalizada (solo alfanuméricos)Ejemplo:
?tax_id=20242455496Respuesta
boolean
Indica si la solicitud fue exitosa
boolean
true si existe al menos un evento vinculado (mismo alcance que listar por entidad); si no, falsestring
UUID interno de la entidad resuelta (útil si consultaste por
entity_external_id o tax_id)Ejemplo — con eventos
{
"success": true,
"hasEvents": true,
"entityId": "550e8400-e29b-41d4-a716-446655440000"
}
Ejemplo — sin eventos
{
"success": true,
"hasEvents": false,
"entityId": "550e8400-e29b-41d4-a716-446655440000"
}
Errores
| Estado | Código | Cuándo |
|---|---|---|
| 400 | — | Falta cualquier identificador de entidad en query |
| 404 | ENTITY_NOT_FOUND | La entidad no existe en la org o está eliminada (soft delete) |
| 401 | — | API key ausente o inválida |
| 403 | — | Permisos insuficientes (events:read) |
Ejemplos
# Por external ID (caso típico sin UUID interno)
curl "https://api.gu1.ai/events/user/entity/has-events?entity_external_id=user_12345" \
-H "Authorization: Bearer YOUR_API_KEY"
# Por tax ID
curl "https://api.gu1.ai/events/user/entity/has-events?tax_id=20242455496" \
-H "Authorization: Bearer YOUR_API_KEY"
# Legacy: por UUID en path
curl "https://api.gu1.ai/events/user/entity/550e8400-e29b-41d4-a716-446655440000/has-events" \
-H "Authorization: Bearer YOUR_API_KEY"
const res = await fetch(
'https://api.gu1.ai/events/user/entity/has-events?entity_external_id=user_12345',
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);
const { hasEvents, entityId } = await res.json();
if (hasEvents) {
const timeline = await fetch(
`https://api.gu1.ai/events/user/entity/${entityId}?limit=50`,
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);
}
Próximos pasos
Listar por entidad
Línea de tiempo completa cuando
hasEvents es trueListar eventos
Consultar con filtros
Estadísticas
Conteos por tipo de evento
Overview
Overview de eventos de usuario
Was this page helpful?