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/v1beta/{parent=users/*}:importSshPublicKey
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-28 UTC."],[[["\u003cp\u003eThis API endpoint allows users to add an SSH public key to their profile, setting default POSIX account details when no username or UID is present.\u003c/p\u003e\n"],["\u003cp\u003eThe HTTP request is a POST method to a specific URL structure utilizing gRPC Transcoding, requiring a \u003ccode\u003eparent\u003c/code\u003e path parameter that uniquely identifies the user.\u003c/p\u003e\n"],["\u003cp\u003eQuery parameters like \u003ccode\u003eprojectId\u003c/code\u003e, \u003ccode\u003eview\u003c/code\u003e, and \u003ccode\u003eregions[]\u003c/code\u003e are optional and provide configuration options for the request, including setting the Google Cloud project, retrieving security key information, and specifying regions.\u003c/p\u003e\n"],["\u003cp\u003eThe request body requires an instance of \u003ccode\u003eSshPublicKey\u003c/code\u003e, and the successful response includes a \u003ccode\u003eLoginProfile\u003c/code\u003e object and detailed information about the import results in JSON format.\u003c/p\u003e\n"],["\u003cp\u003eAccessing this endpoint requires either the \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/compute\u003c/code\u003e OAuth scope for authorization.\u003c/p\u003e\n"]]],[],null,["# Method: users.importSshPublicKey\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ImportSshPublicKeyResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nAdds 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.\n\n### HTTP request\n\n`POST https://oslogin.googleapis.com/v1beta/{parent=users/*}:importSshPublicKey`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Query parameters\n\n### Request body\n\nThe request body contains an instance of [SshPublicKey](/compute/docs/oslogin/rest/Shared.Types/SshPublicKey).\n\n### Response body\n\nA response message for importing an SSH public key.\n\nIf successful, the response body contains data with the following structure:\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n- `\n https://www.googleapis.com/auth/compute`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]