Swagger Petstore (1.0.0)

Download OpenAPI specification:Download

Find out how to create Github repo for your OpenAPI spec.

This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key special-key to test the authorization filters.

Introduction

This API is documented in OpenAPI format and is based on Petstore sample provided by swagger.io team. It was extended to illustrate features of generator-openapi-repo tool and ReDoc documentation. In addition to standard OpenAPI syntax we use a few vendor extensions.

OpenAPI Specification

This API is documented in OpenAPI format and is based on Petstore sample provided by swagger.io team. It was extended to illustrate features of generator-openapi-repo tool and ReDoc documentation. In addition to standard OpenAPI syntax we use a few vendor extensions.

Cross-Origin Resource Sharing

This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with W3C spec. And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.

Authentication

Petstore offers two forms of authentication:

  • API Key
  • OAuth2

OAuth2 - an open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.

petstore_auth

Get access to data while protecting your account credentials. OAuth2 is also a safer and more secure way to give you access.

Security scheme type: OAuth2
implicit OAuth Flow
Authorization URL: http://petstore.swagger.io/api/oauth/dialog
Scopes:
  • write:pets - modify pets in your account
  • read:pets - read your pets

api_key

For this sample, you can use the api key special-key to test the authorization filters.

Security scheme type: API Key
header parameter name: api_key

pet

Everything about your Pets

Add a new pet to the store

Add new pet to the store inventory.

Authorizations:
petstore_auth (write:petsread:pets)
cookie Parameters
cookieParam
required
integer <int64>

Some cookie

Request Body schema:
category
object (Category)

Categories this pet belongs to

name
required
string

The name given to a pet

photoUrls
required
Array of string

The list of URL to a cute photos featuring pet

friend
object (Pet) Recursive
tags
Array of object

Tags attached to the pet

status
string
Enum:"available" "pending" "sold"

Pet status in the store

petType
string

Type of a pet

huntingSkill
required
string
Default: "lazy"
Enum:"clueless" "lazy" "adventurous" "aggressive"

The measured skill for hunting

Responses

405

Invalid input

post /pet
Default server
null//petstore.swagger.io/v2/pet
Sandbox server
null//petstore.swagger.io/sandbox/pet

Request samples

Copy
Expand all Collapse all
{
  • "category":
    {
    },
  • "name": "Guru",
  • "photoUrls":
    [
    ],
  • "friend": { },
  • "tags":
    [
    ],
  • "status": "available",
  • "petType": "string",
  • "huntingSkill": "lazy"
}

Update an existing pet

Authorizations:
petstore_auth (write:petsread:pets)
cookie Parameters
cookieParam
required
integer <int64>

Some cookie

Request Body schema:
category
object (Category)

Categories this pet belongs to

name
required
string

The name given to a pet

photoUrls
required
Array of string

The list of URL to a cute photos featuring pet

friend
object (Pet) Recursive
tags
Array of object

Tags attached to the pet

status
string
Enum:"available" "pending" "sold"

Pet status in the store

petType
string

Type of a pet

huntingSkill
required
string
Default: "lazy"
Enum:"clueless" "lazy" "adventurous" "aggressive"

The measured skill for hunting

Responses

400

Invalid ID supplied

404

Pet not found

405

Validation exception

put /pet
Default server
null//petstore.swagger.io/v2/pet
Sandbox server
null//petstore.swagger.io/sandbox/pet

Request samples

Copy
Expand all Collapse all
{
  • "category":
    {
    },
  • "name": "Guru",
  • "photoUrls":
    [
    ],
  • "friend": { },
  • "tags":
    [
    ],
  • "status": "available",
  • "petType": "string",
  • "huntingSkill": "lazy"
}

Find pet by ID

Returns a single pet

Authorizations:
path Parameters
petId
required
integer <int64>
Deprecated

ID of pet to return

Responses

200

successful operation

400

Invalid ID supplied

404

Pet not found

get /pet/{petId}
Default server
null//petstore.swagger.io/v2/pet/{petId}
Sandbox server
null//petstore.swagger.io/sandbox/pet/{petId}

Response samples

Copy
Expand all Collapse all
{
  • "id": 0,
  • "category":
    {
    },
  • "name": "Guru",
  • "photoUrls":
    [
    ],
  • "friend": { },
  • "tags":
    [
    ],
  • "status": "available",
  • "petType": "string",
  • "huntingSkill": "lazy"
}

Updates a pet in the store with form data

Authorizations:
petstore_auth (write:petsread:pets)
path Parameters
petId
required
integer <int64>

ID of pet that needs to be updated

Request Body schema: application/x-www-form-urlencoded
name
string

