Swagger Petstore - OpenAPI 3.0
POST/user

Create a user

Creates a new user account from a user object. The authenticated user can perform this operation, and the optional body may include identity, contact, credential, and status fields in a supported request format.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

8 body fields

Optional user object containing identity, contact, credential, and status information.

idintegeroptional
The user's numeric identifier in int64 format.
usernamestringoptional
The user's login name.
firstNamestringoptional
The user's first name.
lastNamestringoptional
The user's last name.
emailstringoptional
The user's email address.
passwordstringoptional
The user's password.
phonestringoptional
The user's telephone number.
userStatusintegeroptional
User Status

2 status codes
200Returns the created user object, including its identifier, account details, contact information, and status.
idintegeroptional
usernamestringoptional
firstNamestringoptional
lastNamestringoptional
emailstringoptional
passwordstringoptional
phonestringoptional
userStatusintegeroptional
User Status
defaultUnexpected error

Error handling

The request body is optional; when supplied, id must be an integer in int64 format and userStatus must be an integer in int32 format. Values such as username, email, password, and phone must be supplied as strings.