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
[[["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 facilitates the addition of an SSH public key to a user's profile, setting default POSIX account information if none is present.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePOST\u003c/code\u003e request is made to a specific URL structure defined by gRPC Transcoding, requiring a user ID in the path and optionally accepting project ID and region parameters as query strings.\u003c/p\u003e\n"],["\u003cp\u003eThe request body expects an instance of \u003ccode\u003eSshPublicKey\u003c/code\u003e, while the successful response body contains a \u003ccode\u003eLoginProfile\u003c/code\u003e object and detailed information about the import results.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization to use this API requires specific OAuth scopes, namely \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/compute\u003c/code\u003e.\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/v1/{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)."]]