POST - /admin/user

General Information


ServiceAPIMethodData ModelsWorkflow
urac/admin/userPOSTUsersN/A

Description

This API adds a user record to the tenant that has the external key sent in the request headers. 

Here is the business logic steps:

  • Check is the user is already there, if yes return 
  • Check the type of tenant adding the user (main or sub tenant)
    • if main tenant 
      • Add the user under the main tenant with the provided group
    • if sub tenant 
      • Add the user under the main tenant 
      • Invite the user to this subtenant with the provided group
  • if pin object provided 
    • generate code if requested
    • turn on pin login if allowed
    • email the user the generated pin code using invitePin as documented under configuration
  • if status is not provided, then pendingNew will be used as default
  • if status is pendingNew then:
    • a token with expiration date gets generated 
    • an email will be sent to the user using addUser as documented under configuration
    • The email will contain a link protected by the generated token to be clicked to validate the user and set a password
    • Once the user is validated, the status will be set to active (if status is not active the user will not be able to login)
  • If status is active or inactive 
    • an email will be sent to the user with the password using addUser as documented under configuration
    • if the password is not provided a generated password is sent to the user otherwise the provided password

Input


Type: application/json
NameSourceMandatoryTypeSpecial FormatDescription
usernameBodyYESStringN/AUsername
passwordBodyNOStringN/APassword
emailBodyYESStringEmail formatEmail
firstNameBodyYESStringN/AFirst Name
lastNameBodyYESStringN/ALast Name
profileBodyNOObjectN/AProfile Object
statusBodyNOStringactive, inactive, or pendingNewUser Status default status if not provided is pendingNew
pinBodyNOObjectincludes code and allowedPin Object

NameMandatoryTypeDescription
codeYESBooleanset to True to create a random generated code 
allowedYESBoolean

set to True if this user is allowed to start pin code login

groupsBodyNOArrayArray of StringsGroups array
lnBodyNOString
Language
phoneBodyNOString
Phone number


Output


Response

SOAJS has a unified response. Check out this link to understand more the schema of SOAJS response 

Valid Response

Valid Response Sample
{ result: true, data: { id: '%new_user_ID%' } }

Invalid Response

Error Response Sample
{
    "result":false,
    "errors":{
        "codes":[602],
        "details":[
            {
                "code":602,
                "message":"Model error: + %model_error%"
            }
        ]
    }
}

Response schema

Follow this link to check out the response JSON Schema

SOAJS Error Codes


Code
Description
400

Business logic required data are missing

525

Unable to generate pin at this time

602Model error: + %model_error%