Skip to content
Start here

Get risk event/score information for a specific user

zero_trust.risk_scoring.get(struser_id, RiskScoringGetParams**kwargs) -> RiskScoringGetResponse
GET/accounts/{account_id}/zt_risk_scoring/{user_id}

Retrieves the detailed risk score breakdown for a specific user, including contributing factors.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Zero Trust: PII Read
ParametersExpand Collapse
account_id: str
user_id: str
formatuuid
ReturnsExpand Collapse
class RiskScoringGetResponse:
email: str
events: List[Event]
id: str
name: str
risk_level: Literal["low", "medium", "high"]
One of the following:
"low"
"medium"
"high"
timestamp: datetime
formatdate-time
event_details: Optional[object]
name: str
last_reset_time: Optional[datetime]
formatdate-time
risk_level: Optional[Literal["low", "medium", "high"]]
One of the following:
"low"
"medium"
"high"

Get risk event/score information for a specific user

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
risk_scoring = client.zero_trust.risk_scoring.get(
    user_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    account_id="account_id",
)
print(risk_scoring.email)
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "email": "email",
    "events": [
      {
        "id": "id",
        "name": "name",
        "risk_level": "low",
        "timestamp": "2019-12-27T18:11:19.117Z",
        "event_details": {}
      }
    ],
    "name": "name",
    "last_reset_time": "2019-12-27T18:11:19.117Z",
    "risk_level": "low"
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "email": "email",
    "events": [
      {
        "id": "id",
        "name": "name",
        "risk_level": "low",
        "timestamp": "2019-12-27T18:11:19.117Z",
        "event_details": {}
      }
    ],
    "name": "name",
    "last_reset_time": "2019-12-27T18:11:19.117Z",
    "risk_level": "low"
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}