Swagger Petstore - OpenAPI 3.0 (1.0.11)

Download OpenAPI specification:Download

This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about Swagger at https://swagger.io. In the third iteration of the pet store, we've switched to the design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3.

If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then click here. Alternatively, you can load via the Edit > Load Petstore OAS 2.0 menu option!

Some useful links:

pet

Everything about your Pets

Update an existing pet

Update an existing pet by Id

Authorizations:
petstore_auth
Request Body schema:
required

Update an existent pet in the store

id
integer <int64>
name
required
string
object (Category)
photoUrls
required
Array of strings
Array of objects (Tag)
status
string
Enum: "available" "pending" "sold"

pet status in the store

Responses

Request samples

Content type
{
  • "id": 10,
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Response samples

Content type
{
  • "id": 10,
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Add a new pet to the store

Add a new pet to the store

Authorizations:
petstore_auth
Request Body schema:
required

Create a new pet in the store

id
integer <int64>
name
required
string
object (Category)
photoUrls
required
Array of strings
Array of objects (Tag)
status
string
Enum: "available" "pending" "sold"

pet status in the store

Responses

Request samples

Content type
{
  • "id": 10,
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Response samples

Content type
{
  • "id": 10,
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Finds Pets by status

Multiple status values can be provided with comma separated strings

Authorizations:
petstore_auth
query Parameters
status
string
Default: "available"
Enum: "available" "pending" "sold"

Status values that need to be considered for filter

Responses

Response samples

Content type
[
  • {
    }
]

Finds Pets by tags

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

Authorizations:
petstore_auth
query Parameters
tags
Array of strings

Tags to filter by

Responses

Response samples

Content type
[
  • {
    }
]

Find pet by ID

Returns a single pet

Authorizations:
api_keypetstore_auth
path Parameters
petId
required
integer <int64>

ID of pet to return

Responses

Response samples

Content type
{
  • "id": 10,
  • "name": "doggie",
  • "category": {
    },
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Updates a pet in the store with form data

Authorizations:
petstore_auth
path Parameters
petId
required
integer <int64>

ID of pet that needs to be updated

query Parameters
name
string

Name of pet that needs to be updated

status
string

Status of pet that needs to be updated

Responses

Deletes a pet

delete a pet

Authorizations:
petstore_auth
path Parameters
petId
required
integer <int64>

Pet id to delete

header Parameters
api_key
string

Responses

uploads an image

Authorizations:
petstore_auth
path Parameters
petId
required
integer <int64>

ID of pet to update

query Parameters
additionalMetadata
string

Additional Metadata

Request Body schema: application/octet-stream
string <binary>

Responses

Response samples

Content type
application/json
{
  • "code": 0,
  • "type": "string",
  • "message": "string"
}

store

Access to Petstore orders

Returns pet inventories by status

Returns a map of status codes to quantities

Authorizations:
api_key

Responses

Response samples

Content type
application/json
{
  • "property1": 0,
  • "property2": 0
}

Place an order for a pet

Place a new order in the store

Request Body schema:
id
integer <int64>
petId
integer <int64>
quantity
integer <int32>
shipDate
string <date-time>
status
string
Enum: "placed" "approved" "delivered"

Order Status

complete
boolean

Responses

Request samples

Content type
{
  • "id": 10,
  • "petId": 198772,
  • "quantity": 7,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "approved",
  • "complete": true
}

Response samples

Content type
application/json
{
  • "id": 10,
  • "petId": 198772,
  • "quantity": 7,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "approved",
  • "complete": true
}

Find purchase order by ID

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

path Parameters
orderId
required
integer <int64>

ID of order that needs to be fetched

Responses

Response samples

Content type
{
  • "id": 10,
  • "petId": 198772,
  • "quantity": 7,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "approved",
  • "complete": true
}

Delete purchase order by ID

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

path Parameters
orderId
required
integer <int64>

ID of the order that needs to be deleted

Responses

user

Operations about user

Create user

This can only be done by the logged in user.

Request Body schema:

Created user object

id
integer <int64>
username
string
firstName
string
lastName
string
email
string
password
string
phone
string
userStatus
integer <int32>

User Status

Responses

Request samples

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

Response samples

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

Creates list of users with given input array

Creates list of users with given input array

Request Body schema: application/json
Array
id
integer <int64>
username
string
firstName
string
lastName
string
email
string
password
string
phone
string
userStatus
integer <int32>

User Status

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

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

Logs user into the system

query Parameters
username
string

The user name for login

password
string

The password for login in clear text

Responses

Response samples

Content type
"string"

Logs out current logged in user session

Responses

Get user by user name

path Parameters
username
required
string

The name that needs to be fetched. Use user1 for testing.

Responses

Response samples

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

Update user

This can only be done by the logged in user.

path Parameters
username
required
string

name that need to be deleted

Request Body schema:

Update an existent user in the store

id
integer <int64>
username
string
firstName
string
lastName
string
email
string
password
string
phone
string
userStatus
integer <int32>

User Status

Responses

Request samples

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

Delete user

This can only be done by the logged in user.

path Parameters
username
required
string

The name that needs to be deleted

Responses