Import one user directly
Import one user immediately with the Bulk Import functionality.
POST
/appid-{appId}/bulk-import/importAuthorization
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/jsonexternalUserIduserIduserMetadatauserMetadatashould 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
200User added successfully
statusstatusOKAllowed:
OKuserauthRecipeUserShow propertiesHide properties
iduserIdisPrimaryUserbooleantenantIdstenantId[]timeJoinedtimeJoinedemailsemail[]phoneNumbersphoneNumber[]thirdPartyobject[]Show propertiesHide properties
Array of
objectidthirdPartyIduserIdthirdPartyUserIdloginMethodsobject[]Show propertiesHide properties
Array of
objecttenantIdstenantId[]recipeUserIduserIdverifiedbooleantimeJoinedtimeJoinedrecipeIdrecipeIdAllowed:
emailpasswordpasswordlessthirdpartyemailemailphoneNumberphoneNumberthirdPartyobjectShow propertiesHide properties
idthirdPartyIduserIdthirdPartyUserId400User has invalid schema
errorstringusersobject[]Show propertiesHide properties
Array of
objectindexnumberIndex of the user in the users array that has invalid schema
errorsstring[]Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST "/appid-public/bulk-import/import" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"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": "johndoe@gmail.com",
"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/import", {
method: "POST",
headers: {
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"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": "johndoe@gmail.com",
"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/import",
headers={
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"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": "johndoe@gmail.com",
"passwordHash": "$argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw",
"plainTextPassword": "passwordExample",
"hashingAlgorithm": "argon2"
}
]
},
)Response
{
"status": "OK",
"user": {
"id": "fa7a0841-b533-4478-95533-0fde890c3483",
"isPrimaryUser": true,
"tenantIds": [
"customer1"
],
"timeJoined": 1623918032231,
"emails": [
"johndoe@gmail.com"
],
"phoneNumbers": [
"+14155552671"
],
"thirdParty": [
{
"id": "google",
"userId": 106347997792363870000
}
],
"loginMethods": [
{
"tenantIds": [
"customer1"
],
"recipeUserId": "fa7a0841-b533-4478-95533-0fde890c3483",
"verified": true,
"timeJoined": 1623918032231,
"recipeId": "emailpassword",
"email": "johndoe@gmail.com",
"phoneNumber": "+14155552671",
"thirdParty": {
"id": "google",
"userId": 106347997792363870000
}
}
]
}
}{
"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!"
]
}
]
}