# Method: users.importSshPublicKey

- [HTTP request](https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/users/importSshPublicKey#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/users/importSshPublicKey#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/users/importSshPublicKey#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/users/importSshPublicKey#body.request_body)
- [Response body](https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/users/importSshPublicKey#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/users/importSshPublicKey#body.ImportSshPublicKeyResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/users/importSshPublicKey#body.aspect)
- [Try it!](https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/users/importSshPublicKey#try-it)

Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile.

### HTTP request

`POST https://oslogin.googleapis.com/v1/{parent=users/*}:importSshPublicKey`

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The unique ID for the user in format `users/{user}`. |

### Query parameters

| Parameters ||
|---|---|
| `projectId` | `string` The project ID of the Google Cloud Platform project. |
| `regions[]` | `string` Optional. The regions to which to assert that the key was written. If unspecified, defaults to all regions. Regions are listed at <https://cloud.google.com/about/locations#region>. |

### Request body

The request body contains an instance of `https://docs.cloud.google.com/compute/docs/oslogin/rest/Shared.Types/SshPublicKey`.

### Response body

A response message for importing an SSH public key.

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

| JSON representation |
|---|
| ``` { "loginProfile": { object (`https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/LoginProfile`) }, "details": string } ``` |

| Fields ||
|---|---|
| `loginProfile` | ``object (`https://docs.cloud.google.com/compute/docs/oslogin/rest/v1/LoginProfile`)`` The login profile information for the user. |
| `details` | `string` Detailed information about import results. |

### Authorization scopes

Requires one of the following OAuth scopes:

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

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