Sample - Swagger Petstore OpenAPI 3
POST/user

Create a user

Creates a new user account from the supplied user object. You can provide identity, contact, credential, and status fields in the request body, and the body may be omitted. A successful response returns the created user object.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

8 body fields

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

idintegeroptional
The user's numeric identifier.
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 and supplied user details.
idintegeroptional
usernamestringoptional
firstNamestringoptional
lastNamestringoptional
emailstringoptional
passwordstringoptional
phonestringoptional
userStatusintegeroptional
User Status
defaultReturned when an unexpected error occurs.

Error handling

If you provide a request body, each field must use the type defined by the schema: integer values for id and userStatus, and string values for the remaining fields. The request body is optional, so you can create a user without supplying any fields.