Skip to content
Start here

Get the current status of a given Access policy test

client.zeroTrust.access.applications.policyTests.get(stringpolicyTestId, PolicyTestGetParams { account_id } params, RequestOptionsoptions?): PolicyTestGetResponse { id, percent_approved, percent_blocked, 7 more }
GET/accounts/{account_id}/access/policy-tests/{policy_test_id}

Fetches the current status of a given Access policy test.

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)
Access: Policy Test WriteAccess: Policy Test Read
ParametersExpand Collapse
policyTestId: string

The UUID of the policy test.

maxLength64
params: PolicyTestGetParams { account_id }
account_id: string

Identifier.

maxLength32
ReturnsExpand Collapse
PolicyTestGetResponse { id, percent_approved, percent_blocked, 7 more }
id?: string

The UUID of the policy test.

maxLength64
percent_approved?: number

The percentage of (processed) users approved based on policy evaluation results.

percent_blocked?: number

The percentage of (processed) users blocked based on policy evaluation results.

percent_errored?: number

The percentage of (processed) users errored based on policy evaluation results.

percent_users_processed?: number

The percentage of users processed so far (of the entire user base).

status?: "blocked" | "processing" | "exceeded time" | "complete"

The status of the policy test.

One of the following:
"blocked"
"processing"
"exceeded time"
"complete"
total_users?: number

The total number of users in the user base.

users_approved?: number

The number of (processed) users approved based on policy evaluation results.

users_blocked?: number

The number of (processed) users blocked based on policy evaluation results.

users_errored?: number

The number of (processed) users errored based on policy evaluation results.

Get the current status of a given Access policy test

import Cloudflare from 'cloudflare';

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

const policyTest = await client.zeroTrust.access.applications.policyTests.get(
  'f1a8b3c9d4e5f6789a0b1c2d3e4f5678a9b0c1d2e3f4a5b67890c1d2e3f4b5a6',
  { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
);

console.log(policyTest.id);
{
  "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": {
    "id": "f1a8b3c9d4e5f6789a0b1c2d3e4f5678a9b0c1d2e3f4a5b67890c1d2e3f4b5a6",
    "percent_approved": 25,
    "percent_blocked": 25,
    "percent_errored": 25,
    "percent_users_processed": 50,
    "status": "complete",
    "total_users": 20,
    "users_approved": 5,
    "users_blocked": 5,
    "users_errored": 5
  }
}
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": {
    "id": "f1a8b3c9d4e5f6789a0b1c2d3e4f5678a9b0c1d2e3f4a5b67890c1d2e3f4b5a6",
    "percent_approved": 25,
    "percent_blocked": 25,
    "percent_errored": 25,
    "percent_users_processed": 50,
    "status": "complete",
    "total_users": 20,
    "users_approved": 5,
    "users_blocked": 5,
    "users_errored": 5
  }
}