Listar
curl --request GET \
--url http://api.gu1.ai/events/user \
--header 'Authorization: Bearer <token>'import requests
url = "http://api.gu1.ai/events/user"
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', 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",
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"
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")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/events/user")
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,
"events": [
{
"events[].id": "<string>",
"events[].eventType": "<string>",
"events[].userId": "<string>",
"events[].entityId": "<string>",
"events[].entityExternalId": "<string>",
"events[].taxId": "<string>",
"events[].timestamp": "<string>",
"events[].deviceId": "<string>",
"events[].ipAddress": "<string>",
"events[].country": "<string>",
"events[].isVpn": true,
"events[].isProxy": true,
"events[].metadata": {},
"events[].createdAt": "<string>"
}
],
"pagination": {
"pagination.total": 123,
"pagination.limit": 123,
"pagination.offset": 123,
"pagination.hasMore": true
}
}Referencia API
Listar eventos de usuario
Consulta eventos de usuario con filtros avanzados — para seguimiento de comportamiento de usuarios y detección de fraude en gu1, con ejemplos para list.
GET
/
events
/
user
Listar
curl --request GET \
--url http://api.gu1.ai/events/user \
--header 'Authorization: Bearer <token>'import requests
url = "http://api.gu1.ai/events/user"
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', 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",
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"
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")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/events/user")
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,
"events": [
{
"events[].id": "<string>",
"events[].eventType": "<string>",
"events[].userId": "<string>",
"events[].entityId": "<string>",
"events[].entityExternalId": "<string>",
"events[].taxId": "<string>",
"events[].timestamp": "<string>",
"events[].deviceId": "<string>",
"events[].ipAddress": "<string>",
"events[].country": "<string>",
"events[].isVpn": true,
"events[].isProxy": true,
"events[].metadata": {},
"events[].createdAt": "<string>"
}
],
"pagination": {
"pagination.total": 123,
"pagination.limit": 123,
"pagination.offset": 123,
"pagination.hasMore": true
}
}Resumen
Recupera eventos de usuario con potentes capacidades de filtrado. Usa este endpoint para consultar eventos por usuario, entidad, tipo de evento, rango de fechas y más. Perfecto para construir registros de auditoría, herramientas de investigación de fraude y dashboards de análisis.Lógica OR para IDs de Entidad: Al consultar por identificadores de entidad (
entity_id, entity_external_id, tax_id), el sistema usa lógica OR, devolviendo eventos que coincidan con cualquiera de los identificadores proporcionados.Endpoint
GET https://api.gu1.ai/events/user
Autenticación
Requiere una clave API válida en el encabezado de Authorization:Authorization: Bearer YOUR_API_KEY
Parámetros de Consulta
string
Filtra eventos por identificador de usuarioEjemplo:
?user_id=user_12345string
Filtra eventos por UUID de entidadEjemplo:
?entity_id=550e8400-e29b-41d4-a716-446655440000string
Filtra eventos por identificador externo de entidadEjemplo:
?entity_external_id=user_12345string
Filtra eventos por número de identificación tributariaEjemplo:
?tax_id=20242455496string
Filtra eventos por tipo (ej., LOGIN_SUCCESS, TRANSFER_SUCCESS)Ejemplo:
?event_type=LOGIN_SUCCESSstring
Filtra eventos después de esta fecha (formato ISO 8601)Ejemplo:
?start_date=2026-01-01T00:00:00Zstring
Filtra eventos antes de esta fecha (formato ISO 8601)Ejemplo:
?end_date=2026-01-31T23:59:59Znumber
default:"100"
Número máximo de eventos a devolver por página (máx: 1000)Ejemplo:
?limit=50number
default:"0"
Número de eventos a omitir para paginaciónEjemplo:
?offset=100Respuesta
boolean
Indica si la solicitud fue exitosa
array
Array de objetos de evento ordenados por timestamp (más reciente primero)
string
UUID del evento
string
Tipo de evento
string
Identificador de usuario
string
UUID de entidad
string
Identificador externo de entidad
string
ID tributario
string
Timestamp del evento (ISO 8601)
string
Identificador del dispositivo
string
Dirección IP
string
Código de país
boolean
Bandera de detección de VPN
boolean
Bandera de detección de proxy
object
Metadatos específicos del evento
string
Timestamp de creación del registro
object
Ejemplos
Consulta Básica
curl "https://api.gu1.ai/events/user?entity_external_id=user_12345" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
'https://api.gu1.ai/events/user?entity_external_id=user_12345',
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data.events);
import requests
response = requests.get(
'https://api.gu1.ai/events/user',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={'entity_external_id': 'user_12345'}
)
data = response.json()
print(data['events'])
Filtrar por Tipo de Evento
curl "https://api.gu1.ai/events/user?entity_external_id=user_12345&event_type=LOGIN_SUCCESS" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
'https://api.gu1.ai/events/user?entity_external_id=user_12345&event_type=LOGIN_SUCCESS',
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
import requests
response = requests.get(
'https://api.gu1.ai/events/user',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={
'entity_external_id': 'user_12345',
'event_type': 'LOGIN_SUCCESS'
}
)
Filtrar por Rango de Fechas
curl "https://api.gu1.ai/events/user?entity_external_id=user_12345&start_date=2026-01-01T00:00:00Z&end_date=2026-01-31T23:59:59Z" \
-H "Authorization: Bearer YOUR_API_KEY"
const startDate = new Date('2026-01-01').toISOString();
const endDate = new Date('2026-01-31').toISOString();
const response = await fetch(
`https://api.gu1.ai/events/user?entity_external_id=user_12345&start_date=${startDate}&end_date=${endDate}`,
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
from datetime import datetime
import requests
start_date = datetime(2026, 1, 1).isoformat() + 'Z'
end_date = datetime(2026, 1, 31, 23, 59, 59).isoformat() + 'Z'
response = requests.get(
'https://api.gu1.ai/events/user',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={
'entity_external_id': 'user_12345',
'start_date': start_date,
'end_date': end_date
}
)
Ejemplo de Respuesta
{
"success": true,
"events": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"eventType": "LOGIN_SUCCESS",
"userId": "user_12345",
"entityId": "550e8400-e29b-41d4-a716-446655440000",
"entityExternalId": "user_12345",
"taxId": "20242455496",
"timestamp": "2026-01-30T14:30:00Z",
"deviceId": "840e89e4d46efd67",
"ipAddress": "10.40.64.231",
"country": "AR",
"isVpn": false,
"isProxy": false,
"metadata": {},
"createdAt": "2026-01-30T14:30:00Z"
},
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"eventType": "TRANSFER_SUCCESS",
"userId": "user_12345",
"entityId": "550e8400-e29b-41d4-a716-446655440000",
"entityExternalId": "user_12345",
"taxId": "20242455496",
"timestamp": "2026-01-30T12:15:00Z",
"deviceId": "840e89e4d46efd67",
"ipAddress": "10.40.64.231",
"country": "AR",
"metadata": {
"amount": 5000,
"currency": "ARS",
"destinationAccountId": "0170042640000004234411"
},
"createdAt": "2026-01-30T12:15:00Z"
}
],
"pagination": {
"total": 145,
"limit": 100,
"offset": 0,
"hasMore": true
}
}
Respuestas de Error
400 Bad Request
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid date format"
}
}
401 Unauthorized
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}
403 Forbidden
{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "Insufficient permissions to read events"
}
}
500 Internal Server Error
{
"success": false,
"error": {
"code": "EVENTS_FETCH_FAILED",
"message": "Failed to fetch events"
}
}
Casos de Uso
Registro de Auditoría
Construye un registro de auditoría completo para cumplimiento:async function getAuditTrail(entityExternalId, startDate, endDate) {
const response = await fetch(
`https://api.gu1.ai/events/user?` +
`entity_external_id=${entityExternalId}&` +
`start_date=${startDate}&` +
`end_date=${endDate}&` +
`limit=1000`,
{
headers: { 'Authorization': `Bearer ${API_KEY}` }
}
);
const data = await response.json();
return data.events.map(event => ({
timestamp: event.timestamp,
action: event.eventType,
user: event.userId,
device: event.deviceId,
ipAddress: event.ipAddress
}));
}
Investigación de Fraude
Investiga actividad sospechosa:async function investigateSuspiciousActivity(entityExternalId) {
// Obtiene inicios de sesión fallidos recientes
const failedLogins = await fetch(
`https://api.gu1.ai/events/user?` +
`entity_external_id=${entityExternalId}&` +
`event_type=LOGIN_FAILED&` +
`start_date=${new Date(Date.now() - 86400000).toISOString()}`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
// Obtiene transferencias recientes
const transfers = await fetch(
`https://api.gu1.ai/events/user?` +
`entity_external_id=${entityExternalId}&` +
`event_type=TRANSFER_SUCCESS&` +
`start_date=${new Date(Date.now() - 86400000).toISOString()}`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
return {
failedLogins: (await failedLogins.json()).events,
transfers: (await transfers.json()).events
};
}
Línea de Tiempo de Usuario
Construye una línea de tiempo de actividad de usuario:async function getUserTimeline(userId, limit = 50) {
const response = await fetch(
`https://api.gu1.ai/events/user?user_id=${userId}&limit=${limit}`,
{
headers: { 'Authorization': `Bearer ${API_KEY}` }
}
);
const data = await response.json();
return data.events;
}
Consejos de Filtrado
Múltiples Identificadores de Entidad
Puedes proporcionar múltiples identificadores de entidad para ampliar la búsqueda:// Devolverá eventos que coincidan con CUALQUIERA de estos identificadores
const response = await fetch(
`https://api.gu1.ai/events/user?` +
`entity_external_id=user_12345&` +
`tax_id=20242455496`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
Combinando Filtros
Combina múltiples filtros para consultas precisas:// Obtiene transferencias fallidas en la última semana
const lastWeek = new Date(Date.now() - 7 * 86400000).toISOString();
const response = await fetch(
`https://api.gu1.ai/events/user?` +
`entity_external_id=user_12345&` +
`event_type=TRANSFER_FAILED&` +
`start_date=${lastWeek}`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
Mejores Prácticas de Paginación
Iterar a Través de Todas las Páginas
async function getAllEvents(entityExternalId) {
const allEvents = [];
let offset = 0;
const limit = 100;
let hasMore = true;
while (hasMore) {
const response = await fetch(
`https://api.gu1.ai/events/user?` +
`entity_external_id=${entityExternalId}&` +
`limit=${limit}&offset=${offset}`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
const data = await response.json();
allEvents.push(...data.events);
hasMore = data.pagination.hasMore;
offset += limit;
}
return allEvents;
}
Próximos Pasos
Crear Evento
Rastrea nuevos eventos
Estadísticas de Eventos
Obtén estadísticas agregadas
Listar por Entidad
Obtén eventos para una entidad específica
Detección de Fraude
Construye reglas de fraude con eventos
Was this page helpful?