Skip to main content

Login and logout

The playground documents two session-style GET operations on the public Swagger Petstore sample. They're useful for trying query parameters and response headers without API keys.

warning

Sending passwords in the query string is not a production pattern. The Swagger sample does this for teaching only.

OpenAPI description (playground scope)

Download petstore-playground.json — includes GET /user/login, GET /user/logout, and GET /pet/findByStatus only.

Log in

MethodGET
Path/user/login
Base URLhttps://petstore3.swagger.io/api/v3

Parameters

NameInRequiredDescription
usernameQueryYesSample default theUser.
passwordQueryYesSample default 12345.

Responses

CodeDescription
200Session string returned (JSON string body). Check response headers for rate-limit hints.
400Invalid username or password (JSON error body possible).

Response headers (success)

HeaderDescription
X-Rate-LimitCalls per hour allowed (sample server).
X-Expires-AfterUTC date/time after which the session may expire.

Example

curl "https://petstore3.swagger.io/api/v3/user/login?username=theUser&password=12345"

Example body

"logged in user session:1234567890"

Log out

MethodGET
Path/user/logout
Base URLhttps://petstore3.swagger.io/api/v3

Parameters

None.

Responses

CodeDescription
200Logout acknowledged (string body on sample server).
500Server error.

Example

curl "https://petstore3.swagger.io/api/v3/user/logout"