improved

Event details in API payload.

Today we're launching a new option to our Risk and Filter APIs: the ability to retrieve more details from the event context. By passing the expand: ["all"] option as part of the JSON payload you're sending to either the Risk or Filter API, you'll get back a rich object with additional data such as IP-location and device information. This information is the same as you can see in the Castle Dashboard when exploring data, but now you can get it directly in the API response as well.

This new option is available to all customers on our Enterprise plans or on demand. Please reach out if you're interested in trying this!

Below is a complete example response that includes the new fields:

{
  "id": "2V48MDnuMar9pvOOwulwK4BXui2",
  "type": "$login",
  "status": "$succeeded",
  "name": "Login Succeeded",
  "authenticated": true,
  "endpoint": "/v1/risk",
  "created_at": "2023-09-02T4:39:05.147Z",
  "properties": {
    "my_custom_property": 234
  },
  "device": {
    "fingerprint": "zhQ3YFvQTVOIP4EZWcMaNg",
    "user_agent": "CryptoKid iOS/2023.9.1 (2023.9.1) (iPhone15,3; iOS 16.6.1; Castle 3.0.7)",
    "name": "Adam's iPhone",
    "emulator": false,
    "rooted": false,
    "software": {
      "languages": ["en-us", "en", "ru-ru"],
      "type": "mobile_application",
      "name": "CryptoKid iOS",
      "version": { "major": "2023", "full": "2023.9.1" }
    },
    "timezone": {
      "offset": -420,
      "name": "America/New_York"
    },
    "os": {
      "name": "iOS",
      "version": { "major": "16", "full": "16.6.1" }
    },
    "hardware": {
      "type": "phone",
      "name": "iPhone",
      "brand": "Apple",
      "model": {
        "name": "iPhone 14 Pro Max",
        "code": "iPhone15,3"
      },
      "display": { "width": 430, "height": 932 }
    },
    "cellular": {
      "carrier": {
        "name": "Verizon Wireless",
        "country_code": "US"
      },
      "available": true
    },
    "wifi": { "available": true },
    "battery": {
      "charging_state": "unplugged",
      "level": 34
    },
    "location": {
      "accuracy": 20,
      "city": "Falls Church",
      "country_code": "US",
      "latitude": 38.8524,
      "longitude": -77.148
    },
    "screen": {
      "density": 3,
      "orientation": "portrait"
    },
    "memory": {
      "available": 345,
      "total": 5500
    },
    "storage": {
      "available": 2011,
      "total": 121943
    },
    "usage": {
      "screen_time": 10265,
      "uptime": 695312
    }
  },
  "scores": {
    "bot": { "score": 0.033 },
    "account_abuse": { "score": 0.27 },
    "account_takeover": { "score": 0.196 }
  },
  "ip": {
    "address": "108.18.100.121",
    "type": "ipv4",
    "asn": 701,
    "isp": {
      "name": "Verizon Fios",
      "organization": "Verizon Fios"
    },
    "location": {
      "city": "Falls Church",
      "country_code": "US",
      "region_code": "VA",
      "continent_code": "NA",
      "postal_code": "22042",
      "latitude": 38.8597,
      "longitude": -77.198
    },
    "privacy": {
      "anonymous": false,
      "datacenter": false,
      "proxy": false,
      "tor": false
    }
  },
  "metrics": {
    "1": {
      "name": "Users per device fingerprint in 30d",
      "value": 5
    },
    "2": {
      "name": "Failed logins per IP in 1h",
      "value": 238
    },
    "3": {
      "name": "Average transaction amount per user",
      "value": 83.13
    }
  },
  "signals": {
    "impossible_travel": {},
    "credential_stuffing": {},
    "multiple_accounts_per_device": {},
    "new_device": {}
  },
  "policy": {
    "action": "deny",
    "name": "Block multi-accounting",
    "id": "3666300b-adc9-4a9a-9773-f6e692ed348d",
    "revision_id": "1d1e6f75-08ea-47ea-bb92-61d598c448e2"
  },
  "lists": [
    "blocked_ips",
    "trusted_devices"
  ],
  "list_items": [
    "8842e866-86e7-4f18-a023-edbf8cb91107",
    "42bc2f4d-64d1-4291-a77f-61c64bd410a0"
  ],
  "user": {
    "id": "7312",
    "registered_at": "2023-08-13T14:00:58.000Z",
    "name": "Adam Winter",
    "email": "[email protected]",
    "phone": "+11123456789",
    "traits": {
      "nationality": "PL",
      "organization_id": "789435"
    }
  },
  "email": {
    "normalized": "[email protected]",
    "domain": "castle.com",
    "disposable": false
  },
  "sdks": {
    "client": {
      "name": "castle-web",
      "version": "2.1.8"
    }
  }
}