---
title: Generate New SSH Key Pair
slug: kron-pam-api-collection-381-patch3/generate-new-ssh-key-pair
docTags: 
createdAt: 2026-10-21T06:07:16.182Z
---

{
  "id": "AOhebrj8OK81YKrNdpGz8",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/sc/ssh/generateNewSshKeyPair",
    "name": "",
    "description": "<h3>Request Overview</h3>\n<p>The <strong>Generate New SSH Key Pair</strong> method creates a public and a private SSH key for the logged-in user.</p>\n<h4>Usage:</h4>\n<ul>\n<li>The method does not require specific parameters to be added in the URL but will generate an SSH key pair for the authenticated session.</li>\n</ul>\n<p>This method is commonly used when users need to establish secure SSH connections without manually creating key pairs.</p>",
    "contentType": "application/json",
    "request": {
      "headerParameters": [
        {
          "name": "Content-Type",
          "description": "",
          "default": "application/json",
          "value": "application/json",
          "type": "string"
        },
        {
          "name": "X-XSRF-TOKEN",
          "description": "",
          "default": "{{csrftoken}}",
          "value": "{{csrftoken}}",
          "type": "string"
        }
      ],
      "queryParameters": [],
      "pathParameters": [
        {
          "name": "url",
          "description": "",
          "default": "url",
          "value": "url",
          "type": "string"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Generate New Ssh Key Pair",
        "jsonExample": "{\n    \"dbId\": 0,\n    \"userId\": \"a177be61-8850-4f03-be1c-3ce275f02c1f\",\n    \"publicKey\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCB1EkBNtKvdF6pgrMFybt7L+leCsdrAu+keJXESuZZXgzCJRmfvpbH/yxpGojePrdeXyDtSNesVPK/4+kd09cHPa9ojrs6oW8JKgaZihYSb/9s5OiTQWTWVv9iXmGq0Kqa5AzNgd8/IQtnjhrrR/E85NRmBtf0yIKi1UO+0WZcl0CKaAwVwWqce+f0a0Do23COzgUU1bveVg1H9FLtzAq5yvgno7YdKZLVT8s9D6XH3P5sWN8/cC0tf7ajqw30YrtrzOjbu4GqxXIeYLHCN1COT4HoiInJ1OZ2dyP3TNrQXzfiZlSQEnHWv/dXazDsiF0NebLa7cboLxanHXyxWo0r testuser\",\n    \"privateKey\": \"{{vault:rsa-private-key}}\\n\",\n    \"creationTime\": 1548419222811,\n    \"expirationTime\": null\n}"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "lK0Z6L5rvBW7lZHD10MVK",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/sc/ssh/generateNewSshKeyPair \\\n     --header 'accept: application/json' \\\n     --header 'x-xsrf-token: {{csrftoken}}'"
        },
        {
          "id": "A9V_OL7Znhb58SSGvcY18",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-xsrf-token\", \"{{csrftoken}}\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/sc/ssh/generateNewSshKeyPair\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "E5rI2E9ErHNvQ4VUiGjf-",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/sc/ssh/generateNewSshKeyPair\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-xsrf-token\"] = \"{{csrftoken}}\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "kH7lP5dvJcs6E1pROGJUP",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/sc/ssh/generateNewSshKeyPair\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-xsrf-token': '{{csrftoken}}'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "lK0Z6L5rvBW7lZHD10MVK"
    },
    "results": {
      "languages": [
        {
          "id": "UhzQbrTQB3F2C2VSoJqM3",
          "language": "200",
          "code": "{\n    \"dbId\": 0,\n    \"userId\": \"a177be61-8850-4f03-be1c-3ce275f02c1f\",\n    \"publicKey\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCB1EkBNtKvdF6pgrMFybt7L+leCsdrAu+keJXESuZZXgzCJRmfvpbH/yxpGojePrdeXyDtSNesVPK/4+kd09cHPa9ojrs6oW8JKgaZihYSb/9s5OiTQWTWVv9iXmGq0Kqa5AzNgd8/IQtnjhrrR/E85NRmBtf0yIKi1UO+0WZcl0CKaAwVwWqce+f0a0Do23COzgUU1bveVg1H9FLtzAq5yvgno7YdKZLVT8s9D6XH3P5sWN8/cC0tf7ajqw30YrtrzOjbu4GqxXIeYLHCN1COT4HoiInJ1OZ2dyP3TNrQXzfiZlSQEnHWv/dXazDsiF0NebLa7cboLxanHXyxWo0r testuser\",\n    \"privateKey\": \"{{vault:rsa-private-key}}\\n\",\n    \"creationTime\": 1548419222811,\n    \"expirationTime\": null\n}"
        }
      ],
      "selectedLanguageId": "UhzQbrTQB3F2C2VSoJqM3"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}