Skip to main content
The velocity and anomaly scoring API tracks how frequently a subject performs a given action across multiple rolling time windows — 1 minute, 5 minutes, 1 hour, and 24 hours. When the weighted velocity score crosses a threshold, the platform automatically creates a risk signal, connecting anomaly detection directly to the Anti-Fraud Identity Firewall pipeline.
Velocity scoring is part of the Anti-Fraud Identity Firewall. Signals generated by velocity anomalies flow into the same pipeline as other fraud signals, so you can query and review them from the Risk & Fraud > Signals console page or the list signals endpoint.

How it works

1

Record actions

Call POST /v1/risk/velocity/record each time a subject performs a tracked action — login attempts, API calls, transaction requests, or any custom action type.
2

Rolling window tracking

The platform increments counters for the subject and action type across four rolling windows (1 m, 5 m, 1 h, 24 h). Windows reset automatically when they expire.
3

Weighted scoring

A velocity score is computed from the window counts. Short windows are weighted more heavily to detect bursts: 1 m × 30, 5 m × 20, 1 h × 10, 24 h × 5.
4

Automatic signal ingestion

When the velocity score reaches 60 or above, the platform automatically ingests a risk signal with signal_type: "velocity". You don’t need a separate API call.
5

Review and respond

Query velocity windows for a subject, list high-velocity anomalies across your tenant, and review signals in the console or via the API.

Prerequisites

  • An active Truthlocks tenant with an API key
  • Action event data from your application (login attempts, API calls, transactions, or any repeatable action)

Recording an action

Send a POST request to /v1/risk/velocity/record with the subject, action type, and optional metadata:
The response returns the current window counts, the computed velocity score, and whether a risk signal was auto-ingested:

Scoring model

The velocity score is a weighted sum of action counts across four rolling windows. Short windows carry higher weight to prioritize burst detection: The final score is capped at 100. When the score reaches 60 or above, a risk signal is automatically ingested with signal_type: "velocity".

Score interpretation

Querying velocity windows

Retrieve the current velocity windows for a specific subject:
The response includes all tracked action types for the subject, with counts per window and the computed velocity score for each:

Listing high-velocity anomalies

Query subjects with velocity scores above a threshold across your tenant:
Each result includes the subject, action type, current window counts, and the velocity score that qualified the anomaly:

Integration patterns

Block or throttle on high velocity

Use the velocity score from the record response to decide whether to allow, throttle, or block an action:

Combine with ATO detection

Velocity scoring tracks any action type across multiple time windows, while ATO detection is specifically optimized for login-based account takeover patterns with built-in threshold rules and alert management. Use both together for layered protection:
  • Velocity scoring for general abuse detection — API rate abuse, transaction flooding, registration spam
  • ATO detection for focused login security — failed login velocity, credential stuffing alerts, subject risk profiles

Monitor via webhooks

Configure a webhook endpoint to receive real-time notifications when velocity-based risk signals are created, so your security team can respond without polling.

Custom action types

You can track any action type your application produces. Common examples:

Usage metering

Each call to POST /v1/risk/velocity/record increments the antifraud.velocity_records usage counter for your billing cycle. You can monitor your consumption with the usage API or in the console at Settings > Billing > Usage under the Anti-Fraud section.
Velocity record quotas vary by plan tier. See the billing overview for details on all Anti-Fraud metered products.

What’s next