Login User
The Login User endpoint is used to authenticate an existing user in the Petstore system.
This operation validates the provided username and password and returns a successful response when the credentials are correct.
Endpoint
Base URL
https://petstore.swagger.io/v2/user/login
Query Parameters
| Parameter |
Type |
Required |
Description |
| username |
string |
Yes |
Username used for authentication |
| password |
string |
Yes |
Password associated with the user account |
| Header |
Required |
Description |
| accept |
No |
Specifies the expected response format |
The endpoint supports the following response formats:
| Content Type |
Usage |
| application/json |
JSON response payload |
| application/xml |
XML response payload |
Sample Request
Successful Response
Response Codes
| Status Code |
Description |
| 200 |
User authenticated successfully |
| 400 |
Invalid username or password |
| 404 |
User account not found |
Error Response Example
{
"code": 400,
"type": "error",
"message": "Invalid username/password supplied"
}
Notes
- Both
username and password query parameters are required.
- Credentials should be transmitted only over secure HTTPS connections.
- Avoid exposing passwords in logs, browser history, or public URLs in production environments.
- Session handling behavior may vary depending on the server implementation.