API integration

Event ingestion happens through sensors that collect the events, and they all get into the queue. Then, when the cron starts (in loop-until-drained), it defines the entities that had actions since the last cron run, updates statistics, and calculates the context that is used by the active rules to determine a final risk score for each entity.

Official tracker libraries

Use one of these:

LanguageInstall
PHPcomposer require tirreno/tirreno-tracker
Pythonpip install tirreno_tracker
Node.jsnpm install @tirreno/tirreno-tracker
WordPressUpload the plugin to WordPress, activate it, then enter your Tracking ID and tirreno URL

Repos: PHP, Python, Node.js, WordPress

Sensor API reference

Endpoint

POST /sensor/
Content-Type: application/x-www-form-urlencoded
Api-Key: YOUR_TRACKING_ID

Note: The API uses form-urlencoded format, not JSON.

Optional headers:

HeaderDescription
X-Request-IdTrace ID (up to 36 characters) stored with the event, or with the rejected request if validation fails

Command line: the sensor can also be called from the CLI, passing the Tracking ID and event fields as long options:

php sensor/index.php --apiKey=YOUR_TRACKING_ID --userName=user123 --ipAddress=203.0.113.50 \
    --url=/login --eventTime="2024-12-08 14:30:00.000" --eventType=account_login

Required parameters

ParameterDescription
userNameUnique user ID (max 100 chars)
ipAddressIPv4/IPv6 address (invalid IPs default to 0.0.0.0)
urlURL path (max 2047 chars)
eventTimeUTC timestamp Y-m-d H:i:s.v; Y-m-d H:i:s and Y-m-d H:i:s.u are also accepted (an invalid value is replaced with the current UTC time)

Optional parameters

ParameterTypeDescription
emailAddressstringEmail address (max 255 chars). Validated and converted to lowercase
userAgentstringBrowser UA (max 511 chars)
firstNamestringUser's first name (max 100 chars)
lastNamestringUser's last name (max 100 chars)
fullNamestringUser's whole name (max 100 chars)
pageTitlestringTitle of visited page (max 255 chars)
phoneNumberstringUser's phone number (max 19 chars)
httpRefererstringReferer HTTP header value (max 2047 chars)
httpMethodstringHTTP method: GET, POST, HEAD, PUT, DELETE, PATCH, TRACE, CONNECT, OPTIONS, LINK, UNLINK
httpCodestringHTTP response status code (must be numeric, defaults to 0)
browserLanguagestringDetected browser language (max 255 chars)
eventTypestringOne of the event types listed below. Defaults to page_view, or page_error if httpCode >= 400
userCreatedstringUser creation timestamp (Y-m-d H:i:s or Y-m-d H:i:s.v)
payloadarrayEvent details for page_search and account_email_change events
fieldHistoryarrayField edit history for field_edit events

Note: Maximum length for all other parameters is 100 characters unless specified above. Parameters exceeding max length are truncated.

Event types

Default: page_view (or page_error if httpCode >= 400)

TypeDescription
page_viewPage visit (default)
page_editPage modification
page_deletePage deletion
page_searchSearch query
page_errorError page
account_loginUser authentication
account_logoutSession end
account_login_failFailed login attempt
account_registrationNew account creation
account_email_changeEmail address change
account_password_changePassword change
account_editAccount profile modification
field_editData modification

Payload parameter

For page_search events:

{
    "eventType": "page_search",
    "payload": {
        "field_id": 179280,
        "value": "search query",
        "field_name": "Country"
    }
}
FieldRequiredDescription
field_idYesUnique identifier for the search field
valueYesThe search query string
field_nameNoHuman-readable field name

For account_email_change events:

{
    "eventType": "account_email_change",
    "payload": {
        "new_value": "new@example.com",
        "old_value": "old@example.com"
    }
}
FieldRequiredDescription
new_valueYesThe new email address
old_valueNoThe previous email address

Field history parameter

Required for field_edit events. Must be an array of field change objects:

{
    "eventType": "field_edit",
    "fieldHistory": [
        {
            "field_id": 179283,
            "new_value": "Paris",
            "field_name": "User city",
            "old_value": "London",
            "parent_id": "",
            "parent_name": ""
        }
    ]
}
FieldRequiredDescription
field_idYesUnique identifier for the field
new_valueYesThe new field value
field_nameNoHuman-readable field name
old_valueNoThe previous field value
parent_idNoParent record ID (for nested data)
parent_nameNoParent record name

Note: Missing required fields default to "unknown". All values are converted to strings.

Response codes

ResponseMeaning
204, no bodyEvent accepted
200, empty bodyRequest rejected: missing or unknown Tracking ID, or a required field is missing. The reason is written to the web server error log
429Rate limited (see Rate limiting)
500Server error
403Wrong endpoint, e.g., /sensor without the trailing slash

Successful requests (2xx) return no response body.

Rate limiting

The sensor has a leaky bucket rate limiter, applied per Tracking ID: at most LEAKY_BUCKET_RPS × LEAKY_BUCKET_WINDOW requests are accepted within the window (defaults: 10 requests per second, 20 seconds). Requests over the limit get 429 and appear in the Logbook as Rate limit exceeded. Setting either value to 0 disables the limit; see Environment variables for how to set them.

Blacklist API

Check if an entity is blacklisted. The value is matched against entity IDs (userName) only; IP addresses, emails and phone numbers are not looked up.

Request:

POST /api/v1/blacklist/search
Content-Type: application/json
Api-Key: YOUR_TRACKING_ID

{
    "value": "user123"
}

Response:

{
    "value": "user123",
    "blacklisted": false
}

The response is JSON. A missing or unknown Tracking ID returns 401.

The examples in this guide use $blacklistService->isBlacklisted($value) (blacklist_service.is_blacklisted() in Python, blacklistService.isBlacklisted() in Node.js). It stands for your own small wrapper that sends this request and returns the blacklisted field; define it before using the examples.

Logbook event types

The Logbook statuses and columns are described in Logbook in the user guide.

________________________________________________________________________________