- [HTTP request](https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#body.aspect)
- [CheckIfServiceHasUsage](https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#CheckIfServiceHasUsage)
- [Try it!](https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#try-it)

Disable a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks.

It is not valid to call the disable method on a service that is not currently enabled. Callers will receive a `FAILED_PRECONDITION` status if the target service is not currently enabled.

### HTTP request

`POST https://serviceusage.googleapis.com/v1/{name=*/*/services/*}:disable`

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

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Name of the consumer and service to disable the service on. The enable and disable methods currently only support projects. An example name would be: `projects/123/services/serviceusage.googleapis.com` where `123` is the project number. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `name`: - `serviceusage.services.disable` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "disableDependentServices": boolean, "checkIfServiceHasUsage": enum (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#CheckIfServiceHasUsage`) } ``` |

| Fields ||
|---|---|
| `disableDependentServices` | `boolean` Indicates if services that are enabled and which depend on this service should also be disabled. If not set, an error will be generated if any enabled services depend on the service to be disabled. When set, the service, and any enabled services that depend on it, will be disabled together. |
| `checkIfServiceHasUsage` | ``enum (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v1/services/disable#CheckIfServiceHasUsage`)`` Defines the behavior for checking service usage when disabling a service. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/service-usage/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

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

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

## CheckIfServiceHasUsage

Enum to determine if service usage should be checked when disabling a service.

| Enums ||
|---|---|
| `CHECK_IF_SERVICE_HAS_USAGE_UNSPECIFIED` | When unset, the default behavior is used, which is SKIP. |
| `SKIP` | If set, skip checking service usage when disabling a service. |
| `CHECK` | If set, service usage is checked when disabling the service. If a service, or its dependents, has usage in the last 30 days, the request returns a FAILED_PRECONDITION error. |