---
title: Update Ssh Key Pair
slug: single-connect-api-3-0-3/update-ssh-key-pair
description: Learn how to update an SSH key pair in a REST API with this comprehensive code example. Follow the step-by-step tutorial on executing a Curl command for a POST request, complete with headers and data payload format. Master the art of securely managing you
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "X9Cq4KifS5EI8_Pbmptps",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/sc/ssh/updateSshKeyPair",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Cookie",
          "type": "string",
          "example": "{{netrightCookie}}",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCT0z1soO5j6g4mYJM2E79hjGRAiUWC2E8/On8dj/8TU/A+LDQvtXAiCE878uk0QHcugQGJ6tju4UKJMZc59Cs44t68/J0pcrWRi8wWyx5MALPULhEeDQ29d5540ihI9hsSDTKBcYj0VzPtFlaLEWL/EZdJWVbGUYNAzNXb92odCGpicQAagykXqzzi6a7Fk77jNl7hK4eUeyXZRxM6GAfk7HPzYZvoX+EsfAQXF3BeV2dQUTVt1Wx+mGUDoD9SopuxNg5Io1pDcklhQwt33Ts2HgdbQAzy+69DSi/D5bMjtbAVFVtZk9Uf3LA7g3sLVQ1lDKAnRPqdIdrT0DgSoPFX admin",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "updateSshKeyPair",
        "jsonExample": "true"
      }
    ],
    "contentType": "application/json",
    "description": "This method updates the public SSH key of the logged in user.\n\nEnter new public key in \"Body\" field.",
    "examples": {
      "languages": [
        {
          "id": "OiYydbyZpqgzpqGy7V0kg",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/sc/ssh/updateSshKeyPair \\\n     --header 'accept: application/json'"
        },
        {
          "id": "o3Yv6BXys9_Ouu6WVFZ5J",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/sc/ssh/updateSshKeyPair\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "biGisQ1ueNR-k29MKGYjG",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/sc/ssh/updateSshKeyPair\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "PnpdNhvEpkQvLUilq3DIw",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/sc/ssh/updateSshKeyPair\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "OiYydbyZpqgzpqGy7V0kg"
    },
    "results": {
      "languages": [
        {
          "id": "NKKYrdn6JueKO5g81U8XD",
          "language": "200",
          "code": "true"
        }
      ],
      "selectedLanguageId": "NKKYrdn6JueKO5g81U8XD"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}