Skip to content
StatusSupportDashboard

Get decision results

client.decisions.get(stringdecisionID, RequestOptionsoptions?): DecisionGetResponse { decision_id, decision_status, labels, 4 more }
get/v1/decisions/{decision_id}

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

ParametersExpand Collapse
decisionID: string

The decision ID to retrieve

ReturnsExpand Collapse
DecisionGetResponse { decision_id, decision_status, labels, 4 more }

Decision result data

decision_id: string

Unique identifier for the decision

decision_status: "SUCCESS" | "PENDING" | "ERROR" | "CANCELLED"

Status of the decision

Accepts one of the following:
"SUCCESS"
"PENDING"
"ERROR"
"CANCELLED"
labels: Array<Label> | null

Labels assigned during the decision process

applied: boolean

Whether or not the label was applied in this decision

explanation: string

An explanation of why the label was applied or not applied

name: string

The name of the label

metadata: Record<string, string | number | boolean | null>

Customer metadata as key-value pairs

Accepts one of the following:
string
number
boolean
result: string | null

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

policy_id?: string

Policy ID used for this decision

policy_version?: string

Policy version used for this decision

Get decision results
import Safetykit from 'safetykit';

const client = new Safetykit({
  apiKey: process.env['SAFETYKIT_API_KEY'], // This is the default and can be omitted
});

const decision = await client.decisions.get('decision_id');

console.log(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"
}