---
title: Add Assigned Credentials For User
slug: kron-pam-api-collection-340/add-assigned-credentials-for-user
docTags: 
createdAt: 2024-07-12T13:38:00.273Z
---

{
  "id": "1TywP8guSd-oqD-wX_FsR",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/sc/assignedCredentials/saveAccount",
    "name": "",
    "description": "<h3>Overview</h3>\n<p>The API stores assigned credentials, adding them to the \"Assigned Credential\" tab in KRON PAM's Web GUI.</p>\n<p>For SAPM account body:</p>\n<p><code>{ \"assignedCredentialUserId\": \"user_id\",</code></p>\n<p><code>\"credentialSource\": \"SAPM\",</code></p>\n<p><code>\"sapmAccountId\": sapm account db_id }</code></p>",
    "contentType": "application/json",
    "request": {
      "headerParameters": [
        {
          "name": "X-XSRF-TOKEN",
          "description": "",
          "default": "{{csrftoken}}",
          "value": "{{csrftoken}}",
          "type": "string"
        }
      ],
      "queryParameters": [],
      "pathParameters": [
        {
          "name": "url",
          "description": "",
          "default": "url",
          "value": "url",
          "type": "string"
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "description": "",
          "default": "{ \"assignedCredentialUserId\": \"0be107c8-5de8-429a-a9e9-934956b23a9f\", \r\n\"credentialSource\": \"SAPM\", \r\n\"sapmAccountId\": 705128 }",
          "value": "{ \"assignedCredentialUserId\": \"0be107c8-5de8-429a-a9e9-934956b23a9f\", \r\n\"credentialSource\": \"SAPM\", \r\n\"sapmAccountId\": 705128 }",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>Add Assigned Credentials - SAPM</p>",
        "jsonExample": "SUCCESS"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "TD3LseakLZ54wJ8Q8SqgR",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/sc/assignedCredentials/saveAccount \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-xsrf-token: {{csrftoken}}' \\\n     --data '\"{ \\\"assignedCredentialUserId\\\": \\\"0be107c8-5de8-429a-a9e9-934956b23a9f\\\", \\r\\n\\\"credentialSource\\\": \\\"SAPM\\\", \\r\\n\\\"sapmAccountId\\\": 705128 }\"'"
        },
        {
          "id": "K2vVpCjIpf3bzevDOekJA",
          "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 raw = JSON.stringify(\"{ \\\"assignedCredentialUserId\\\": \\\"0be107c8-5de8-429a-a9e9-934956b23a9f\\\", \\r\\n\\\"credentialSource\\\": \\\"SAPM\\\", \\r\\n\\\"sapmAccountId\\\": 705128 }\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/sc/assignedCredentials/saveAccount\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "qsIvG0f-9iZxNZU9gB7vm",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/sc/assignedCredentials/saveAccount\")\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}}\"\nrequest.body = JSON.dump(\"{ \\\"assignedCredentialUserId\\\": \\\"0be107c8-5de8-429a-a9e9-934956b23a9f\\\", \\r\\n\\\"credentialSource\\\": \\\"SAPM\\\", \\r\\n\\\"sapmAccountId\\\": 705128 }\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "0hTpk3ZwKlS1Prm_W4YEO",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/sc/assignedCredentials/saveAccount\"\n\npayload = json.dumps(\"{ \\\"assignedCredentialUserId\\\": \\\"0be107c8-5de8-429a-a9e9-934956b23a9f\\\", \\r\\n\\\"credentialSource\\\": \\\"SAPM\\\", \\r\\n\\\"sapmAccountId\\\": 705128 }\")\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": "TD3LseakLZ54wJ8Q8SqgR"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "SUCCESS"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}