Add bulk import users
Add users for bulk import. Maximum 10000 users can be added in one request.
POST
/appid-{appId}/bulk-import/usersAuthorization
api-keyAPI key · headerrequiredThe core service API token. If you are using a self-hosted core service and you have not generated a token, you can omit the header.
Path parameters
appIdstringrequiredThe application ID. Omit the entire `appid-{appId}` prefix to use `public`.
Header parameters
cdi-versionstringX.Y of the X.Y.Z CDI version.
Request body
requiredapplication/jsonusersbulkImportUser[]requiredmax items 10000
Show propertiesHide properties
Array of
bulkImportUserexternalUserIduserIduserMetadatauserMetadatashould be a JSON object (not a JSON literal nor an array)
userRolesbulkImportUserRole[]Show propertiesHide properties
Array of
bulkImportUserRolerolerolerequiredtenantIdstenantId[]requiredtotpDevicesbulkImportTotpDevice[]Show propertiesHide properties
Array of
bulkImportTotpDevicesecretKeystringrequiredskewnumberperiodnumberdeviceNamestringloginMethodsbulkImportUserEmailPasswordLoginMethod | bulkImportUserThirdPartyLoginMethod | bulkImportUserPasswordlessLoginMethod[]requiredmin items 1
Show propertiesHide properties
Array of
bulkImportUserEmailPasswordLoginMethod | bulkImportUserThirdPartyLoginMethod | bulkImportUserPasswordlessLoginMethodOne of:
bulkImportUserEmailPasswordLoginMethod
tenantIdstenantId[]List of tenant IDs this login method is associated with
isVerifiedbooleanIndicates whether the email is verified
isPrimarybooleanIndicates whether the login method is the primary login method
timeJoinedInMSSinceEpochintegerTime joined in milliseconds since the epoch
recipeIdstringrequiredAllowed:
emailpasswordemailemailrequiredpasswordHashpasswordHashplainTextPasswordstringhashingAlgorithmhashingAlgorithmAllowed:
argon2bcryptfirebase_scryptbulkImportUserThirdPartyLoginMethod
tenantIdstenantId[]List of tenant IDs this login method is associated with
isVerifiedbooleanIndicates whether the email is verified
isPrimarybooleanIndicates whether the login method is the primary login method
timeJoinedInMSSinceEpochintegerTime joined in milliseconds since the epoch
recipeIdstringrequiredAllowed:
thirdpartyemailemailrequiredthirdPartyIdthirdPartyIdrequiredthirdPartyUserIdthirdPartyUserIdrequiredbulkImportUserPasswordlessLoginMethod
tenantIdstenantId[]List of tenant IDs this login method is associated with
isVerifiedbooleanIndicates whether the email is verified
isPrimarybooleanIndicates whether the login method is the primary login method
timeJoinedInMSSinceEpochintegerTime joined in milliseconds since the epoch
recipeIdstringrequiredAllowed:
passwordlessemailemailphoneNumberphoneNumberResponses
200Bulk Import Users added successfully
statusstatusOKAllowed:
OKusersaddBulkImportUserResponse[]Show propertiesHide properties
Array of
addBulkImportUserResponseuserIduserIdloginMethodsaddBulkImportUserLoginMethodResponse[]Show propertiesHide properties
Array of
addBulkImportUserLoginMethodResponserecipeIdstringrequireduserIduserIdrequiredtenantstenantId[]requiredemailemailrequiredthirdpartyIdthirdPartyIdthirdpartyUserIdthirdPartyUserIdphoneNumberphoneNumber400One or more users have invalid schema
errorstringusersobject[]Show propertiesHide properties
Array of
objectindexnumberIndex of the user in the users array that has invalid schema
errorsstring[]401error code 401
string404error code 404
string500error code 500
stringTry it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST "/appid-public/bulk-import/users" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"users": [
{
"externalUserId": "fa7a0841-b533-4478-95533-0fde890c3483",
"userMetadata": {
"preferences": {
"theme": "dark"
},
"notifications": {
"email": true
},
"todos": [
"example"
]
},
"userRoles": [
{
"role": "admin",
"tenantIds": [
"customer1"
]
}
],
"totpDevices": [
{
"secretKey": "2PRXZWZAYYDAWCD",
"skew": 0,
"period": 30,
"deviceName": "My Authy App"
}
],
"loginMethods": [
{
"tenantIds": [
"customer1"
],
"isVerified": true,
"isPrimary": true,
"timeJoinedInMSSinceEpoch": 0,
"recipeId": "emailpassword",
"email": "[email protected]",
"passwordHash": "$argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw",
"plainTextPassword": "passwordExample",
"hashingAlgorithm": "argon2"
}
]
}
]
}'const response = await fetch("/appid-public/bulk-import/users", {
method: "POST",
headers: {
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"users": [
{
"externalUserId": "fa7a0841-b533-4478-95533-0fde890c3483",
"userMetadata": {
"preferences": {
"theme": "dark"
},
"notifications": {
"email": true
},
"todos": [
"example"
]
},
"userRoles": [
{
"role": "admin",
"tenantIds": [
"customer1"
]
}
],
"totpDevices": [
{
"secretKey": "2PRXZWZAYYDAWCD",
"skew": 0,
"period": 30,
"deviceName": "My Authy App"
}
],
"loginMethods": [
{
"tenantIds": [
"customer1"
],
"isVerified": true,
"isPrimary": true,
"timeJoinedInMSSinceEpoch": 0,
"recipeId": "emailpassword",
"email": "[email protected]",
"passwordHash": "$argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw",
"plainTextPassword": "passwordExample",
"hashingAlgorithm": "argon2"
}
]
}
]
})
});import requests
response = requests.post(
"/appid-public/bulk-import/users",
headers={
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"users": [
{
"externalUserId": "fa7a0841-b533-4478-95533-0fde890c3483",
"userMetadata": {
"preferences": {
"theme": "dark"
},
"notifications": {
"email": True
},
"todos": [
"example"
]
},
"userRoles": [
{
"role": "admin",
"tenantIds": [
"customer1"
]
}
],
"totpDevices": [
{
"secretKey": "2PRXZWZAYYDAWCD",
"skew": 0,
"period": 30,
"deviceName": "My Authy App"
}
],
"loginMethods": [
{
"tenantIds": [
"customer1"
],
"isVerified": True,
"isPrimary": True,
"timeJoinedInMSSinceEpoch": 0,
"recipeId": "emailpassword",
"email": "[email protected]",
"passwordHash": "$argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw",
"plainTextPassword": "passwordExample",
"hashingAlgorithm": "argon2"
}
]
}
]
},
)Response
{
"status": "OK",
"users": [
{
"userId": "fa7a0841-b533-4478-95533-0fde890c3483",
"loginMethods": [
{
"recipeId": "emailpassword",
"userId": "fa7a0841-b533-4478-95533-0fde890c3483",
"tenants": [
"customer1"
],
"email": "[email protected]",
"thirdpartyId": "google",
"thirdpartyUserId": 106347997792363870000,
"phoneNumber": "+14155552671"
}
]
}
]
}{
"error": "Data has missing or invalid fields. Please check the users field for more details.",
"users": [
{
"index": 0,
"errors": [
"Invalid recipeId for loginMethod. Pass one of emailpassword, thirdparty or, passwordless!"
]
}
]
}"Invalid API key""Not Found""Internal Error"