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.

    • action
      Discriminator
      enum
      const:  
      register
      required
      values
      • register
    • email
      Type: stringFormat: email
      required
    • firstName
      Type: string
      required
    • lastName
      Type: string
      required
    • password
      Type: string
      min length:  
      12
      max length:  
      50
      Pattern: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>/?~])(?!.*\s).{12,50}$Format: password
      required

      Password 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
    • entityId
      Type: stringFormat: uuid
    • resourceGroupIds
      Type: array string[]

      Resource group IDs to assign user to

    • roleNames
      Type: array string[]

      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
}