Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a User

Updated on 2024-12-30 GMT+08:00

Function

This API is used to create a user.

Constraints

null

URI

POST /api/v2/tenant/users

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Set this field to "application/json;charset=utf8".

Authorization

Yes

String

Authentication credential. The value is "Bearer {access_token}". access_token is obtained by calling the API for obtaining an access credential.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

user_name

Yes

String

Username, which is a unique identifier in an enterprise. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

password

No

String

Password, which must be in the format defined by the enterprise.

mobile

Yes

String

Mobile number, which is unique in an enterprise. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

org_code

No

String

Main organization code. Enter an existing organization code in an enterprise. If the value is empty, the organization is under the first root organization.

name

No

String

Real name. If the value is null, which means it is set to user_name. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

email

No

String

Email address. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

employee_id

No

String

Employee ID. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

first_name

No

String

Name. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

middle_name

No

String

Middle name. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

last_name

No

String

Last name. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

pwd_must_modify

No

Boolean

Whether the password must be changed upon the first login.

attr_gender

No

String

Gender. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

attr_birthday

No

String

Date of birth. Format: yyyy-mm-dd. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

attr_nick_name

No

String

Alias. You can modify mandatory attributes on the User Attributes page under the Users menu on the administrator portal.

attr_identity_type

No

String

Certificate type.

attr_identity_number

No

String

Certificate number.

attr_area

No

String

Country or region code.

attr_city

No

String

City.

attr_manager_id

No

String

Immediate superior.

attr_user_type

No

String

Personnel type.

attr_hire_date

No

String

Onboarding date. Format: yyyy-MM-dd.

attr_work_place

No

String

Work location.

user_org_relation_list

No

Array of UserOrgRelationListOption objects

User organization relationship set. If you enter a value, the main organization information must be included.

extension

No

Object

Custom extended attribute.

Table 3 UserOrgRelationListOption

Parameter

Mandatory

Type

Description

orgCode

Yes

String

Organization code.

relationType

Yes

String

Ownership. A user only belongs to one organization and can be mounted to a maximum of nine organizations.

Response Parameters

Status code: 201

Table 4 Response body parameters

Parameter

Type

Description

user_id

String

User ID.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error details.

Example Requests

Create a user whose username is zhangsan, mobile number is 12345678901, and email address is zhangsan@example.com.

POST https://{domain_name}/api/v2/tenant/users

Authorization: Bearer 334963fc-1e4a-473b-9096-52a929140...
{
    "user_name": "zhangsan",
    "password": "p******d",
    "org_code": "10000",
    "name": "zhangsan",
    "mobile": "12345678901",
    "email": "zhangsan@example.com",
    "employee_id": "123456789",
    "pwd_must_modify": false,
    "first_name": "F",
    "middle_name": "M",
    "last_name": "L",
    "attr_gender": "male",
    "attr_birthday": "1990-02-01",
    "attr_nick_name": "zhangsan",
    "attr_identity_type": "id_card",
    "attr_identity_number": "123456789",
    "attr_area": "CN",
    "attr_city": "xxx",
    "attr_manager_id": "123456789",
    "attr_user_type": "regular",
    "attr_hire_date": "2021-04-01",
    "attr_work_place": "xxx",
    "user_org_relation_list": [
      {
            "orgCode": "10000",
            "relationType": 1
      },
      {
            "orgCode": "TestOrg1",
            "relationType": 0
      },
      {
            "orgCode": "TestOrg2",
            "relationType": 0
      }
    ],
    "extension": {
        "age": "18"
    }
}

Example Responses

Status code: 201

Request successful.

{
  "user_id" : "20210621095935811-5E16-6B3060..."
}

Status Codes

Status Code

Description

201

Request successful.

400

Invalid parameter.

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback