Skip to main content
POST
/
tenant
/
{tenantId}
/
admin
/
user
CreateTenantUser
curl --request POST \
  --url https://api.example.com/tenant/{tenantId}/admin/user \
  --header 'Content-Type: application/json' \
  --data '
{
  "tenantId": 1024,
  "email": "[email protected]",
  "actorUserId": "9f060a6b-1571-4a2f-8cfb-3fc6bf5a4e51",
  "principalOid": "d3b07384-d9a1-4655-a08e-df5f4f6d7d19",
  "firstName": "Casey",
  "lastName": "Taylor"
}
'
{
  "isSuccess": true,
  "isFailure": false,
  "error": null,
  "value": {
    "id": 42,
    "name": "Example"
  }
}

Description

This endpoint creates a new tenant user with the provided profile information, establishing their membership in the tenant.

Input

  • tenantId (path, required): Identifier of the tenant that will own the user
  • request (body, required): Creation payload containing user properties
    • email: Email address for the new user
    • firstName: First name
    • lastName: Last name
    • principalOid: Principal object identifier
    • actorUserId: Identifier of the administrator creating the user
  • cancellationToken (optional): Token to cancel the asynchronous operation

Output

Returns a Result<TenantUserViewModel> containing the created user details.

Examples

Request:
POST /api/tenant/1024/users
Content-Type: application/json

{
  "tenantId": 1024,
  "email": "[email protected]",
  "actorUserId": "5c78fd7c-5d7a-43e9-bbf6-0cb4a4250ea3",
  "principalOid": "a8f5f167-0f0b-4f6a-8865-fda1ebdc2a5d",
  "firstName": "Riley",
  "lastName": "Morgan"
}
Response (200 OK):
{
  "data": {
    "id": 257,
    "userId": 4243,
    "tenantId": 1024,
    "email": "[email protected]",
    "firstName": "Riley",
    "lastName": "Morgan",
    "isEnabled": true,
    "roles": []
  },
  "isSuccess": true
}

Errors

  • 400 Bad Request: Invalid payload or validation failure
  • 401 Unauthorized: Authentication credentials are missing or invalid
  • 403 Forbidden: User lacks permission to create tenant users
  • 409 Conflict: User with specified email already exists in tenant
  • 500 Internal Server Error: Unexpected server error occurred during creation

Notes

  • Email address must be unique within the tenant
  • New users are enabled by default
  • No roles are assigned during creation; use role assignment endpoints separately

Path Parameters

tenantId
integer<int64>
required

Identifier of the tenant that will own the user.

Body

application/json

Payload describing the tenant user to create.

Request to create a new user within a tenant.

tenantId
integer<int64>

Identifier of the tenant for which the user should be created.

Example:

1024

email
string

Email address that uniquely identifies the user.

actorUserId
string

Identifier of the actor performing the creation.

Example:

"9f060a6b-1571-4a2f-8cfb-3fc6bf5a4e51"

principalOid
string

Azure AD object identifier for the user principal.

Example:

"d3b07384-d9a1-4655-a08e-df5f4f6d7d19"

firstName
string

First name associated with the user.

Example:

"Casey"

lastName
string

Last name associated with the user.

Example:

"Taylor"

Response

Tenant user created successfully.

Wrapper for API operation results containing success status, error information, and return value.

isSuccess
boolean

True if the operation completed successfully, false otherwise.

Example:

true

isFailure
boolean

True if the operation failed, false otherwise.

Example:

false

error
object

Error information returned when the operation fails.

Example:
{
"code": "ValidationError",
"message": "The request parameters failed validation.",
"info": [
"The Name field is required.",
"The Id field must be greater than 0."
]
}
value
object

The result value returned when the operation is successful.

Example:
{
"id": 256,
"userId": 4242,
"tenantId": 1024,
"principalOid": "d3b07384-d9a1-4655-a08e-df5f4f6d7d19",
"firstName": "Casey",
"lastName": "Taylor",
"email": "[email protected]",
"isEnabled": true,
"roles": [
{
"id": 12,
"name": "TenantAdministrator",
"description": "Grants full tenant administration capabilities."
}
]
}