Swagger Petstore - OpenAPI 3.0
POST/user

Create a user account

Creates a new user account from the supplied user object. The authenticated user must provide the account details in JSON, XML, or form-encoded form; all user fields are optional in the schema. A successful response returns the created user object.

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

8 body fields

User account details accepted as JSON, XML, or application/x-www-form-urlencoded data.

idintegeroptional
The user's 64-bit integer identifier.
usernamestringoptional
The username for the account.
firstNamestringoptional
The user's first name.
lastNamestringoptional
The user's last name.
emailstringoptional
The user's email address.
passwordstringoptional
The password for the account.
phonestringoptional
The user's telephone number.
userStatusintegeroptional
User Status

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

Error handling

The request body may be omitted, but any supplied id must be an integer and userStatus must be a 32-bit integer. The authenticated user must submit the remaining account fields as strings when they are provided.