This endpoint lists the policy results that were evaluated for a business per the policies defined on your account
When a business goes through Middesk, the status of the business will automatically be set to either "approved" or "rejected" if the business meets the criteria of one of the policies defined for your account.
This endpoint will return a business's policy results which show when a business was evaluated. If the business was auto-approved or auto-rejected based off of the rules an account has enabled, there will be policy result(s) with the matched set to true. If the business was not auto-approved or auto-rejected, there will be policy result(s) with the matched field set to false.
Response returned
Property | Type | Description |
---|---|---|
object | string | The type of object returned (in this case, "list") |
data | policy_result[] | The policy results for the business (see below for fields included) |
url | string | URL the resource was fetched from |
Items in the data array will include these fields:
Property | Type | Description |
---|---|---|
object | string | A definition of the type of object returned (in this case, "policy_result") |
id | string | |
result | string | Result of the policy decision (approved, rejected, or review) |
business_id | string | The ID of the business the policy is evaluating |
created_at | timestamp | |
name | string | Name of the policy |
matched | boolean | True if the policy was applied and false otherwise |
details | object | Details about the insights that the policy evaluated and whether they were matched or not |
policy_action_results | policy_action_result[] | The policy action results for the business (see below for fields included). Each object specifies if we were able to execute a particular action on a matched policy (and if not, why not). |
Items in the policy action results array will include these fields:
Property | Type | Description |
---|---|---|
object | string | A definition of the type of object returned (in this case, "policy_action_result") |
id | string | |
executed | boolean | If the action was successfully executed or not |
details | object | Details on why the action could not be executed. Note that all policies with "decision" as a policy action will include an insight field of status with status: "in_review . This is a necessary state for the business to be in to match a decision policy, so we automatically add it to all policies that contain that action. |
policy_action | object | The policy action that this policy action result describes |
policy_action.id | id | |
policy_action.action_type | string | The type of action (ex. auto_decision) |
policy_action.options | object | The options associated with the action (ex. { "decision": "approve" }) |
policy_action.policy_version_id | string |
These settings can be changed by visiting the Settings page for Policies.
{
"object": "list",
"data": [
{
"object": "policy_result",
"id": "0af5caf6-a8e4-431c-8d0a-4618ae8a1028",
"result": "approved",
"business_id": "76feb8ec-c33d-4295-8e65-1d0476e26eef",
"created_at": "2023-04-04T22:23:35.432Z",
"matched": false,
"name": "Rejection Policy",
"details": {
"insight_state": {
"name": {
"match": true,
"status": "verified"
},
"status": {
"match": false,
"status": "approved"
}
},
"mismatched_rules": [
"status"
]
},
"policy_action_results": []
},
{
"object": "policy_result",
"id": "0af5caf6-a8e4-431c-8d0a-4618ae8a2054",
"result": "approved",
"business_id": "76feb8ec-c33d-4295-8e65-1d0476e26eef",
"created_at": "2023-04-04T22:23:35.432Z",
"matched": true,
"name": "Approval Policy",
"details": {
"insight_state": {
"name": {
"match": true,
"status": "verified"
},
"address_verification": {
"match": true,
"status": "verified"
}
},
"mismatched_rules": []
},
"policy_action_results": [
{
"object": "policy_action_result",
"id": "936d73d6-aa5c-44bc-86b9-d98b255b16fa",
"details": null,
"executed": true,
"policy_action": {
"id": "c232ad85-9a70-4292-baea-575fcb6e4a1d",
"action_type": "auto_decision",
"options": {
"decision": "approve"
},
"policy_version_id": "7b1e539f-b622-4615-ba1b-5fd4c1436e0c"
}
}
]
}
],
"url": "https://api.middesk.com/v1/businesses/76feb8ec-c33d-4295-8e65-1d0476e26eef/policy_results"
}