- [HTTP request](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#body.HTTP_TEMPLATE)
- [Path parameters](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#body.PATH_PARAMETERS)
- [Request body](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#body.request_body)
  - [JSON representation](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#body.response_body)
  - [JSON representation](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#body.GenerateAlertPolicyResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#body.aspect)
- [AlertType](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#AlertType)
- [Language](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#Language)
- [Try it!](https://firebase.google.com/docs/reference/crashlytics/rest/v1alpha/projects.apps/generateAlertPolicy.md.txt#try-it)

Creates a Cloud Monitoring AlertPolicy for the requested Crashlytics Web alert type and returns the created resource reference.

### HTTP request

`POST https://firebasecrashlytics.googleapis.com/v1alpha/{name=projects/*/apps/*}:generateAlertPolicy`

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

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The firebase application. Format: "projects/{project}/apps/{app_id}". |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "alertType": enum (`AlertType`), "language": enum (`Language`) } ``` |

| Fields ||
|---|---|
| `alertType` | ``enum (`AlertType`)`` Required. The type of alert to create. |
| `language` | ``enum (`Language`)`` Optional. Language to use for the alert policy. Defaults to USER_PREFERENCE. |

### Response body

Response message for the apps.generateAlertPolicy method.

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

| JSON representation |
|---|
| ``` { "alertPolicy": string } ``` |

| Fields ||
|---|---|
| `alertPolicy` | `string` The created Cloud Monitoring AlertPolicy resource name. Format: "projects/{project}/alertPolicies/{alert_policy_id}". |

### Authorization scopes

Requires one of the following OAuth scopes:

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

For more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).

## AlertType

Supported alert types for template generation.

| Enums ||
|---|---|
| `ALERT_TYPE_UNSPECIFIED` | Unknown. |
| `ALERT_TYPE_NEW_ISSUE` | Alert for newly detected issues. |
| `ALERT_TYPE_REGRESSED_ISSUE` | Alert for regressed (reopened) issues. |

## Language

Language options for the generated alert policy.

| Enums ||
|---|---|
| `USER_PREFERENCE` | Use the requester's language preference, falling back to en-US if unavailable or unsupported. |
| `EN_US` | Force the alert policy to be created in en-US. |