PingOne Platform APIs

Create SCIM User

 

POST {{scimPath}}/environments/{{envID}}/v2/Users

The POST {{scimPath}}/environments/{{envID}}/v2/Users operation creates a SCIM user in the specified environment.

Prerequisites

Request Model

Refer to the SCIM user data model for full property descriptions.

Property Type Required

addresses.country

String

Optional

addresses.formatted

String

Optional

addresses.locality

String

Optional

addresses.postalCode

String

Optional

addresses.region

String

Optional

addresses.streetAddress

String

Optional

addresses

Object

Optional

emails

String

Optional

externalId

String

Optional

locale

String

Optional

name.familyName

String

Optional

name.formatted

String

Optional

name.givenName

String

Optional

name.honorificPrefix

String

Optional

name.honorificSuffix

String

Optional

name.middleName

String

Optional

name

Object

Optional

nickName

String

Optional

password

String

Required

phoneNumbers

String

Optional

photos

Object

Optional

preferredLanguage

String

Optional

timezone

DateTime

Optional

title

String

Optional

urn:pingidentity:
schemas:extension:2.0:
PingOneUser.population.id

String

Optional

userName

String

Required

Headers

Authorization      Bearer {{accessToken}}

Content-Type      application/json

Body

raw ( application/json )

{
    "userName": "tmp-IsabellaI-12",
    "name": {
        "formatted": "Isabella",
        "familyName": "Castile",
        "givenName": "Isabella",
        "middleName": "of",
        "honorificPrefix": "Ms."
    },
    "nickName": "Isa",
    "title": "Principal Engineer",
    "preferredLanguage": "en",
    "emails": [
        {
            "value": "IsabellaOfCastile@example.com",
            "primary": true
        }
    ],
    "phoneNumbers": [
        {
            "value": "+1.215-987-6543",
            "type": "primary",
            "primary": true
        }
    ],
    "addresses": [
        {
            "streetAddress": "8 Mile Rd.",
            "locality": "Detroit",
            "region": "MI",
            "postalCode": "48203",
            "country": "US",
            "primary": true
        }
    ],
    "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
        "population": {
            "id": "{{popID}}"
        }
    }
}

Example Request

  • cURL

  • C#

  • Go

  • HTTP

  • Java

  • jQuery

  • NodeJS

  • Python

  • PHP

  • Ruby

  • Swift

