Skip to main content
POST
Create New User

Create New User

Create a new user account. Only accessible by administrators.

Endpoint

Description

This endpoint allows administrators to create new user accounts in the system. You can specify various user attributes including role, license, and authentication type. This is an administrative endpoint that requires appropriate permissions.

User Creation Flow

Basic Auth (authType: "basic"): User receives a welcome email with a password setup link. Account is created unverified until password is set. Enterprise SSO (authType: "enterprise"): User is created verified and can sign in via enterprise SSO (Auth0, Microsoft AD, etc.). No password setup required.

Authentication

Required. Include your API key in the Authorization header.

Request

Request Body

Example Request

Response

Success Response (201)

Response Fields

Example Usage

JavaScript

Python

cURL

Error Responses

400 Bad Request

400 Invalid AuthType

400 Missing Required Fields

401 Unauthorized

403 Forbidden

409 Conflict

Validations and Business Rules

  • License value: Must be one of the allowed licenses (Essential, Growth, Ultra, Early Access). Invalid values return 400.
  • License capacity: Enforced via checkLicenseCapacity. If capacity is full for the selected tier, returns 400.
  • Email normalization: Lowercased and trimmed before validation and storage.
  • Username normalization: Lowercased and trimmed before validation and storage. Auto-generated from email if not provided.
  • Email format: Validated with a simple regex; invalid emails return 400.
  • Username format: Must match ^[a-z0-9.-]{3,30}$; invalid usernames return 400.
  • Uniqueness: email, username, and name must be unique. Conflicts return 409.
  • Email invite behavior: For basic auth, users receive welcome emails with password setup links.

Normalization and Storage

  • email and username are always stored lowercased and trimmed.

Typical Error Shapes

400 Invalid License

400 License Unavailable

400 Invalid Email

400 Invalid Username

409 Conflict (Uniqueness)

User Roles

License Tiers

Authentication Types

Use Cases

  • User Onboarding: Create new user accounts for team members
  • Passwordless Onboarding: Create users who receive email invites to set their own passwords
  • SSO Integration: Create users who authenticate via external identity providers
  • Bulk User Creation: Programmatically create multiple users
  • Integration: Create users from external systems
  • Administrative Tasks: Manage user accounts through API

Rate Limits

This endpoint follows the standard rate limits:
  • 60 requests per minute
  • 1000 requests per hour

授权

Authorization
string
header
必填

API key authentication using Bearer token format. Example: Authorization: Bearer sk-your-api-key-here

请求体

application/json
name
string
必填

User's full name

示例:

"John Doe"

username
string
必填

Unique username

示例:

"johndoe"

email
string<email>
必填

User's email address

示例:

"john@example.com"

password
string
必填

User's password

示例:

"securepassword123"

role
enum<string>
默认值:user

User's role

可用选项:
admin,
user,
globalReader
示例:

"user"

license
enum<string>
默认值:Essential

User's license tier

可用选项:
Essential,
Growth,
Ultra,
Early Access
示例:

"Growth"

roleId
string

Custom role ID (MongoDB ObjectId)

示例:

"60a7c8f5e8b4f5001f7a8c24"

setupCompleted
boolean
默认值:false

Whether user setup is completed

示例:

false

authType
enum<string>
默认值:basic

Authentication type

可用选项:
basic,
auth0
示例:

"basic"

响应

User created successfully

success
boolean
示例:

true

message
string
示例:

"User created successfully"

user
object