Skip to main content

Bulk User Import Schema and Examples

The bulk import API expects the payload in the following format.

{
"users": {
"type": "array",
"items": {
"type": "object",
"properties": {
"externalUserId": {
"type": "string",
"description": "The existing user id in your current auth provider."
},
"userMetadata": {
"type": "object",
"description": "Any JSON serializable data you want to associate with the user."
},
"userRoles": {
"type": "array",
"items": {
"type": "object",
"properties": {
"tenantIds": {
"type": "array",
"items": {
"type": "string",
"description": "The tenantId of the tenant where this role should be assigned."
},
},
"role": {
"type": "string",
"description": "The role of the user. These roles must be pre-created before importing the user."
},
"required": ["tenantIds", "role"]
},
}
},
"totpDevices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The OTP secret, used with authenticator apps (e.g., Google Authenticator, Authy), must be supplied in base32 encoding like: MFRGGZDFMZTWQ33Q."
},
"period": {
"type": "integer",
"description": "Time in seconds a TOTP code is valid. Default is 30 seconds.",
"default": 30
},
"skew": {
"type": "integer",
"description": "Allowed time difference in seconds between server and client devices. Default is 0 seconds.",
"default": 0
},
"deviceName": {
"type": "string",
"description": "Optional name for the device associated with the TOTP secret (e.g., 'My Phone')."
},
"required": ["secret"]
}
}
},
"loginMethods": {
"type": "array",
"items": {
"type": "object",
"properties": {
"recipeId": {
"type": "string",
"description": "The recipe id for this login method.",
"enum": ["emailpassword", "thirdparty", "passwordless"]
},
"tenantIds": {
"type": "array",
"items": {
"type": "string",
"description": "The tenantId of the tenant where this login method should be created."
},
"default": ["public"]
},
"email": {
"type": "string",
"description": "The email of the user. This is applicable for all the recipes but only required in emailpassword and thirdparty recipe.",
},
"passwordHash": {
"type": "string",
"description": "Hashed password for the user. This is required for the emailpassword recipe.",
},
"hashingAlgorithm": {
"type": "string",
"description": "The hashing algorithm used to hash the password. This is required for the emailpassword recipe.",
"enum": ["bcrypt", "argon2", "firebase_scrypt"],
},
"isVerified": {
"type": "boolean",
"description": "Whether the email is verified or not.",
"default": false
},
"isPrimary": {
"type": "boolean",
"description": "Whether this login method is the primary login method for the user. Only one login method can be primary.",
"default": false
},
"timeJoinedInMSSinceEpoch": {
"type": "integer",
"description": "The time the user joined in milliseconds since epoch.",
},
"thirdPartyId": {
"type": "string",
"description": "The id of the third party provider. This is required for the thirdparty recipe.",
},
"thirdPartyUserId": {
"type": "string",
"description": "The id of the user in the third party provider. This is required for the thirdparty recipe.",
},
"phoneNumber": {
"type": "string",
"description": "The phone number of the user. This is applicable for the passwordless recipe. Required if email is not passed.",
},
"required": ["recipeId"]
}
}
},
}
},
"required": ["loginMethods"]
}
}

Examples#

Example 1: Sample Bulk User Import JSON#

{
"users": [
{
"externalUserId": "fa7a0841-b533-4478-95533-0fde890c3483",
"userMetadata": {
"subscriptionPlan": "PREMIUM",
"theme": "dark"
},
"userRoles": [
{
"tenantIds": ["public"],
"role": "admin"
}
],
"totpDevices": [
{
"secret": "MFRGGZDFMZTWQ33Q"
}
],
"loginMethods": [
{
"recipeId": "emailpassword",
"tenantIds": ["public"],
"isVerified": true,
"isPrimary": true,
"email": "johndoe@gmail.com",
"passwordHash": "$argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw",
"hashingAlgorithm": "argon2",
"timeJoinedInMSSinceEpoch": 1713260578868
},
{
"recipeId": "thirdparty",
"tenantIds": ["public"],
"isVerified": true,
"isPrimary": false,
"email": "johndoe@gmail.com",
"thirdPartyId": "google",
"thirdPartyUserId": "106347997792363870000",
"timeJoinedInMSSinceEpoch": 1713260578868
},
{
"recipeId": "passwordless",
"tenantIds": ["public"],
"isVerified": true,
"isPrimary": false,
"email": "johndoe@gmail.com",
"timeJoinedInMSSinceEpoch": 1713260578868
},
]
}
]
}
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI