# Method: projects.keys.getMetrics

- [HTTP request](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#body.request_body)
- [Response body](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#body.Metrics.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#body.aspect_1)
- [ScoreMetrics](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreMetrics)
  - [JSON representation](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreMetrics.SCHEMA_REPRESENTATION)
- [ScoreDistribution](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreDistribution)
  - [JSON representation](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreDistribution.SCHEMA_REPRESENTATION)
- [ChallengeMetrics](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ChallengeMetrics)
  - [JSON representation](https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ChallengeMetrics.SCHEMA_REPRESENTATION)

Get some aggregated metrics for a Key. This data can be used to build dashboards.

### HTTP request

`GET https://recaptchaenterprise.googleapis.com/v1/{name=projects/*/keys/*/metrics}`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The name of the requested metrics, in the format `projects/{project}/keys/{key}/metrics`. |

### Request body

The request body must be empty.

### Response body

Metrics for a single Key.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "name": string, "startTime": string, "scoreMetrics": [ { object (`https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreMetrics`) } ], "challengeMetrics": [ { object (`https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ChallengeMetrics`) } ] } ``` |

| Fields ||
|---|---|
| `name` | `string` Output only. Identifier. The name of the metrics, in the format `projects/{project}/keys/{key}/metrics`. |
| `startTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Inclusive start time aligned to a day in the America/Los_Angeles (Pacific) timezone. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `scoreMetrics[]` | ``object (`https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreMetrics`)`` Metrics are continuous and in order by dates, and in the granularity of day. All Key types should have score-based data. |
| `challengeMetrics[]` | ``object (`https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ChallengeMetrics`)`` Metrics are continuous and in order by dates, and in the granularity of day. Only challenge-based keys (CHECKBOX, INVISIBLE) have challenge-based data. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `name` resource:

- `recaptchaenterprise.metrics.get`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## ScoreMetrics

Metrics related to scoring.

| JSON representation |
|---|
| ``` { "overallMetrics": { object (`https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreDistribution`) }, "actionMetrics": { string: { object (`https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreDistribution`) }, ... } } ``` |

| Fields ||
|---|---|
| `overallMetrics` | ``object (`https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreDistribution`)`` Aggregated score metrics for all traffic. |
| `actionMetrics` | ``map (key: string, value: object (`https://docs.cloud.google.com/recaptcha/docs/reference/rest/v1/projects.keys/getMetrics#ScoreDistribution`))`` Action-based metrics. The map key is the action name which specified by the site owners at time of the "execute" client-side call. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |

## ScoreDistribution

Score distribution.

| JSON representation |
|---|
| ``` { "scoreBuckets": { integer: string, ... } } ``` |

| Fields ||
|---|---|
| `scoreBuckets` | `map (key: integer, value: string (https://developers.google.com/discovery/v1/type-format format))` Map key is score value multiplied by 100. The scores are discrete values between \[0, 1\]. The maximum number of buckets is on order of a few dozen, but typically much lower (ie. 10). An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |

## ChallengeMetrics

Metrics related to challenges.

| JSON representation |
|---|
| ``` { "pageloadCount": string, "nocaptchaCount": string, "failedCount": string, "passedCount": string } ``` |

| Fields ||
|---|---|
| `pageloadCount` | `string (https://developers.google.com/discovery/v1/type-format format)` Count of reCAPTCHA checkboxes or badges rendered. This is mostly equivalent to a count of pageloads for pages that include reCAPTCHA. |
| `nocaptchaCount` | `string (https://developers.google.com/discovery/v1/type-format format)` Count of nocaptchas (successful verification without a challenge) issued. |
| `failedCount` | `string (https://developers.google.com/discovery/v1/type-format format)` Count of submitted challenge solutions that were incorrect or otherwise deemed suspicious such that a subsequent challenge was triggered. |
| `passedCount` | `string (https://developers.google.com/discovery/v1/type-format format)` Count of nocaptchas (successful verification without a challenge) plus submitted challenge solutions that were correct and resulted in verification. |