Skip to content

Petstore API

The canonical Swagger Petstore spec rendered as a second API alongside the Mock API. Demonstrates multi-API support — each spec gets its own sidebar, search index, and URL prefix.

Pick any operation from the sidebar and hit Try-It — requests go to petstore3.swagger.io, CORS is open.

pet

POST/pet

Add a new pet to the store

Add a new pet to the store.

ReturnsPet

AcceptsPet

Response examples

200Successful operation

application/json example derived from schema

{
  "name": "doggie",
  "photoUrls": [
    "string"
  ]
}

PUT/pet

Update an existing pet

Update an existing pet by Id.

ReturnsPet

AcceptsPet

Response examples

200Successful operation

application/json example derived from schema

{
  "name": "doggie",
  "photoUrls": [
    "string"
  ]
}

GET/pet/{petId}

Find pet by ID

Returns a single pet.

Parameters 1

NameTypeDescription
petIdrequiredpath · integerID of pet to return

ReturnsPet

Response examples

200successful operation

application/json example derived from schema

{
  "name": "doggie",
  "photoUrls": [
    "string"
  ]
}

POST/pet/{petId}

Updates a pet in the store with form data

Updates a pet resource based on the form data.

Parameters 3

NameTypeDescription
petIdrequiredpath · integerID of pet that needs to be updated
namequery · stringName of pet that needs to be updated
statusquery · stringStatus of pet that needs to be updated

ReturnsPet

Response examples

200successful operation

application/json example derived from schema

{
  "name": "doggie",
  "photoUrls": [
    "string"
  ]
}

DELETE/pet/{petId}

Deletes a pet

Delete a pet.

Parameters 2

NameTypeDescription
api_keyheader · string
petIdrequiredpath · integerPet id to delete

POST/pet/{petId}/uploadImage

Uploads an image

Upload image of the pet.

Parameters 2

NameTypeDescription
petIdrequiredpath · integerID of pet to update
additionalMetadataquery · stringAdditional Metadata

ReturnsApiResponse

Response examples

200successful operation

application/json example derived from schema

{
  "code": 0,
  "type": "string",
  "message": "string"
}

GET/pet/findByStatus

Finds Pets by status

Multiple status values can be provided with comma separated strings.

Parameters 1

NameTypeDescription
statusrequiredquery · stringStatus values that need to be considered for filter

ReturnsPet

Response examples

200successful operation

application/json example derived from schema

[
  {
    "name": "doggie",
    "photoUrls": [
      "string"
    ]
  }
]

GET/pet/findByTags

Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

Parameters 1

NameTypeDescription
tagsrequiredquery · arrayTags to filter by

ReturnsPet

Response examples

200successful operation

application/json example derived from schema

[
  {
    "name": "doggie",
    "photoUrls": [
      "string"
    ]
  }
]

store

GET/store/inventory

Returns pet inventories by status

Returns a map of status codes to quantities.

Response examples

200successful operation

application/json example derived from schema

{}

POST/store/order

Place an order for a pet

Place a new order in the store.

ReturnsOrder

AcceptsOrder

Response examples

200successful operation

application/json example derived from schema

{
  "id": 10,
  "petId": 198772,
  "quantity": 7,
  "shipDate": "2024-01-15T09:30:00Z"
}

GET/store/order/{orderId}

Find purchase order by ID

For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.

Parameters 1

NameTypeDescription
orderIdrequiredpath · integerID of order that needs to be fetched

ReturnsOrder

Response examples

200successful operation

application/json example derived from schema

{
  "id": 10,
  "petId": 198772,
  "quantity": 7,
  "shipDate": "2024-01-15T09:30:00Z"
}

DELETE/store/order/{orderId}

Delete purchase order by identifier

For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.

Parameters 1

NameTypeDescription
orderIdrequiredpath · integerID of the order that needs to be deleted

user

POST/user

Create user

This can only be done by the logged in user.

ReturnsUser

AcceptsUser

Response examples

200successful operation

application/json example derived from schema

{
  "id": 10,
  "username": "theUser",
  "firstName": "John",
  "lastName": "James"
}

GET/user/{username}

Get user by user name

Get user detail based on username.

Parameters 1

NameTypeDescription
usernamerequiredpath · stringThe name that needs to be fetched. Use user1 for testing

ReturnsUser

Response examples

200successful operation

application/json example derived from schema

{
  "id": 10,
  "username": "theUser",
  "firstName": "John",
  "lastName": "James"
}

PUT/user/{username}

Update user resource

This can only be done by the logged in user.

Parameters 1

NameTypeDescription
usernamerequiredpath · stringname that need to be deleted

AcceptsUser

DELETE/user/{username}

Delete user resource

This can only be done by the logged in user.

Parameters 1

NameTypeDescription
usernamerequiredpath · stringThe name that needs to be deleted

POST/user/createWithList

Creates list of users with given input array

Creates list of users with given input array.

ReturnsUser

AcceptsUser

Response examples

200Successful operation

application/json example derived from schema

{
  "id": 10,
  "username": "theUser",
  "firstName": "John",
  "lastName": "James"
}

GET/user/login

Logs user into the system

Log into the system.

Parameters 2

NameTypeDescription
usernamequery · stringThe user name for login
passwordquery · stringThe password for login in clear text

Response examples

200successful operation

application/xml example derived from schema

"string"

GET/user/logout

Logs out current logged in user session

Log user out of the system.

Released under the MIT License.