Create a user event for rules and fraud detection
API Reference
Create a user event for rules and fraud detection
Create a user event for fraud detection and rule validation β for user behavior tracking and rule-based fraud detection in gu1, with examples for create use.
POST
Create a user event for rules and fraud detection
Overview
Creates a new user event to track actions and behaviors within your application. Events are used for fraud detection, compliance monitoring, behavioral analytics, and audit trails. The system automatically registers devices, can optionally create entities when they donβt exist, and runs the rules engine to evaluate risk. The response includesrulesResult and rulesExecutionSummary when rules are triggered.
Endpoint
Authentication
Requires a valid API key in the Authorization header:Query Parameters
Enable automatic entity creation when an entity with the provided
taxId doesnβt exist. When true, if the event includes a taxId and no entity exists with that tax ID, a new person or company entity will be automatically created.Example: ?withAutoEntity=trueRequest Body
Type of event being tracked. Must be one of the supported event types (see Event Types section below), including authentication, transfers, biometric validation, and more.Example:
"LOGIN_SUCCESS"Your internal user identifier. Used to group events by user across different entities.Example:
"user_12345"gu1βs entity UUID. Provide this if you have the internal gu1 ID.
Entity Identification: You must provide at least ONE of:
entityId, entityExternalId, or taxId. These fields support OR logic, so the system will find the entity using any of these identifiers.Your external entity identifier. This is your unique ID for the entity in your system.Example:
"user_12345"Tax identification number (CPF, CNPJ, CUIT, etc.). When combined with
?withAutoEntity=true, this will create the entity if it doesnβt exist.Example: "20242455496"When the event occurred in ISO 8601 datetime format. If not provided, defaults to the current server time.Example:
"2026-01-30T14:30:00Z"Business date for the event. Used by historical rules as the starting point for time windows (e.g. βlast 7 daysβ is calculated backwards from this date).Format: ISO 8601 datetime string with timezone (e.g.
"2026-01-30T14:30:00Z" or "2026-01-30T00:00:00.000Z").If you donβt send it: The system uses the same value as timestamp (or the current server time if neither is sent). So the event is treated as βnowβ for historical rulesβno need to send it when the event is real-time.- Omitted β We set
eventDate = timestamp(or now). Historical rules use that as the starting point. - Format β ISO 8601 with timezone:
"YYYY-MM-DDTHH:mm:ss.sssZ"(e.g."2026-01-30T00:00:00.000Z"). - When to send β When the event actually happened on a different date than when youβre sending it (e.g. backfilled or batch events).
Unique identifier for the device. This should be a stable identifier that persists across sessions.Example:
"840e89e4d46efd67"Detailed device information. When provided, the device will be automatically registered or updated.Structure:
IP address from which the event originated (IPv4 or IPv6).Example:
"10.40.64.231"ISO 3166-1 alpha-2 country code where the event occurred.Example:
"AR"Whether the connection is through a VPN
Whether the connection is through a proxy
New device flag stored on the event (
is_new_device in the database). See How isNewDevice works below.Number of failed authentication attempts (for authentication events)Example:
3Destination account identifier for transfer events (CBU, CVU, etc.)Example:
"0170042640000004234411"Destination CUIT for transfer eventsExample:
"27281455496"Previous value for credential change events. This will be automatically hashed using SHA-256 for security.Example:
"old_password_hash"Additional event-specific data as key-value pairs. Use this for custom fields specific to your use case.Example:
Browser user agent string for web eventsExample:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36..."How isNewDevice works
The persisted value on each event drives fraud rules (for example historical.userEvent.newDevice and filters like isNewDevice: true on user_events).
Priority: your value wins when you send it
| Request | Persisted isNewDevice |
|---|---|
You send isNewDevice: true or false | Exactly what you sent (gu1 does not override it) |
You omit isNewDevice | gu1 computes a value (see below); defaults to false when device data is insufficient |
When you omit isNewDevice (server-side inference)
gu1 only auto-computes when both are present:
deviceIddeviceDetails
- Register or update the device for the resolved entity (
devicestable). - Set
isNewDevicetotrueif either:- No row exists yet for
(organization, entity, deviceId), or - The device exists but
firstSeenAtis within the last 5 minutes (first-seen window).
- No row exists yet for
- Otherwise set
isNewDevicetofalse(device already known to gu1 for that entity).
Request body field name
POST /events/user uses camelCase in JSON: isNewDevice. The snake_case name is_new_device is not read on this endpoint (use camelCase).
Examples
Client decides (recommended when you already detect new device):Event Types
Authentication Events
LOGIN_SUCCESS- Successful loginLOGIN_FAILED- Failed login attemptLOGOUT- User logoutTOKEN_GENERATED- Authentication token generated
Credential Change Events
PASSWORD_CHANGE- Password successfully changedPASSWORD_CHANGE_FAILED- Failed password change attemptEMAIL_CHANGE- Email address changedPHONE_CHANGE- Phone number changedPIN_CHANGE- PIN changed
Account Management Events
ACCOUNT_LINKED- Bank account linkedCONTACT_CREATED- Contact createdCONTACT_DELETED- Contact deletedADDRESS_CHANGED- Address updatedDEVICE_ADDED- New device addedDEVICE_DELETED- Device removed
Email Management Events
EMAIL_CREATED- Email createdEMAIL_ELIMINATED- Email eliminated
Navigation Events
NAVIGATION- Page or screen navigation
Transfer Events
TRANSFER_SUCCESS- Successful transferTRANSFER_FAILED- Failed transfer attemptTRANSFER_SCHEDULED- Transfer scheduled for future
Balance Events
BALANCE_CHECK- Account balance checkedBALANCE_CHECK_FAILED- Balance check failed
Account Access Events
ACCOUNTS_VIEW- Accounts list viewedACCOUNTS_VIEW_FAILED- Accounts view failed
Transaction Events
TRANSACTIONS_VIEW- Transaction history viewedTRANSACTIONS_VIEW_FAILED- Transaction view failed
Recipient Events
SEARCH_RECIPIENTS- Recipients searchedSEARCH_RECIPIENTS_FAILED- Recipients search failedSCHEDULE_RECIPIENT_FAILED- Recipient scheduling failed
Profile Events
PROFILE_VIEW- User profile viewedPROFILE_UPDATED- User profile updated
Message Events
MESSAGES_VIEW- Messages viewedMESSAGES_VIEW_FAILED- Messages view failed
Account Holder Events
ACCOUNT_HOLDERS_VIEW- Account holders viewedACCOUNT_HOLDERS_VIEW_FAILED- Account holders view failed
Alias Events
ALIAS_VIEW- Alias viewedALIAS_VIEW_FAILED- Alias view failedALIAS_CHANGE- Alias changedALIAS_CHANGE_FAILED- Alias change failed
Payment / Device Events
CARD_ADDED- Payment card addedDEVICE_CONNECTED- Device connected
Biometric Validation Events
BIOMETRIC_VALIDATION_SUCCESS- Biometric validation succeededBIOMETRIC_VALIDATION_ERROR- Biometric validation failed
Other Events
OTHER_EVENT- Custom or generic event
Response
Indicates if the request was successful
The created event object
gu1βs internal event UUID
Type of event created
User identifier
Associated entity UUID
External entity identifier
Tax identification number
Event timestamp (ISO 8601)
Business date used by historical rules for time windows (ISO 8601). Equals timestamp when not sent.
Device identifier
IP address
Country code
Event record creation timestamp
Result of rules execution if the rules engine was triggered for this event. Includes:
- success (boolean) - Whether rules executed successfully
- rulesTriggered (number) - Number of rules that were triggered
- alerts (array) - Alerts generated by rules
- riskScore (number) - Final calculated risk score
- decision (string) - Final decision (APPROVE, REJECT, HOLD, REVIEW_REQUIRED)
- rulesExecutionSummary (object) - Detailed summary; see below.
Only present when the rules engine ran for this event. Summary of which rules matched (hit) vs did not match (no hit), executed actions, and total score. See Rules Execution Summary for the full structure and a complete example.
- rulesHit (array) - Rules whose conditions were met. Each item: name, description, score, priority, category, status, conditions, actions.
- rulesNoHit (array) - Rules evaluated but conditions not met. Same structure as rulesHit.
- actionsExecuted (object) - Aggregated executed actions: alerts, suggestion, status, assignedUser, customKeys (array of strings, optional) β custom action keys from rules that matched (e.g.
require_kyc,flag_for_review); for integrations/workflows. - totalScore (number) - Sum of score of all rules that hit (excluding shadow).
Examples
Login Event
Transfer Event
Auto-Create Entity
Response Example
Error Responses
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
Use Cases
Track Authentication Patterns
Monitor Transfer Activity
Compliance Audit Trail
Best Practices
Always Include Timestamps
Provide explicit timestamps when events are queued or buffered to maintain accurate chronological ordering.Track Both Success and Failure
Always track both successful and failed events for comprehensive fraud detection and analytics.Use Structured Metadata
Keep metadata consistent across similar event types to enable better analysis and querying.Device information and isNewDevice
Always include deviceId and deviceDetails when available so gu1 can maintain the device registry. Set isNewDevice explicitly when your integration already classifies new devices; otherwise omit it and let gu1 infer (see How isNewDevice works).
Handle Auto-Creation Carefully
UsewithAutoEntity=true only when youβre confident the tax ID is valid and you want entities created automatically.
Next Steps
List Events
Query events with filters
Event Statistics
Get aggregated statistics
Devices API
Learn about device integration
Fraud Rules
Build rules using event data