Skip to main content
GET
/
events
/
user
/
entity
/
{entityId}
/
has-events
¿Tiene eventos? (por entidad)
curl --request GET \
  --url http://api.gu1.ai/events/user/entity/{entityId}/has-events \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "hasEvents": true,
  "entityId": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.gu1.ai/llms.txt

Use this file to discover all available pages before exploring further.

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.

Rendimiento

Pensado para baja latencia:
AspectoComportamiento
ConsultasDos viajes: entidad por UUID (PK) + una sonda LIMIT 1 en user_events
No haceCOUNT(*), ORDER BY, paginación ni devolver columnas completas de eventos/metadata
Índicesorganization_id + entity_id usa idx_user_events_organization_entity_id; entity_external_id y tax_id tienen índices dedicados en sus ramas del OR
La latencia típica la dominan red y autenticación, no escanear historiales grandes.

Endpoint

GET https://api.gu1.ai/events/user/entity/{entityId}/has-events

Autenticación

Requiere API key válida en el header Authorization:
Authorization: Bearer YOUR_API_KEY

Parámetros de ruta

entityId
string
required
UUID de la entidad a consultar

Respuesta

success
boolean
Indica si la solicitud fue exitosa
hasEvents
boolean
true si existe al menos un evento vinculado (mismo alcance que listar por entidad); si no, false
entityId
string
UUID de la entidad confirmada

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

EstadoCódigoCuándo
404ENTITY_NOT_FOUNDLa entidad no existe en la org o está eliminada (soft delete)
401API key ausente o inválida
403Permisos insuficientes (events:read)

Ejemplos

curl "https://api.gu1.ai/events/user/entity/550e8400-e29b-41d4-a716-446655440000/has-events" \
  -H "Authorization: Bearer YOUR_API_KEY"
const entityId = '550e8400-e29b-41d4-a716-446655440000';
const res = await fetch(
  `https://api.gu1.ai/events/user/entity/${entityId}/has-events`,
  { headers: { Authorization: `Bearer ${API_KEY}` } }
);
const { hasEvents } = 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 true

Listar eventos

Consultar con filtros

Estadísticas

Conteos por tipo de evento

Overview

Overview de eventos de usuario