---
title: "GET /v1/projects/{projectsId}/keys/{keysId}/policy"
method: GET
path: "/v1/projects/{projectsId}/keys/{keysId}/policy"
tags: ["projects"]
---

# GET /v1/projects/{projectsId}/keys/{keysId}/policy

`GET /v1/projects/{projectsId}/keys/{keysId}/policy`

## Request

- Base URL: `https://recaptchaenterprise.googleapis.com`
- URL: `https://recaptchaenterprise.googleapis.com/v1/projects/{projectsId}/keys/{keysId}/policy`
- Auth: OAuth 2 and OAuth 2
  - Implicit: `https://accounts.google.com/o/oauth2/auth`
  - Scopes: `https://www.googleapis.com/auth/cloud-platform`
  - Authorization code: `https://accounts.google.com/o/oauth2/auth`
  - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`

Get the policy for a key.

## Path parameters

- `projectsId` string, required
- `keysId` string, required

## Response `200`

Successful response

- GoogleCloudRecaptchaenterpriseV1Policy: A complete configuration set containing multiple grouped rules defining the behavior of reCAPTCHA for fraud detection and prevention.
  - `challengeRuleGroups` GoogleCloudRecaptchaenterpriseV1ChallengeRuleGroup[]: Optional. Rules to configure the behavior of reCAPTCHA for showing a challenge. Rule groups are evaluated in order. Evaluation stops when the first matching rule group is found.
    - `actions` string[]: Required. Action name provided at token generation. The action name is not case-sensitive and can only contain alphanumeric characters, slashes, and underscores. If "*" is provided, the rule group applies to all actions. If multiple actions are provided, the rule group is applied to all of them. This field is required.
    - `challengeRules` GoogleCloudRecaptchaenterpriseV1ChallengeRule[]: Required. A list of rules that configure when and how reCAPTCHA presents a challenge. reCAPTCHA evaluates these rules in order and applies the first one that matches.
      - `challenge` GoogleCloudRecaptchaenterpriseV1ChallengeRuleChallengeOutcome: An outcome that indicates that a challenge of a specified difficulty should be presented to the user.
        - `difficulty` 'CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED' | 'USABILITY' | 'BALANCE' | 'SECURITY': Optional. The difficulty of the challenge to present to the user. If unspecified, `BALANCE` is used.
      - `condition` string: Optional. A CEL condition that must be met for this rule to apply. If unspecified, the rule applies unconditionally. The following fields can be referenced in the condition: * `score` * `user_ip_address` * `user_asn` * `user_agent` * `verified_bots.name` * `verified_bots.bot_type` Examples: * `score < 0.5` * `user_ip_address == "123.45.67.89"` * `user_agent.contains("Chrome")` * `score < 0.5 && user_ip_address == "123.45.67.89"`
      - `noChallenge` GoogleCloudRecaptchaenterpriseV1ChallengeRuleNoChallengeOutcome: An outcome that indicates that no challenge should be presented to the user.
  - `clientSettings` GoogleCloudRecaptchaenterpriseV1ClientSettings: Configuration for clients to protect with reCAPTCHA.
    - `allowAllDomains` boolean: Optional. If set to true, it means allowed_domains are not enforced.
    - `allowedDomains` string[]: Optional. Domains or subdomains of websites allowed to use the policy. All subdomains of an allowed domain are automatically allowed. A valid domain requires a host and must not include any path, port, query or fragment. Examples: 'example.com' or 'subdomain.example.com' Each policy supports a maximum of 250 domains. To use a policy on more domains, set `allow_all_domains` to true. When this is set, you are responsible for validating the hostname by checking the `token_properties.hostname` field in each assessment response against your list of allowed domains.
    - `protectedEndpointGroup` GoogleCloudRecaptchaenterpriseV1ProtectedEndpointGroup: Configuration for API endpoints to protect with reCAPTCHA.
      - `protectedEndpoints` GoogleCloudRecaptchaenterpriseV1ProtectedEndpoint[]: Optional. List of API endpoints to automatically protect with reCAPTCHA. If any of these endpoints is invoked from a page where a key bound to this policy is installed, a reCAPTCHA token is automatically generated and attached to the request. If multiple protected endpoints match a given API endpoint, the first one in the list is used.
        - `action` string: Required. Action name to be used for token generation for this endpoint. The action name can only contain alphanumeric characters, slashes, and underscores.
        - `path` string: Required. URI path of the API endpoint to protect. Must start with '/'. Supports glob characters '*' to match a single path segment and '**' to match multiple path segments. Standalone root catch-alls ('/*' and '/**') are invalid because it can negatively impact performance to trigger reCAPTCHA on every single request to your backend. Matching is evaluated against the URL path only (domain, scheme, and query parameters are ignored). Examples: - `/login` matches `/login`, `https://example.com/login`, and `/login?query=1`, but not `/login/step1`. - `/products/*` matches `/products/123`, but not `/products/123/456`. - `/content/**` matches `/content/articles/2024/01/01`.
  - `name` string: Identifier. Resource name for this policy. Format: "projects/{project}/keys/{key}/policy" for a policy under a key.

---

[API](https://skmtc.dev/google/apis/recaptchaenterprise.md) - [All operations](https://skmtc.dev/google/apis/recaptchaenterprise/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/recaptchaenterprise/revisions/26f34c638048?raw)
