# Method: projects.locations.instances.rename

- [HTTP request](https://docs.cloud.google.com/bare-metal/docs/reference/rest/v2/projects.locations.instances/rename#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/bare-metal/docs/reference/rest/v2/projects.locations.instances/rename#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/bare-metal/docs/reference/rest/v2/projects.locations.instances/rename#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/bare-metal/docs/reference/rest/v2/projects.locations.instances/rename#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/bare-metal/docs/reference/rest/v2/projects.locations.instances/rename#body.response_body)
- [Authorization Scopes](https://docs.cloud.google.com/bare-metal/docs/reference/rest/v2/projects.locations.instances/rename#body.aspect)
- [Try it!](https://docs.cloud.google.com/bare-metal/docs/reference/rest/v2/projects.locations.instances/rename#try-it)

instances.rename sets a new name for an instance.

### HTTP request

`POST https://baremetalsolution.googleapis.com/v2/{name=projects/*/locations/*/instances/*}:rename`

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

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The `name` field is used to identify the instance. Format: projects/{project}/locations/{location}/instances/{instance} |

### Request body

The request body contains data with the following structure:

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

| Fields ||
|---|---|
| `newName` | `string` Required. The new `name` of the instance. Format: {instancename} |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/bare-metal/docs/reference/rest/v2/projects.locations.instances#Instance`.

### Authorization Scopes

Requires the following OAuth scope:

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

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