You need to enable JavaScript to run this app.
Message Queue for Kafka

Message Queue for Kafka

Copy page
Download PDF
SASL user management
CreateUser - Create SASL user
Copy page
Download PDF
CreateUser - Create SASL user
Call the CreateUser API to create a Kafka SASL user.​
Instructions​
The CreateUser API creates a SASL user under the Kafka instance. This user can publish and subscribe to messages using the SASL/SCRAM or SASL/PLAIN mechanism.​
Debug​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameters​
Only the unique request parameters of this interface and some common parameters are listed below. For more information, see common parameters.​
Action string required Example value: CreateUser​
Action to perform, value: CreateUser.​
​
Version string required Example value: 2022-05-01​
API version, value: 2022-05-01.​
​
InstanceId string required Example value: kafka-cnngbnntswg1****​
The instance ID to which the user belongs.​
​
UserName string required Example value: test1​
SASL user name. Must meet the following requirements:​
  • Consist of letters, numbers, hyphens (-), or underscores.​
  • Length should be 3 to 64 characters.​
  • Username cannot be set as admin or monitor and must be unique within the instance.​
​
UserPassword string required Example: Test@123456​
Password for SASL user. Must meet the following requirements:​
  • Length between 8 and 32 characters.​
  • Must include at least three of the following: uppercase letters, lowercase letters, numbers, special characters.​
  • Supported special characters include !@#$%^&*()_+-=.​
​
Description string No Example value: describe​
SASL user description information.​
​
AllAuthority boolean required Example: true​
Whether the user has read and write permissions for all topics by default.​
  • true: This user has read and write permissions for all topics.​
  • false: This user does not have read and write permissions for all topics.​
​
PasswordType string No Example value: Plain​
User password type, referring to the SASL user's type, supports the following settings:​
  • Scram: SASL user of SCRAM type.​
  • Plain: SASL user of PLAIN type.​
tip​
When creating a PLAIN type user, the effect is delayed by 1 minute. Please wait a moment. Thanks for your patience.​
​
​
​
Response parameters​
This interface has no unique response parameters. For more information, see the response structure.​
Request example​
​
POST /?Action=CreatCreateUserePublicAddress&Version=2022-05-01 HTTP/1.1​
Content-Type: application/json​
Host: kafka.volcengineapi.com​
X-Date: 20210328T100802Z​
Authorization: HMAC-SHA256 Credential=AK********/20210328/cn-beijing/Kafka/request, SignedHeaders=x-date, Signature=********​
​
{​
"InstanceId": "kafka-cnngbnntswg1****",​
"UserName": "user1123123123",​
"UserPassword": "Test@123456",​
"AllAuthority":true,​
"Description": "vip"​
}​
​
Response example​
​
{​
"ResponseMetadata": {​
"RequestId": "20230227211906E9F948120F87D27F1AEE",​
"Action": "CreateUser",​
"Version": "2022-05-01",​
"Service": "Kafka",​
"Region": "cn-beijing"​
},​
"Result": null​
}​
​
Error code​
The following table lists error codes related to this interface and business logic. Refer to the Public error codes section for common error codes.​
​
Status code​
Error code​
Error message​
Specifications​
400​
InvalidParameter​
The specified parameter is not valid.​
Invalid parameter value.​
400​
InvalidUserName.AlreadyExists​
The specified user name already exists.​
SASL user already exists.​
403​
OperationDenied.InvalidInstanceStatus​
The operation is not valid for the current status of the instance.​
The current instance state does not allow this operation.​
403​
OperationDenied.AccountNotAuthorized​
You are not authorized to perform this operation.​
You are not authorized. Authorize or switch accounts and try again.​
404​
InvalidInstanceId.NotFound​
The specified Instance ID does not exist.​
Instance does not exist.​
500​
InternalError​
The request failed due to some unknown error, exception or failure.​
Internal error, please try again later.​
​
​
Last updated: 2025.06.30 12:00:30