Skip to content
StatusSupportDashboard

Get decision results

decisions.get(strdecision_id) -> DecisionGetResponse
get/v1/decisions/{decision_id}

Retrieve the results of a previously submitted decision by its ID.

ParametersExpand Collapse
decision_id: str

The decision ID to retrieve

ReturnsExpand Collapse
class DecisionGetResponse:

Decision result data

decision_id: str

Unique identifier for the decision

decision_status: Literal["SUCCESS", "PENDING", "ERROR", "CANCELLED"]

Status of the decision

Accepts one of the following:
"SUCCESS"
"PENDING"
"ERROR"
"CANCELLED"
labels: Optional[List[Label]]

Labels assigned during the decision process

applied: bool

Whether or not the label was applied in this decision

explanation: str

An explanation of why the label was applied or not applied

name: str

The name of the label

metadata: Dict[str, Union[str, float, bool, null]]

Customer metadata as key-value pairs

Accepts one of the following:
str
float
bool
result: Optional[str]

The result of the policy (possible values are determined by the policy)

policy_id: Optional[str]

Policy ID used for this decision

policy_version: Optional[str]

Policy version used for this decision

Get decision results
import os
from safetykit import Safetykit

client = Safetykit(
    api_key=os.environ.get("SAFETYKIT_API_KEY"),  # This is the default and can be omitted
)
decision = client.decisions.get(
    "decision_id",
)
print(decision.decision_id)
{
  "decision_id": "content_01h2m7qdmdjckc30e1mnq6xqfd",
  "decision_status": "SUCCESS",
  "labels": [
    {
      "applied": true,
      "explanation": "The product is stated to be a Burberry item, a well-known brand",
      "name": "Counterfeit brands"
    },
    {
      "applied": false,
      "explanation": "The product is a handbag, and does not contain any illegal drugs",
      "name": "Illegal drugs"
    }
  ],
  "metadata": {},
  "result": "violating",
  "policy_id": "policy_id",
  "policy_version": "policy_version"
}
Returns Examples
{
  "decision_id": "content_01h2m7qdmdjckc30e1mnq6xqfd",
  "decision_status": "SUCCESS",
  "labels": [
    {
      "applied": true,
      "explanation": "The product is stated to be a Burberry item, a well-known brand",
      "name": "Counterfeit brands"
    },
    {
      "applied": false,
      "explanation": "The product is a handbag, and does not contain any illegal drugs",
      "name": "Illegal drugs"
    }
  ],
  "metadata": {},
  "result": "violating",
  "policy_id": "policy_id",
  "policy_version": "policy_version"
}