Updated name of the pet

status
string

Updated status of the pet

Responses

405

Invalid input

post /pet/{petId}
Default server
null//petstore.swagger.io/v2/pet/{petId}
Sandbox server
null//petstore.swagger.io/sandbox/pet/{petId}

Deletes a pet

Authorizations:
petstore_auth (write:petsread:pets)
path Parameters
petId
required
integer <int64>

Pet id to delete

header Parameters
api_key
string
Example: "Bearer <TOKEN>"

Responses

400

Invalid pet value

delete /pet/{petId}
Default server
null//petstore.swagger.io/v2/pet/{petId}
Sandbox server
null//petstore.swagger.io/sandbox/pet/{petId}

uploads an image

Authorizations:
petstore_auth (write:petsread:pets)
path Parameters
petId
required
integer <int64>

ID of pet to update

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

Responses

200

successful operation

post /pet/{petId}/uploadImage
Default server
null//petstore.swagger.io/v2/pet/{petId}/uploadImage
Sandbox server
null//petstore.swagger.io/sandbox/pet/{petId}/uploadImage

Response samples

application/json
Copy
Expand all Collapse all
{
  • "code": 0,
  • "type": "string",
  • "message": "string"
}

Finds Pets by status

Multiple status values can be provided with comma seperated strings

Authorizations:
petstore_auth (write:petsread:pets)
query Parameters
status
required
Array of string
Items Enum:"available" "pending" "sold"

Status values that need to be considered for filter

Responses

200

successful operation

400

Invalid status value

get /pet/findByStatus
Default server
null//petstore.swagger.io/v2/pet/findByStatus
Sandbox server
null//petstore.swagger.io/sandbox/pet/findByStatus

Response samples

Copy
Expand all Collapse all
[
  • {
    }
]

Finds Pets by tags Deprecated

Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.

Authorizations:
petstore_auth (write:petsread:pets)
query Parameters
tags
required
Array of string

Tags to filter by

Responses

200

successful operation

400

Invalid tag value

get /pet/findByTags
Default server
null//petstore.swagger.io/v2/pet/findByTags
Sandbox server
null//petstore.swagger.io/sandbox/pet/findByTags

Response samples

Copy
Expand all Collapse all
[
  • {
    }
]

store

Access to Petstore orders

Returns pet inventories by status

Returns a map of status codes to quantities

Authorizations:

Responses

200

successful operation

get /store/inventory
Default server
null//petstore.swagger.io/v2/store/inventory
Sandbox server
null//petstore.swagger.io/sandbox/store/inventory

Response samples

application/json
Copy
Expand all Collapse all
{
  • "property1": 0,
  • "property2": 0
}

Place an order for a pet

Request Body schema: application/json
quantity
integer <int32> >= 1
Default: 1
shipDate
string <date-time>

Estimated ship date

status
string
Enum:"placed" "approved" "delivered"

Order Status

complete
boolean

Indicates whenever order was completed or not

Responses

200

successful operation

400

Invalid Order

post /store/order
Default server
null//petstore.swagger.io/v2/store/order
Sandbox server
null//petstore.swagger.io/sandbox/store/order

Request samples

application/json
Copy
Expand all Collapse all
{
  • "quantity": 1,
  • "shipDate": "2018-03-18T08:51:17Z",
  • "status": "placed",
  • "complete": false
}

Response samples

Copy
Expand all Collapse all
{
  • "id": 0,
  • "petId": 0,
  • "quantity": 1,
  • "shipDate": "2018-03-18T08:51:17Z",
  • "status": "placed",
  • "complete": false
}

Find purchase order by ID

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

path Parameters
orderId
required
integer <int64> [ 1 .. 5 ]

ID of pet that needs to be fetched

Responses

200

successful operation

400

Invalid ID supplied

404

Order not found

get /store/order/{orderId}
Default server
null//petstore.swagger.io/v2/store/order/{orderId}
Sandbox server
null//petstore.swagger.io/sandbox/store/order/{orderId}

Response samples

Copy
Expand all Collapse all
{
  • "id": 0,
  • "petId": 0,
  • "quantity": 1,
  • "shipDate": "2018-03-18T08:51:17Z",
  • "status": "placed",
  • "complete": false
}

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
string >= 1

ID of the order that needs to be deleted

Responses

400

Invalid ID supplied

404

Order not found

delete /store/order/{orderId}
Default server
null//petstore.swagger.io/v2/store/order/{orderId}
Sandbox server
null//petstore.swagger.io/sandbox/store/order/{orderId}

user

Operations about user

Create user

This can only be done by the logged in user.

Request Body schema: application/json
pet
object or object
username
string >= 4 characters

