---
title: Add Assigned Credentials
slug: single-connect-api-3-0-3/add-assigned-credentials
description: Learn how to save an account using the curl command with headers and data in this code example. Follow along to understand the process of making a POST request to a specific endpoint and ensure your account is securely stored.
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "Z9jR-cCgd2ILosvtXYj1Z",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/sc/assignedCredentials/saveAccount",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "{ \"assignedCredentialUserId\": \"0be107c8-5de8-429a-a9e9-934956b23a9f\", \r\n\"credentialSource\": \"SAPM\", \r\n\"sapmAccountId\": 705128 }",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>Add Assigned Credentials - Secret Data Vault</p>",
        "jsonExample": "SUCCESS"
      },
      {
        "statusCode": "200",
        "description": "<p>Add Assigned Credentials - SAPM</p>",
        "jsonExample": "SUCCESS"
      }
    ],
    "contentType": "application/json",
    "description": "<p>The api saves assigned credentials. The request is different for secret data vault and SAPM accounts.</p>\n<p>The parameters for SDV Account body:\r\n{ \"assignedCredentialUserId\":\"user_id\",\r\n\"credentialSource\":\"SECRET_DATA_VAULT\",\r\n\"secretDataVaultId\": secret data vault db_id }</p>\n<p>for SAPM account body:</p>\n<p>{ \"assignedCredentialUserId\": \"user_id\",\r\n\"credentialSource\": \"SAPM\",\r\n\"sapmAccountId\": sapm account db_id }</p>",
    "examples": {
      "languages": [
        {
          "id": "8--o3k7dX8NUe_1ycqtI2",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/sc/assignedCredentials/saveAccount \\\n     --header 'accept: application/json'"
        },
        {
          "id": "AVnIre1qa0BuZsAEG-49P",
          "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/assignedCredentials/saveAccount\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "2LwUD04Ah2lvZ4v4uI-lz",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\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\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "yBodrszomt1RfQ6QURmQJ",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/sc/assignedCredentials/saveAccount\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "8--o3k7dX8NUe_1ycqtI2"
    },
    "results": {
      "languages": [
        {
          "id": "mF-GL7CNVHpG31udydjLj",
          "language": "200",
          "code": "SUCCESS"
        },
        {
          "id": "1NC8BACmR_5ZHI05qT4gB",
          "language": "200",
          "code": "SUCCESS"
        }
      ],
      "selectedLanguageId": "mF-GL7CNVHpG31udydjLj"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}