---
title: Save User
slug: single-connect-api-3-0-3/save-user
description: Learn how to save user data using curl in this helpful code example. Perform a POST request to a specific URL, including JSON headers, and see a sample JSON body for reference. Master the art of handling data efficiently with this informative document.
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "lgRcWgTtxoF5bnAUcGMyt",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/user/saveUser",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "{\r\n\t\"internal\":true,\r\n\"personelId\":\"123123\",\"name\":\"test\",\"surname\":\"user\",\"eid\":\"testuser\",\"email\":\"test@test.com\",\"phoneNumber\":\"5550000000\",\"groups\":[\"DEFAULT_GROUP_SYSYEM_USERS\", \"DEFAULT_GROUP_SYSYEM_ADMINS\"], \"password\":\"admin\", \"passwordAlgorithm\":\"MD5\"\r\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Add User",
        "jsonExample": "{\n    \"id\": \"3c040987-adb7-45ab-9a50-264f04fbe13a\",\n    \"eid\": \"testuser\",\n    \"personelId\": \"123123\",\n    \"name\": \"test\",\n    \"passwordAlgorithm\": \"MD5\",\n    \"password\": \"21232f297a57a5a743894a0e4a801fc3\",\n    \"email\": \"test@test.com\",\n    \"surname\": \"user\",\n    \"internal\": true,\n    \"properties\": {\n        \"phoneNumber\": \"5550000000\",\n        \"ubaThreshold\": \"50\"\n    },\n    \"groups\": [\n        \"DEFAULT_GROUP_SYSYEM_ADMINS\",\n        \"DEFAULT_GROUP_SYSYEM_USERS\"\n    ],\n    \"managerGroups\": null,\n    \"lastLogin\": null,\n    \"lastLoginIp\": null,\n    \"recordLimit4Search\": null,\n    \"passwordDirty\": false,\n    \"passwordAutoGenerated\": false,\n    \"phoneNumber\": \"5550000000\",\n    \"forceChangePasswordOnNextLogin\": false,\n    \"lockReason\": null,\n    \"unlockOnPasswordChanged\": false,\n    \"unlockTime\": null,\n    \"tempUserEndTime\": null,\n    \"tempUserStartTime\": null,\n    \"tempUser\": false,\n    \"externalDirectorySource\": null,\n    \"userPropertyKey4Search\": null,\n    \"userPropertyValue4Search\": null,\n    \"locked\": false\n}"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method adds a new user to Single Connect.</p>\n<p>Mandatory fields in request body:\n\"name\",\"surname\",\"eid\",\"email\" are all required.\n\"password\" field is also required for internal users</p>",
    "examples": {
      "languages": [
        {
          "id": "GVTSF9f6q5h-915DM6yMj",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/user/saveUser \\\n     --header 'accept: application/json'"
        },
        {
          "id": "hEyjoUQ0N69uzkGDiOmXL",
          "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/user/saveUser\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ZeLFTZ2NXmjbt74CX8WFh",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/user/saveUser\")\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": "V-SeKfcBRJGTjeyPfoonQ",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/user/saveUser\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "GVTSF9f6q5h-915DM6yMj"
    },
    "results": {
      "languages": [
        {
          "id": "s9sWeutJDocOGROe6oaH-",
          "language": "200",
          "code": "{\n    \"id\": \"3c040987-adb7-45ab-9a50-264f04fbe13a\",\n    \"eid\": \"testuser\",\n    \"personelId\": \"123123\",\n    \"name\": \"test\",\n    \"passwordAlgorithm\": \"MD5\",\n    \"password\": \"21232f297a57a5a743894a0e4a801fc3\",\n    \"email\": \"test@test.com\",\n    \"surname\": \"user\",\n    \"internal\": true,\n    \"properties\": {\n        \"phoneNumber\": \"5550000000\",\n        \"ubaThreshold\": \"50\"\n    },\n    \"groups\": [\n        \"DEFAULT_GROUP_SYSYEM_ADMINS\",\n        \"DEFAULT_GROUP_SYSYEM_USERS\"\n    ],\n    \"managerGroups\": null,\n    \"lastLogin\": null,\n    \"lastLoginIp\": null,\n    \"recordLimit4Search\": null,\n    \"passwordDirty\": false,\n    \"passwordAutoGenerated\": false,\n    \"phoneNumber\": \"5550000000\",\n    \"forceChangePasswordOnNextLogin\": false,\n    \"lockReason\": null,\n    \"unlockOnPasswordChanged\": false,\n    \"unlockTime\": null,\n    \"tempUserEndTime\": null,\n    \"tempUserStartTime\": null,\n    \"tempUser\": false,\n    \"externalDirectorySource\": null,\n    \"userPropertyKey4Search\": null,\n    \"userPropertyValue4Search\": null,\n    \"locked\": false\n}"
        }
      ],
      "selectedLanguageId": "s9sWeutJDocOGROe6oaH-"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}