Authentication
Authorization: Bearer <token> with a sensor token (gk_<env>_…, scoped to /v1/gate/* of that sensor) or the environment's secret key (sk_<env>_…, with sensor in the body; a new name registers the sensor).
| Status | Meaning |
|---|---|
401 unauthorized | bad token or disabled sensor |
402 product_required | no Gate plan on the account |
413 payload_too_large | body over 1 MB |
422 validation_error | malformed body |
429 rate_limited · quota_exceeded | 600 requests/min per sensor, or the month's events used up |
POST /v1/gate/events
Up to 500 events per request, as {sensor, events: […]}, a JSON array or NDJSON. Idempotent by eventId (derived from the event when missing).
POST https://api.pryntid.com/v1/gate/events
Authorization: Bearer gk_live_YOUR_SENSOR_TOKEN
Content-Type: application/json
{
"sensor": "gps-01",
"events": [{
"eventId": "tr-5027-0001",
"ts": "2026-11-15T18:02:11Z",
"host": "gps-gateway",
"port": 5027,
"protocol": "teltonika",
"transport": "tcp",
"srcIp": "203.0.113.7",
"srcPort": 51234,
"claimedIdentity": {"type": "imei", "value": "356307042441013"},
"outcome": "unknown_id",
"metadata": {"parser": "traccar"}
}]
}| Field | Notes |
|---|---|
srcIp | required; IPv4 or IPv6 |
ts | ISO 8601 or epoch (s or ms); default: when received |
claimedIdentity | {type, value}: imei, panel_account, username, email, ssh_key_fp, turn_user, device_id, mac, other… |
port · protocol · transport | local port, protocol name, tcp or udp |
metadata | free object up to 4 KB (payloadPrefix feeds the scanner detector) |
| `outcome` | Meaning |
|---|---|
connect | TCP/UDP session opened |
auth_ok | the claimed identity was accepted |
auth_fail | wrong password, key or signature |
unknown_id | the identity does not exist on your server |
disconnect | session closed |
data · error | traffic or a protocol error on an open session |
Response:
{
"accepted": 1, "duplicates": 0, "rejected": [],
"decisions": [{"eventId": "tr-5027-0001", "decision": "block", "score": 90,
"reasons": ["enumeration:6"], "srcIp": "203.0.113.7"}],
"blocks": [{"id": 12, "ip": "203.0.113.7", "expiresAt": "2026-11-15T19:02:11Z", "reason": "enumeration"}]
}decisions lists only the events flagged or blocked. Each accepted event counts one event of the monthly quota.
POST /v1/gate/logs
Raw log lines, parsed on the server: see Log sources.
GET /v1/gate/blocks
The full list of active blocks for the bouncer, the sensor's mode and the allowlist. version changes only when the list changes.
GET https://api.pryntid.com/v1/gate/blocks
Authorization: Bearer gk_live_YOUR_SENSOR_TOKEN
{
"mode": "enforce",
"blocks": [{"id": 12, "ip": "203.0.113.7", "reason": "enumeration",
"expiresAt": "2026-11-15T19:02:11Z", "createdAt": "2026-11-15T18:02:11Z"}],
"allowlist": ["192.168.1.0/24", "10.0.0.1/32"],
"version": "b3f1…",
"serverTime": "2026-11-15T18:05:00Z"
} POST /v1/gate/heartbeat
POST https://api.pryntid.com/v1/gate/heartbeat
Authorization: Bearer gk_live_YOUR_SENSOR_TOKEN
{"agentVersion": "0.1.0", "hostname": "gps-gateway", "mode": "dry_run", "backend": "nftables",
"appliedBlocks": 3, "parsers": ["traccar"], "spooled": 0} Detectors and score
Every event is enriched offline (country, city, ASN and its operator, VPN, hosting, Tor, abuse lists) and checked by these detectors. Thresholds, windows and actions are editable in Gate → Settings.
| Detector | Fires when | Default |
|---|---|---|
enumeration | one source tries ≥ 5 unknown identities in 10 min | block |
authFailBurst | ≥ 10 auth failures from one source in 5 min | block |
identityAuthFail | ≥ 5 auth failures against one identity in 10 min | flag |
concurrentSources | the same identity connected from 2+ sources at once | flag |
newAsn · newCountry | an identity seen from a new network or country | flag |
impossibleTravel | > 900 km/h between two locations, > 500 km apart | flag |
firstSeen | an identity never seen before | signal |
portScan | one source touches ≥ 4 ports in 10 min | block |
scanner | known scanner networks, scanner payloads, abuse lists | flag |
torOrHosting | a device identity (IMEI, panel account) from Tor, VPN or hosting | flag |
identityBlocked | an identity you marked as blocked | block |
The score is 0–100 with the reasons that built it: block at 80 or when a detector or rule blocks, flag at 40. An allowlisted IP is always allow (its signals are still recorded).
Rules
The same declarative rules as Identify: one field, an operator (eq, ne, gt, lt, gte, lte, in), a value and an action (allow, flag, block), by priority; evaluate mode only counts would-be matches. Fields include idType, outcome, port, protocol, sensor, country, asn, asnType, vpn, tor, hosting, firstSeen, newAsn, newCountry, concurrentSources, unknownIdsFromSource, authFailsFromSource, distinctPortsFromSource, travelKmh, riskScore and identityStatus.
{"name": "Connection from a datacenter", "field": "asnType", "op": "eq", "value": "hosting", "action": "block", "priority": 10}
{"name": "Stricter enumeration", "field": "unknownIdsFromSource", "op": "gte", "value": "3", "action": "block", "priority": 20}
{"name": "Alarm panel abroad", "field": "newCountry", "op": "eq", "value": "true", "action": "flag", "priority": 30}A block decision blocks the source IP for blockTtlMinutes (60 by default; a rule can set its own). Allowlisted and private IPs are never blocked automatically.
Tamper-evident log
Each event carries seq, prevHash and hash = sha256(prevHash + canonical JSON of the event and its decision), one chain per account and environment. There is no API to edit or delete events. Retention removes the oldest and keeps a checkpoint; log verification in the console (GET /admin/gate/log/verify) recomputes the chain.
Webhooks
Subscribe an endpoint in Webhooks to gate.decision, gate.block.created, gate.block.revoked or gate.alert. Deliveries are signed like every Prynt webhook: X-Prynt-Signature: sha256=HMAC(secret, "<X-Prynt-Timestamp>." + body).
{
"type": "gate.decision",
"createdAt": "2026-11-15T18:02:12Z",
"data": {"eventId": "tr-5027-0001", "decision": "flag", "score": 70,
"reasons": ["concurrentSources:2"], "identity": {"type": "imei", "value": "356307042441013"},
"srcIp": "198.51.100.23", "port": 5027, "sensor": "gps-01"}
}// Node.js: verify X-Prynt-Signature (same scheme as every Prynt webhook)
import crypto from 'node:crypto';
function verify(rawBody, headers, secret) {
const ts = headers['x-prynt-timestamp'];
const sig = (headers['x-prynt-signature'] || '').replace('sha256=', '');
const want = crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(ts)) < 300;
return fresh && sig.length === want.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(want));
} Updated 2026-11-15 · API reference