Create a new user (register or invite)
Create a user with action discriminator:
- action="register": Admin creates user with password/name set directly. User can log in immediately with provided credentials. No email sent.
- action="invite": Admin creates user and sends email invitation. User sets their own password/name via email link (default).
Both actions support optional roleNames and resourceGroupIds for role/resource group assignment.
Body
required
application/json
Admin creates fully-functional user account with credentials set directly. User can log in immediately. No email invitation sent.
- actionDiscriminatorenumconst:registerrequiredvalues
- register
- Type: stringFormat: emailemailrequired
- Type: stringfirst
Name required - Type: stringlast
Name required - Type: stringpasswordmin length:12max length:50
Pattern: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>/?~])(?!.*\s).{12,50}$Format: passwordrequiredPassword must meet complexity requirements:
- Between 12 and 50 characters
- No spaces allowed
- At least one uppercase letter (A-Z)
- At least one lowercase letter (a-z)
- At least one number (0-9)
- At least one special character
- Type: stringFormat: uuidentity
Id - Type: array string[]resource
Group Ids Resource group IDs to assign user to
- Type: array string[]role
Names Role names to assign (e.g., ['tenant-user', 'vm-operator']). Defaults to ['tenant-user'].
Responses
- application/json
- application/json
- application/json
- application/json
Request Example for post/users
curl https://api.gpcn.com/v1/users \
--request POST \
--header 'Content-Type: application/json' \
--header 'X-API-Key: YOUR_SECRET_TOKEN' \
--data '{
"email": "",
"password": "",
"firstName": "",
"lastName": "",
"roleNames": [
""
],
"resourceGroupIds": [
""
],
"entityId": "",
"action": "register"
}'
{
"success": true,
"message": "User created successfully",
"data": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "hello@example.com"
},
"meta": null
}.png)