Create a User

Create a user.

Request URL

POST {base_url}/services/openapi/v1.0/user/user_create

Request parameters

Body parameters
Parameter Required Type Description
email Yes String Email address.
firstName Yes String First name
lastName No String Last name.
groupIds Yes Array <Long> The ID(s) of the group(s) that the user belongs to.
Note:
  • You can query the user group ID using the Query Multiple User Groups interface.
  • Use a comma to separate multiple IDs. For example, [1001,1002].
roleName Yes String User role name.
Valid value:
  • The name of the built-in user role: Administrator or User.
  • The name of the custom user role (added in User Management > Role on Yeastar Workplace admin portal).
preferredBuildingName Yes String The name of the building where the user's workplace is located.
preferredFloorName No String The name of the floor where the user's workplace is located.
phone No String Mobile phone number.
imageBase64 No String The Base64 string of the user's face image.
idCode No String The identification code that can be used to identify the user.
sendInviteEmail No Boolean Whether to send an invitation email to the user.

Valid value:

  • true: Enabled.
  • false: Disabled.

Response parameters

Parameter Type Description
data Object <Details> The detailed information.
status String The result of the request.
  • Success
  • Failed
requestId String The ID of the request, which can be used to quickly locate the request.
Details
Parameter Type Description
userId Integer User's account ID.
memberId Integer User's member ID.

Example

Request example

Create a user.
POST /services/openapi/v1.0/user/user_create HTTP/1.1
Host: workplace.yeastar.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJncmFudF90eXBlIjoiY2xpZW50X2NyZWRlbnRpYWxzIiwic2NvcGUiOlsiL29wZW5hcGkvIl0sImVudGVycHJpc2VfaWQiOjEwMDQzMywicmVnaW9uIjoiR0wiLCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiJjZjc3NTg4OC1mM2QwLTRkNDMtODJiYy00NjQ4NWZjYTY0MzIiLCJjbGllbnRfaWQiOiI3OTU2OGFhMC0wYjBkLTQyZjYtOGRiNC03OWExNmQ3MzQ3MmEiLCJ0cyI6MTY4OTkwNTE3MCwiZXhwX2luIjo4NjQwMH0.QULcMVk5CJWNnZFrHp2TYH-P1cdvPoFn4jYYEwSs0Ps
Content-Type: application/json

{
    "email": "leo@yeastar.com",
    "firstName": "Leo",
    "lastName":"Ball",
    "groupIds": [
        1000127
    ],
    "roleName": "Administrator",
    "preferredBuildingName": "Yeastar",
    "preferredFloorName": "2F",
    "phone": "1325698753",
    "imageBase64": "data:image/png;base64,iVBORw0Kxxxxxxxxxx+ny1BosNNgvBhn1jkKM65fc8EIkWK0iZx6u4pHHi0widJ5f/h4uGkwkr0HHedD/PwCOHV4VyXitAAAAAABJRU5ErkJggg==",
    "idCode": "XZXXtest6701",
    "sendInviteEmail": true
}
    
Response example
HTTP/1.1 200 ok
{
    "data": {
        "userId": 31194,
        "memberId": 54164
    },
    "status": "Success",
    "requestId": "56753e60f6207cbfc48e6a98cfe6f43b"
}