---
title: Create Users
slug: create-users
docTags: 
createdAt: 2023-11-07T15:25:31.944Z
---

{
  "id": "OwZByWq2a1ekqm_E6mFCd",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://example.com/scim/v2/Users",
    "servers": [
      {
        "url": "https://example.com/scim/v2/Users",
        "description": "Jobylon Staging"
      }
    ],
    "name": "Create Users",
    "description": "<p>Create a new user. The <code>username</code> must be unique, otherwise the object will not be created.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "User with editable attributes",
          "customType": "BaseUser",
          "schema": [
            {
              "name": "id",
              "kind": "optional",
              "type": "string",
              "description": "User's URN in the \"urn:jobylon:scim:<customer_id>:users:<user_id>\" format",
              "example": ""
            },
            {
              "name": "schemas",
              "kind": "optional",
              "type": "array",
              "description": "Schemas",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": ""
            },
            {
              "name": "externalId",
              "kind": "optional",
              "type": "string",
              "description": "The IdP's identifier",
              "example": ""
            },
            {
              "name": "userName",
              "kind": "optional",
              "type": "string",
              "description": "User's username",
              "example": ""
            },
            {
              "name": "name",
              "kind": "optional",
              "type": "object",
              "description": "User name",
              "example": "{\"givenName\":\"Anna\",\"familyName\":\"Svensson\",\"formatted\":\"Anna Svensson\"}",
              "modelRef": "#/components/schemas/Name",
              "customType": "Name",
              "schema": [
                {
                  "name": "givenName",
                  "kind": "optional",
                  "type": "string",
                  "description": "User's given name",
                  "example": ""
                },
                {
                  "name": "familyName",
                  "kind": "optional",
                  "type": "string",
                  "description": "User's family name",
                  "example": ""
                },
                {
                  "name": "formatted",
                  "kind": "optional",
                  "type": "string",
                  "description": "User's formatted name, including family and given names",
                  "example": ""
                }
              ]
            },
            {
              "name": "emails",
              "kind": "optional",
              "type": "array",
              "example": "",
              "itemType": "object",
              "customType": "object[]",
              "schema": [
                {
                  "name": "value",
                  "kind": "optional",
                  "type": "string",
                  "description": "User's email address",
                  "example": ""
                },
                {
                  "name": "primary",
                  "kind": "optional",
                  "type": "boolean",
                  "description": "Indicates if this is the user's main email. Only one of the emails can be set to true.",
                  "example": ""
                }
              ]
            },
            {
              "name": "active",
              "kind": "optional",
              "type": "boolean",
              "description": "Indicates if the user is active (provisioned) or not (deprovisioned). Deprovisioned users still exist in Jobylon, but aren't able to login.",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/BaseUser",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Created",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "409",
        "description": "Conflict",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "x4f17FKUXi_QN3EZe1R6J",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://example.com/scim/v2/Users \\\n     --header 'accept: application/json'"
        },
        {
          "id": "voihYLdRvDyRWsuV8ZwnY",
          "language": "go",
          "label": "Go",
          "code": "package main\n\nimport (\n   \"fmt\"\n   \"net/http\"\n   \"io/ioutil\"\n)\n\nfunc main() {\n\n   url := \"https://example.com/scim/v2/Users\"\n   method := \"POST\"\n\n   client := &http.Client {\n   }\n   req, err := http.NewRequest(method, url, nil)\n\n   if err != nil {\n      fmt.Println(err)\n      return\n   }\n   req.Header.Add(\"accept\", \"application/json\")\n   req.Header.Add(\"content-type\", \"application/json\")\n\n   res, err := client.Do(req)\n   if err != nil {\n      fmt.Println(err)\n      return\n   }\n   defer res.Body.Close()\n\n   body, err := ioutil.ReadAll(res.Body)\n   if err != nil {\n      fmt.Println(err)\n      return\n   }\n   fmt.Println(string(body))\n}"
        },
        {
          "id": "ON5wFX9PwQEXgemIh7GNz",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://example.com/scim/v2/Users\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        },
        {
          "id": "eERC7p1XJw4WZ4R9XDjgv",
          "language": "javascript",
          "label": "JavaScript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://example.com/scim/v2/Users\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "tS5T5rrflzdRdq09rEQ_H",
          "language": "java",
          "label": "Java",
          "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n   .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"\");\nRequest request = new Request.Builder()\n   .url(\"https://example.com/scim/v2/Users\")\n   .method(\"POST\", body)\n   .addHeader(\"accept\", \"application/json\")\n   .addHeader(\"content-type\", \"application/json\")\n   .build();\nResponse response = client.newCall(request).execute();"
        }
      ],
      "selectedLanguageId": "x4f17FKUXi_QN3EZe1R6J"
    },
    "results": {
      "languages": [
        {
          "id": "BZFyQwsnenIcE3Ldrnzwh",
          "language": "201",
          "code": "// Created\n"
        },
        {
          "id": "F0VJP-E6IjdXhhMqFZN3N",
          "language": "409",
          "code": "// Conflict\n"
        }
      ],
      "selectedLanguageId": "BZFyQwsnenIcE3Ldrnzwh"
    }
  },
  "children": [
    {
      "id": "wdFYm1RB7O8f2G8QPURAB",
      "type": "paragraph",
      "children": [
        {
          "text": "Create a new user. The "
        },
        {
          "text": "username",
          "highlight": true
        },
        {
          "text": " must be unique, otherwise the object will not be created."
        }
      ]
    }
  ]
}