curl --location --globoff '{{scimPath}}/environments/{{envID}}/v2/Users' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data-raw '{
    "userName": "tmp-IsabellaI-12",
    "name": {
        "formatted": "Isabella",
        "familyName": "Castile",
        "givenName": "Isabella",
        "middleName": "of",
        "honorificPrefix": "Ms."
    },
    "nickName": "Isa",
    "title": "Principal Engineer",
    "preferredLanguage": "en",
    "emails": [
        {
            "value": "IsabellaOfCastile@example.com",
            "primary": true
        }
    ],
    "phoneNumbers": [
        {
            "value": "+1.215-987-6543",
            "type": "primary",
            "primary": true
        }
    ],
    "addresses": [
        {
            "streetAddress": "8 Mile Rd.",
            "locality": "Detroit",
            "region": "MI",
            "postalCode": "48203",
            "country": "US",
            "primary": true
        }
    ],
    "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
        "population": {
            "id": "{{popID}}"
        }
    }
}'
var options = new RestClientOptions("{{scimPath}}/environments/{{envID}}/v2/Users")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer {{accessToken}}");
var body = @"{" + "\n" +
@"    ""userName"": ""tmp-IsabellaI-12""," + "\n" +
@"    ""name"": {" + "\n" +
@"        ""formatted"": ""Isabella""," + "\n" +
@"        ""familyName"": ""Castile""," + "\n" +
@"        ""givenName"": ""Isabella""," + "\n" +
@"        ""middleName"": ""of""," + "\n" +
@"        ""honorificPrefix"": ""Ms.""" + "\n" +
@"    }," + "\n" +
@"    ""nickName"": ""Isa""," + "\n" +
@"    ""title"": ""Principal Engineer""," + "\n" +
@"    ""preferredLanguage"": ""en""," + "\n" +
@"    ""emails"": [" + "\n" +
@"        {" + "\n" +
@"            ""value"": ""IsabellaOfCastile@example.com""," + "\n" +
@"            ""primary"": true" + "\n" +
@"        }" + "\n" +
@"    ]," + "\n" +
@"    ""phoneNumbers"": [" + "\n" +
@"        {" + "\n" +
@"            ""value"": ""+1.215-987-6543""," + "\n" +
@"            ""type"": ""primary""," + "\n" +
@"            ""primary"": true" + "\n" +
@"        }" + "\n" +
@"    ]," + "\n" +
@"    ""addresses"": [" + "\n" +
@"        {" + "\n" +
@"            ""streetAddress"": ""8 Mile Rd.""," + "\n" +
@"            ""locality"": ""Detroit""," + "\n" +
@"            ""region"": ""MI""," + "\n" +
@"            ""postalCode"": ""48203""," + "\n" +
@"            ""country"": ""US""," + "\n" +
@"            ""primary"": true" + "\n" +
@"        }" + "\n" +
@"    ]," + "\n" +
@"    ""urn:pingidentity:schemas:extension:2.0:PingOneUser"": {" + "\n" +
@"        ""population"": {" + "\n" +
@"            ""id"": ""{{popID}}""" + "\n" +
@"        }" + "\n" +
@"    }" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "{{scimPath}}/environments/{{envID}}/v2/Users"
  method := "POST"

  payload := strings.NewReader(`{
    "userName": "tmp-IsabellaI-12",
    "name": {
        "formatted": "Isabella",
        "familyName": "Castile",
        "givenName": "Isabella",
        "middleName": "of",
        "honorificPrefix": "Ms."
    },
    "nickName": "Isa",
    "title": "Principal Engineer",
    "preferredLanguage": "en",
    "emails": [
        {
            "value": "IsabellaOfCastile@example.com",
            "primary": true
        }
    ],
    "phoneNumbers": [
        {
            "value": "+1.215-987-6543",
            "type": "primary",
            "primary": true
        }
    ],
    "addresses": [
        {
            "streetAddress": "8 Mile Rd.",
            "locality": "Detroit",
            "region": "MI",
            "postalCode": "48203",
            "country": "US",
            "primary": true
        }
    ],
    "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
        "population": {
            "id": "{{popID}}"
        }
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer {{accessToken}}")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
POST /environments/{{envID}}/v2/Users HTTP/1.1
Host: {{scimPath}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}

{
    "userName": "tmp-IsabellaI-12",
    "name": {
        "formatted": "Isabella",
        "familyName": "Castile",
        "givenName": "Isabella",
        "middleName": "of",
        "honorificPrefix": "Ms."
    },
    "nickName": "Isa",
    "title": "Principal Engineer",
    "preferredLanguage": "en",
    "emails": [
        {
            "value": "IsabellaOfCastile@example.com",
            "primary": true
        }
    ],
    "phoneNumbers": [
        {
            "value": "+1.215-987-6543",
            "type": "primary",
            "primary": true
        }
    ],
    "addresses": [
        {
            "streetAddress": "8 Mile Rd.",
            "locality": "Detroit",
            "region": "MI",
            "postalCode": "48203",
            "country": "US",
            "primary": true
        }
    ],
    "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
        "population": {
            "id": "{{popID}}"
        }
    }
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"userName\": \"tmp-IsabellaI-12\",\n    \"name\": {\n        \"formatted\": \"Isabella\",\n        \"familyName\": \"Castile\",\n        \"givenName\": \"Isabella\",\n        \"middleName\": \"of\",\n        \"honorificPrefix\": \"Ms.\"\n    },\n    \"nickName\": \"Isa\",\n    \"title\": \"Principal Engineer\",\n    \"preferredLanguage\": \"en\",\n    \"emails\": [\n        {\n            \"value\": \"IsabellaOfCastile@example.com\",\n            \"primary\": true\n        }\n    ],\n    \"phoneNumbers\": [\n        {\n            \"value\": \"+1.215-987-6543\",\n            \"type\": \"primary\",\n            \"primary\": true\n        }\n    ],\n    \"addresses\": [\n        {\n            \"streetAddress\": \"8 Mile Rd.\",\n            \"locality\": \"Detroit\",\n            \"region\": \"MI\",\n            \"postalCode\": \"48203\",\n            \"country\": \"US\",\n            \"primary\": true\n        }\n    ],\n    \"urn:pingidentity:schemas:extension:2.0:PingOneUser\": {\n        \"population\": {\n            \"id\": \"{{popID}}\"\n        }\n    }\n}");
Request request = new Request.Builder()
  .url("{{scimPath}}/environments/{{envID}}/v2/Users")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {{accessToken}}")
  .build();
Response response = client.newCall(request).execute();
var settings = {
  "url": "{{scimPath}}/environments/{{envID}}/v2/Users",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer {{accessToken}}"
  },
  "data": JSON.stringify({
    "userName": "tmp-IsabellaI-12",
    "name": {
      "formatted": "Isabella",
      "familyName": "Castile",
      "givenName": "Isabella",
      "middleName": "of",
      "honorificPrefix": "Ms."
    },
    "nickName": "Isa",
    "title": "Principal Engineer",
    "preferredLanguage": "en",
    "emails": [
      {
        "value": "IsabellaOfCastile@example.com",
        "primary": true
      }
    ],
    "phoneNumbers": [
      {
        "value": "+1.215-987-6543",
        "type": "primary",
        "primary": true
      }
    ],
    "addresses": [
      {
        "streetAddress": "8 Mile Rd.",
        "locality": "Detroit",
        "region": "MI",
        "postalCode": "48203",
        "country": "US",
        "primary": true
      }
    ],
    "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
      "population": {
        "id": "{{popID}}"
      }
    }
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
var request = require('request');
var options = {
  'method': 'POST',
  'url': '{{scimPath}}/environments/{{envID}}/v2/Users',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{accessToken}}'
  },
  body: JSON.stringify({
    "userName": "tmp-IsabellaI-12",
    "name": {
      "formatted": "Isabella",
      "familyName": "Castile",
      "givenName": "Isabella",
      "middleName": "of",
      "honorificPrefix": "Ms."
    },
    "nickName": "Isa",
    "title": "Principal Engineer",
    "preferredLanguage": "en",
    "emails": [
      {
        "value": "IsabellaOfCastile@example.com",
        "primary": true
      }
    ],
    "phoneNumbers": [
      {
        "value": "+1.215-987-6543",
        "type": "primary",
        "primary": true
      }
    ],
    "addresses": [
      {
        "streetAddress": "8 Mile Rd.",
        "locality": "Detroit",
        "region": "MI",
        "postalCode": "48203",
        "country": "US",
        "primary": true
      }
    ],
    "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
      "population": {
        "id": "{{popID}}"
      }
    }
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests
import json

url = "{{scimPath}}/environments/{{envID}}/v2/Users"

payload = json.dumps({
  "userName": "tmp-IsabellaI-12",
  "name": {
    "formatted": "Isabella",
    "familyName": "Castile",
    "givenName": "Isabella",
    "middleName": "of",
    "honorificPrefix": "Ms."
  },
  "nickName": "Isa",
  "title": "Principal Engineer",
  "preferredLanguage": "en",
  "emails": [
    {
      "value": "IsabellaOfCastile@example.com",
      "primary": True
    }
  ],
  "phoneNumbers": [
    {
      "value": "+1.215-987-6543",
      "type": "primary",
      "primary": True
    }
  ],
  "addresses": [
    {
      "streetAddress": "8 Mile Rd.",
      "locality": "Detroit",
      "region": "MI",
      "postalCode": "48203",
      "country": "US",
      "primary": True
    }
  ],
  "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
    "population": {
      "id": "{{popID}}"
    }
  }
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {{accessToken}}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{scimPath}}/environments/{{envID}}/v2/Users');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer {{accessToken}}'
));
$request->setBody('{\n    "userName": "tmp-IsabellaI-12",\n    "name": {\n        "formatted": "Isabella",\n        "familyName": "Castile",\n        "givenName": "Isabella",\n        "middleName": "of",\n        "honorificPrefix": "Ms."\n    },\n    "nickName": "Isa",\n    "title": "Principal Engineer",\n    "preferredLanguage": "en",\n    "emails": [\n        {\n            "value": "IsabellaOfCastile@example.com",\n            "primary": true\n        }\n    ],\n    "phoneNumbers": [\n        {\n            "value": "+1.215-987-6543",\n            "type": "primary",\n            "primary": true\n        }\n    ],\n    "addresses": [\n        {\n            "streetAddress": "8 Mile Rd.",\n            "locality": "Detroit",\n            "region": "MI",\n            "postalCode": "48203",\n            "country": "US",\n            "primary": true\n        }\n    ],\n    "urn:pingidentity:schemas:extension:2.0:PingOneUser": {\n        "population": {\n            "id": "{{popID}}"\n        }\n    }\n}');
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
require "uri"
require "json"
require "net/http"

url = URI("{{scimPath}}/environments/{{envID}}/v2/Users")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer {{accessToken}}"
request.body = JSON.dump({
  "userName": "tmp-IsabellaI-12",
  "name": {
    "formatted": "Isabella",
    "familyName": "Castile",
    "givenName": "Isabella",
    "middleName": "of",
    "honorificPrefix": "Ms."
  },
  "nickName": "Isa",
  "title": "Principal Engineer",
  "preferredLanguage": "en",
  "emails": [
    {
      "value": "IsabellaOfCastile@example.com",
      "primary": true
    }
  ],
  "phoneNumbers": [
    {
      "value": "+1.215-987-6543",
      "type": "primary",
      "primary": true
    }
  ],
  "addresses": [
    {
      "streetAddress": "8 Mile Rd.",
      "locality": "Detroit",
      "region": "MI",
      "postalCode": "48203",
      "country": "US",
      "primary": true
    }
  ],
  "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
    "population": {
      "id": "{{popID}}"
    }
  }
})

response = http.request(request)
puts response.read_body
let parameters = "{\n    \"userName\": \"tmp-IsabellaI-12\",\n    \"name\": {\n        \"formatted\": \"Isabella\",\n        \"familyName\": \"Castile\",\n        \"givenName\": \"Isabella\",\n        \"middleName\": \"of\",\n        \"honorificPrefix\": \"Ms.\"\n    },\n    \"nickName\": \"Isa\",\n    \"title\": \"Principal Engineer\",\n    \"preferredLanguage\": \"en\",\n    \"emails\": [\n        {\n            \"value\": \"IsabellaOfCastile@example.com\",\n            \"primary\": true\n        }\n    ],\n    \"phoneNumbers\": [\n        {\n            \"value\": \"+1.215-987-6543\",\n            \"type\": \"primary\",\n            \"primary\": true\n        }\n    ],\n    \"addresses\": [\n        {\n            \"streetAddress\": \"8 Mile Rd.\",\n            \"locality\": \"Detroit\",\n            \"region\": \"MI\",\n            \"postalCode\": \"48203\",\n            \"country\": \"US\",\n            \"primary\": true\n        }\n    ],\n    \"urn:pingidentity:schemas:extension:2.0:PingOneUser\": {\n        \"population\": {\n            \"id\": \"{{popID}}\"\n        }\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{scimPath}}/environments/{{envID}}/v2/Users")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("Bearer {{accessToken}}", forHTTPHeaderField: "Authorization")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()

Example Response

201 Created

{
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:User",
        "urn:pingidentity:schemas:extension:2.0:PingOneUser"
    ],
    "id": "14c9726d-861b-45c0-b464-92f546003d26",
    "meta": {
        "resourceType": "User",
        "created": "2023-03-07T19:24:28.621Z",
        "lastModified": "2023-03-07T19:24:28.621Z",
        "location": "https://scim-api.pingone.com/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/v2/Users/14c9726d-861b-45c0-b464-92f546003d26"
    },
    "userName": "tmp-IsabellaI-12",
    "name": {
        "formatted": "Isabella",
        "familyName": "Castile",
        "givenName": "Isabella",
        "middleName": "of",
        "honorificPrefix": "Ms."
    },
    "nickName": "Isa",
    "title": "Principal Engineer",
    "preferredLanguage": "en",
    "active": true,
    "emails": [
        {
            "value": "IsabellaOfCastile@example.com",
            "primary": true
        }
    ],
    "phoneNumbers": [
        {
            "value": "+1.215-987-6543",
            "type": "primary",
            "primary": true
        }
    ],
    "addresses": [
        {
            "streetAddress": "8 Mile Rd.",
            "locality": "Detroit",
            "region": "MI",
            "postalCode": "48203",
            "country": "US",
            "primary": true
        }
    ],
    "urn:pingidentity:schemas:extension:2.0:PingOneUser": {
        "population": {
            "id": "cb3ef0a0-0ff5-4f60-ae82-4ae65d9d0e3a"
        }
    }
}