Create Linked Account
POST {{apiPath}}/environments/{{envID}}/users/{{userID}}/linkedAccounts
The POST /environments/{{envID}}/users/{{userID}}/linkedAccounts operation creates a linked account to an external identity provider for the user resource with the ID specified in the request URL.
This operation uses the application/vnd.pingidentity.account.link+json custom content type in the request header, and it must specify the identityProvider.Id and the externalId for the user account in the request body. The request body can also specify an optional list of user attributes to update during the account linking action.
Prerequisites
See Users for important overview information.
Create a user to get a
userIDandusername. See Create User. Run Read User or Users to find an existing user.See Identity Providers for more information about adding an identity provider for the
idpIDvalue. Run Read All Identity Providers to find an existing IdP.
| Property | Type | Required? |
|---|---|---|
identityProvider.id | String | Required |
externalId | String | Required |
See the Linked Accounts data model for full property descriptions.
Request Body
{"identityProvider"=>{"id"=>"{{idpID}}"}, "externalId"=>"3249023841", "attributes"=>{"username"=>{"value"=>"{{username}}", "update"=>"EMPTY_ONLY"}, "email"=>{"value"=>"{{email}}", "update"=>"EMPTY_ONLY"}, "name.first"=>{"value"=>"leslie", "update"=>"ALWAYS"}, "name.last"=>{"value"=>"Jones", "update"=>"EMPTY_ONLY"}}}
HEADERS
| Key | Datatype | Required | Description |
|---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
{"_links":{"self":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/788d4931-6936-43f2-82ff-178f5762298a/linkedAccounts/21fc98ed-5d1c-4fe4-b91e-acde99ce35a9"},"environment":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"user":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/788d4931-6936-43f2-82ff-178f5762298a"}},"_embedded":{"user":{"_embedded":{"password":{"status":"PASSWORD_EXPIRED"},"population":{"id":"f22842c9-f1eb-41a5-8072-20041b609cf1"}},"id":"788d4931-6936-43f2-82ff-178f5762298a","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"account":{"canAuthenticate":true,"status":"OK"},"accountId":"5","address":{"streetAddress":"123 Fake Street","locality":"Springfield","region":"Somewhere","postalCode":"78701","countryCode":"US"},"createdAt":"2021-03-02T18:19:26.564Z","email":"test@test.com","enabled":true,"identityProvider":{"type":"PING_ONE"},"lastSignOn":{"at":"2021-03-31T19:37:12.129Z","remoteIp":"174.21.110.237"},"lifecycle":{"status":"ACCOUNT_OK"},"locale":"en-gb","mfaEnabled":true,"mobilePhone":"+1.4445552222","name":{"formatted":"Leslie Jones","given":"Leslie","middle":"L","family":"Jones","honorificPrefix":"Dr.","honorificSuffix":"IV"},"nickname":"Les","population":{"id":"f22842c9-f1eb-41a5-8072-20041b609cf1"},"preferredLanguage":"en-gb;q=0.8, en;q=0.7","primaryPhone":"+1.2225554444","timezone":"America/Los_Angeles","title":"Senior Manager","type":"tele","updatedAt":"2022-02-09T23:52:15.936Z","username":"lesliejones@example.com","verifyStatus":"NOT_INITIATED"}},"id":"21fc98ed-5d1c-4fe4-b91e-acde99ce35a9","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"user":{"id":"788d4931-6936-43f2-82ff-178f5762298a"},"identityProvider":{"id":"302990c0-289d-40ec-a2ff-e7c7fd0cca63"},"externalId":"3249023841"}