Migrate users to Identity Pools
Learn how to migrate users from external CIAM platforms into your Identity Pool using dedicated APIs. Change your CIAM platform to securely and reliably store user data, maintaining performance and integrity even at large scales.
About migrating users
You can import users into the SecureAuth Identity Pool for a tenant. If your current CIAM solution outside of SecureAuth doesn't meet your needs, consider migrating external users to Identity Pools for secure and scalable storage.
To migrate users, use the SecureAuth Import Identity Tenant API.
You can also migrate users between tenants and Identity Pools. To do this, use the Export Identity Tenant API followed by the Import Identity Tenant API. However, exporting users is not recommended for production environments.
Prerequisites
An Identity Pool for importing or exporting user data
Access to the System workspace
A client application in the System workspace with the
manage_configuration
scope to obtain an access token for user importNote
The
The Preconfigure your workspace section describes how to create a client application for the Admin workspace and admin APIs. To proceed, create a similar application in the System workspace and assign it the
manage_configuration
scope.Prepare input data for import
Manage tenant user data
Use the System API to import or export users for a specific tenant.
Import users
Get an access token.
Call the OAuth 2.0 token endpoint as the System client obtain an access token with the
manage_configuration
scope.curl --location --request POST 'https://example.com/tenant_id/system/oauth2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'client_id=value' \ --data-urlencode 'client_secret=secret'
Result: The token is returned and includes the
manage_configuration
scope.Need help? See the Call the token endpoint section in Call Token Endpoint.
Import user data.
Call the Import Tenant Configuration endpoint and include the user data in the request body:
curl --location --request PUT 'https://example.com/api/identity/system/{tid}/configuration' \ -H 'Authorization: Bearer {ACCESS_TOKEN}' \ -d @configuration.json
Replace
{tid}
with your tenant ID and{ACCESS_TOKEN}
with the token from the first step.Include the user data payload directly in the request body or reference a JSON file with the
-d @YourFileName.json
parameter.
Result: A
204 NO CONTENT
response confirms your tenant configuration is successfully imported and available.
Export users
Warning
The Export API is not production-ready for large user bases. Use it only for testing or beta purposes.
Get an access token.
Call the OAuth 2.0 token endpoint as the System client obtain an access token with the
manage_configuration
scope.curl --location --request POST 'https://example.com/tenant_id/system/oauth2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'client_id=value' \ --data-urlencode 'client_secret=secret'
Result: The token is returned and includes the
manage_configuration
scope.Need help? See the Call the token endpoint section in Call Token Endpoint.
Export user data.
Call the Export Tenant Configuration endpoint to retrieve user data:
curl --location --request GET 'https://example.com/api/identity/system/{tid}/configuration' \ --header 'Authorization: Bearer {ACCESS_TOKEN}'
Replace
{tid}
with your tenant ID and{ACCESS_TOKEN}
with the token from the first step.
Result: A
200 OK
response returns your tenant configuration, including Identity Pools and their users, as JSON is in the response body.
Insert mode
The import endpoint includes an optional mode
query parameter to handle conflicts when importing user records. For example, if a user already exists in SecureAuth with the same ID as a user in your import, the mode parameter determines how SecureAuth processes the request:
mode
=ignore
(default) – SecureAuth ignores any conflicting changes from the import.mode
=fail
– SecureAuth stops the import process and returns an error.mode
=update
– SecureAuth updates the existing user record with the values provided in the import request.