Swagger Petstore - OpenAPI 3.0
POST/user

Create a user account

Creates a new user account from a user representation. Supply any applicable user fields in the request body; only the authenticated user can perform this operation.

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

8 body fields

User representation containing account identity, contact, credential, and status fields.

idintegeroptional
The user's numeric identifier in 64-bit integer format.
usernamestringoptional
The name used to identify the user.
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 with its identifier, account details, contact information, and status.
idintegeroptional
usernamestringoptional
firstNamestringoptional
lastNamestringoptional
emailstringoptional
passwordstringoptional
phonestringoptional
userStatusintegeroptional
User Status
defaultUnexpected error

Error handling

Only the authenticated user can create a user through this operation. Supplied id and userStatus values must be integers, while fields such as username and email must be strings.