# Users

## Create user

**post** `/user`

This can only be done by the logged in user.

### Body Parameters

- `id: optional number`

- `email: optional string`

- `firstName: optional string`

- `lastName: optional string`

- `password: optional string`

- `phone: optional string`

- `username: optional string`

- `userStatus: optional number`

  User Status

### Returns

- `User object { id, email, firstName, 5 more }`

  - `id: optional number`

  - `email: optional string`

  - `firstName: optional string`

  - `lastName: optional string`

  - `password: optional string`

  - `phone: optional string`

  - `username: optional string`

  - `userStatus: optional number`

    User Status

### Example

```http
curl https://petstore3.swagger.io/api/v3/user \
    -X POST \
    -H "api_key: $PETSTORE_API_KEY"
```

#### Response

```json
{
  "id": 10,
  "email": "john@email.com",
  "firstName": "John",
  "lastName": "James",
  "password": "12345",
  "phone": "12345",
  "username": "theUser",
  "userStatus": 1
}
```

## Creates list of users with given input array

**post** `/user/createWithList`

Creates list of users with given input array

### Body Parameters

- `items: optional array of User`

  - `id: optional number`

  - `email: optional string`

  - `firstName: optional string`

  - `lastName: optional string`

  - `password: optional string`

  - `phone: optional string`

  - `username: optional string`

  - `userStatus: optional number`

    User Status

### Returns

- `User object { id, email, firstName, 5 more }`

  - `id: optional number`

  - `email: optional string`

  - `firstName: optional string`

  - `lastName: optional string`

  - `password: optional string`

  - `phone: optional string`

  - `username: optional string`

  - `userStatus: optional number`

    User Status

### Example

```http
curl https://petstore3.swagger.io/api/v3/user/createWithList \
    -X POST \
    -H "api_key: $PETSTORE_API_KEY"
```

#### Response

```json
{
  "id": 10,
  "email": "john@email.com",
  "firstName": "John",
  "lastName": "James",
  "password": "12345",
  "phone": "12345",
  "username": "theUser",
  "userStatus": 1
}
```

## Logs user into the system

**get** `/user/login`

Logs user into the system

### Query Parameters

- `password: optional string`

  The password for login in clear text

- `username: optional string`

  The user name for login

### Example

```http
curl https://petstore3.swagger.io/api/v3/user/login \
    -H "api_key: $PETSTORE_API_KEY"
```

#### Response

```json
"string"
```

## Logs out current logged in user session

**get** `/user/logout`

Logs out current logged in user session

### Example

```http
curl https://petstore3.swagger.io/api/v3/user/logout \
    -H "api_key: $PETSTORE_API_KEY"
```

## Get user by user name

**get** `/user/{username}`

Get user by user name

### Path Parameters

- `username: string`

### Returns

- `User object { id, email, firstName, 5 more }`

  - `id: optional number`

  - `email: optional string`

  - `firstName: optional string`

  - `lastName: optional string`

  - `password: optional string`

  - `phone: optional string`

  - `username: optional string`

  - `userStatus: optional number`

    User Status

### Example

```http
curl https://petstore3.swagger.io/api/v3/user/$USERNAME \
    -H "api_key: $PETSTORE_API_KEY"
```

#### Response

```json
{
  "id": 10,
  "email": "john@email.com",
  "firstName": "John",
  "lastName": "James",
  "password": "12345",
  "phone": "12345",
  "username": "theUser",
  "userStatus": 1
}
```

## Update user

**put** `/user/{username}`

This can only be done by the logged in user.

### Path Parameters

- `username: string`

### Body Parameters

- `id: optional number`

- `email: optional string`

- `firstName: optional string`

- `lastName: optional string`

- `password: optional string`

- `phone: optional string`

- `username: optional string`

- `userStatus: optional number`

  User Status

### Example

```http
curl https://petstore3.swagger.io/api/v3/user/$EXISTING_USERNAME \
    -X PUT \
    -H "api_key: $PETSTORE_API_KEY"
```

## Delete user

**delete** `/user/{username}`

This can only be done by the logged in user.

### Path Parameters

- `username: string`

### Example

```http
curl https://petstore3.swagger.io/api/v3/user/$USERNAME \
    -X DELETE \
    -H "api_key: $PETSTORE_API_KEY"
```

## Domain Types

### User

- `User object { id, email, firstName, 5 more }`

  - `id: optional number`

  - `email: optional string`

  - `firstName: optional string`

  - `lastName: optional string`

  - `password: optional string`

  - `phone: optional string`

  - `username: optional string`

  - `userStatus: optional number`

    User Status

### User Login Response

- `UserLoginResponse = string`