User supplied username

firstName
string non-empty

User first name

lastName
string non-empty

User last name

email
string <email>

User email address

password
string <password> >= 8 characters (?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])

User password, MUST contain a mix of upper and lower case letters, as well as digits

phone
string Nullable ^\+(?:[0-9]-?){6,14}[0-9]$

User phone number in international format

userStatus
integer <int32>

User status

Responses

default

successful operation

post /user
Default server
null//petstore.swagger.io/v2/user
Sandbox server
null//petstore.swagger.io/sandbox/user

Request samples

application/json
Copy
Expand all Collapse all
{
  • "pet":
    {
    },
  • "username": "John78",
  • "firstName": "John",
  • "lastName": "Smith",
  • "email": "john.smith@example.com",
  • "password": "drowssaP123",
  • "phone": "+1-202-555-0192",
  • "userStatus": 0
}

Get user by user name

path Parameters
username
required
string

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

Responses

200

successful operation

400

Invalid username supplied

404

User not found

get /user/{username}
Default server
null//petstore.swagger.io/v2/user/{username}
Sandbox server
null//petstore.swagger.io/sandbox/user/{username}

Response samples

Copy
Expand all Collapse all
{
  • "id": 0,
  • "pet":
    {
    },
  • "username": "John78",
  • "firstName": "John",
  • "lastName": "Smith",
  • "email": "john.smith@example.com",
  • "password": "drowssaP123",
  • "phone": "+1-202-555-0192",
  • "userStatus": 0
}

Updated 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: application/json
pet
object or object
username
string >= 4 characters

User supplied username

firstName
string non-empty

User first name

lastName
string non-empty

User last name

email
string <email>

User email address

password
string <password> >= 8 characters (?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])

User password, MUST contain a mix of upper and lower case letters, as well as digits

phone
string Nullable ^\+(?:[0-9]-?){6,14}[0-9]$

User phone number in international format

userStatus
integer <int32>

User status

Responses

400

Invalid user supplied

404

User not found

put /user/{username}
Default server
null//petstore.swagger.io/v2/user/{username}
Sandbox server
null//petstore.swagger.io/sandbox/user/{username}

Request samples

application/json
Copy
Expand all Collapse all
{
  • "pet":
    {
    },
  • "username": "John78",
  • "firstName": "John",
  • "lastName": "Smith",
  • "email": "john.smith@example.com",
  • "password": "drowssaP123",
  • "phone": "+1-202-555-0192",
  • "userStatus": 0
}

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

400

Invalid username supplied

404

User not found

delete /user/{username}
Default server
null//petstore.swagger.io/v2/user/{username}
Sandbox server
null//petstore.swagger.io/sandbox/user/{username}

Creates list of users with given input array

Request Body schema: application/json
Array
pet
object or object
username
string >= 4 characters

User supplied username

firstName
string non-empty

User first name

lastName
string non-empty

User last name

email
string <email>

User email address

password
string <password> >= 8 characters (?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])

User password, MUST contain a mix of upper and lower case letters, as well as digits

phone
string Nullable ^\+(?:[0-9]-?){6,14}[0-9]$

User phone number in international format

userStatus
integer <int32>

User status

Responses

default

successful operation

post /user/createWithArray
Default server
null//petstore.swagger.io/v2/user/createWithArray
Sandbox server
null//petstore.swagger.io/sandbox/user/createWithArray

Request samples

application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Creates list of users with given input array

Request Body schema: application/json
Array
pet
object or object
username
string >= 4 characters

User supplied username

firstName
string non-empty

User first name

lastName
string non-empty

User last name

email
string <email>

User email address

password
string <password> >= 8 characters (?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])

User password, MUST contain a mix of upper and lower case letters, as well as digits

phone
string Nullable ^\+(?:[0-9]-?){6,14}[0-9]$

User phone number in international format

userStatus
integer <int32>

User status

Responses

default

successful operation

post /user/createWithList
Default server
null//petstore.swagger.io/v2/user/createWithList
Sandbox server
null//petstore.swagger.io/sandbox/user/createWithList

Request samples

application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Logs user into the system

query Parameters
username
required
string

The user name for login

password
required
string

The password for login in clear text

Responses

200

successful operation

400

Invalid username/password supplied

get /user/login
Default server
null//petstore.swagger.io/v2/user/login
Sandbox server
null//petstore.swagger.io/sandbox/user/login

Response samples

Copy
Expand all Collapse all
"OK"

Logs out current logged in user session

Responses

default

successful operation

get /user/logout
Default server
null//petstore.swagger.io/v2/user/logout
Sandbox server
null//petstore.swagger.io/sandbox/user/logout