Skip to content
My lovely API

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.

Contact​

External Documentation​

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

Servers​

//petstore.swagger.io/v2Default server
//petstore.swagger.io/sandboxSandbox server

OperationId with backslash​

GET
/pet

Playground​

Samples​


Update an existing pet​

PUT
/pet

Authorizations​

petstore_auth

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

implicit Flow
Authorization URL"http://petstore.swagger.io/api/oauth/dialog"
Scopes:
  • "write:pets"modify pets in your account
  • "read:pets"read your pets

Request Body​

My Pet

Pet ID

Format"int64"

Categories this pet belongs to

The name given to a pet

The list of URL to a cute photos featuring pet

Min Items1
Max Items10
Default

Circular reference to /root

Tags attached to the pet

Exclusive Maximum100
Exclusive Minimum0

Pet status in the store

Valid values"available""pending""sold"
Default"pending"

Type of a pet

Valid values012

Responses​

Invalid ID supplied

Playground​

Server
Authorization
Body

Samples​


Add a new pet to the store​

POST
/pet

Add new pet to the store inventory.

Authorizations​

petstore_auth

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

implicit Flow
Authorization URL"http://petstore.swagger.io/api/oauth/dialog"
Scopes:
  • "write:pets"modify pets in your account
  • "read:pets"read your pets

Request Body​

My Pet

Pet ID

Format"int64"

Categories this pet belongs to

The name given to a pet

The list of URL to a cute photos featuring pet

Min Items1
Max Items10
Default

Circular reference to /root

Tags attached to the pet

Exclusive Maximum100
Exclusive Minimum0

Pet status in the store

Valid values"available""pending""sold"
Default"pending"

Type of a pet

Valid values012

Responses​

Invalid input

Playground​

Server
Authorization
Body

Samples​


OperationId with quotes​

DELETE
/pet

Playground​

Samples​


Find pet by ID​

GET
/pet/{petId}

Returns a single pet

Authorizations​

api_key

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

Type
API Key (header: api_key)

Parameters​

Path Parameters

petId*

ID of pet to return

Type
integer
Required
Format
"int64"

Responses​

successful operation

Pet ID

Format"int64"

Categories this pet belongs to

The name given to a pet

The list of URL to a cute photos featuring pet

Min Items1
Max Items10
Default

Circular reference to /root

Tags attached to the pet

Exclusive Maximum100
Exclusive Minimum0

Pet status in the store

Valid values"available""pending""sold"
Default"pending"

Type of a pet

Valid values012

Playground​

Server
Authorization
Variables
Key
Value

Samples​


Updates a pet in the store with form data​

POST
/pet/{petId}

Authorizations​

petstore_auth

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

implicit Flow
Authorization URL"http://petstore.swagger.io/api/oauth/dialog"
Scopes:
  • "write:pets"modify pets in your account
  • "read:pets"read your pets

Parameters​

Path Parameters

petId*

ID of pet that needs to be updated

Type
integer
Required
Format
"int64"

Request Body​

application/x-www-form-urlencoded

Updated name of the pet

Updated status of the pet

Responses​

Invalid input

Playground​

Server
Authorization
Variables
Key
Value
Body

Samples​


Deletes a pet​

DELETE
/pet/{petId}

Authorizations​

petstore_auth

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

implicit Flow
Authorization URL"http://petstore.swagger.io/api/oauth/dialog"
Scopes:
  • "write:pets"modify pets in your account
  • "read:pets"read your pets

Parameters​

Header Parameters

api_key
Type
string
Example"Bearer <TOKEN>"

Path Parameters

petId*

Pet id to delete

Type
integer
Required
Format
"int64"

Responses​

Invalid pet value

Playground​

Server
Authorization
Headers
Variables
Key
Value

Samples​


uploads an image​

POST
/pet/{petId}/uploadImage

Authorizations​

petstore_auth

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

implicit Flow
Authorization URL"http://petstore.swagger.io/api/oauth/dialog"
Scopes:
  • "write:pets"modify pets in your account
  • "read:pets"read your pets

Parameters​

Path Parameters

petId*

ID of pet to update

Type
integer
Required
Format
"int64"

Request Body​

application/octet-stream
Format"binary"

Responses​

successful operation

application/json
Format"int32"

Playground​

Server
Authorization
Variables
Key
Value
Body

Samples​


Finds Pets by status​

GET
/pet/findByStatus

Multiple status values can be provided with comma separated strings

Authorizations​

petstore_auth

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

implicit Flow
Authorization URL"http://petstore.swagger.io/api/oauth/dialog"
Scopes:
  • "write:pets"modify pets in your account
  • "read:pets"read your pets

Parameters​

Query Parameters

status*

Status values that need to be considered for filter

Type
array
Required
Min Items
1
Max Items
3

Responses​

successful operation

Pet ID

Format"int64"

Categories this pet belongs to

The name given to a pet

The list of URL to a cute photos featuring pet

Min Items1
Max Items10
Default

Circular reference to /root

Tags attached to the pet

Exclusive Maximum100
Exclusive Minimum0

Pet status in the store

Valid values"available""pending""sold"
Default"pending"

Type of a pet

Valid values012

Playground​

Server
Authorization
Variables
Key
Value

Samples​


Deprecated

Finds Pets by tags​

GET
/pet/findByTags

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

Authorizations​

petstore_auth

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

implicit Flow
Authorization URL"http://petstore.swagger.io/api/oauth/dialog"
Scopes:
  • "write:pets"modify pets in your account
  • "read:pets"read your pets

Parameters​

Query Parameters

tags*

Tags to filter by

Type
array
Required

Responses​

successful operation

Pet ID

Format"int64"

Categories this pet belongs to

The name given to a pet

The list of URL to a cute photos featuring pet

Min Items1
Max Items10
Default

Circular reference to /root

Tags attached to the pet

Exclusive Maximum100
Exclusive Minimum0

Pet status in the store

Valid values"available""pending""sold"
Default"pending"

Type of a pet

Valid values012

Playground​

Server
Authorization
Variables
Key
Value

Samples​


Returns pet inventories by status​

GET
/store/inventory

Returns a map of status codes to quantities

Authorizations​

api_key

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

Type
API Key (header: api_key)

Responses​

successful operation

application/json
Format"int32"

Playground​

Server
Authorization

Samples​


Place an order for a pet​

POST
/store/order

Request Body​

application/json

Order ID

Format"int64"

Pet ID

Format"int64"
Format"int32"
Minimum1
Default1

Estimated ship date

Format"date-time"

Order Status

Valid values"placed""approved""delivered"

Indicates whenever order was completed or not

Defaultfalse

Unique Request Id

Responses​

successful operation

Order ID

Format"int64"

Pet ID

Format"int64"
Format"int32"
Minimum1
Default1

Estimated ship date

Format"date-time"

Order Status

Valid values"placed""approved""delivered"

Indicates whenever order was completed or not

Defaultfalse

Unique Request Id

Playground​

Server
Body

Samples​


Find purchase order by ID​

GET
/store/order/{orderId}

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

Parameters​

Path Parameters

orderId*

ID of pet that needs to be fetched

Type
integer
Required
Format
"int64"
Minimum
1
Maximum
5

Responses​

successful operation

Order ID

Format"int64"

Pet ID

Format"int64"
Format"int32"
Minimum1
Default1

Estimated ship date

Format"date-time"

Order Status

Valid values"placed""approved""delivered"

Indicates whenever order was completed or not

Defaultfalse

Unique Request Id

Playground​

Server
Variables
Key
Value

Samples​


Delete purchase order by ID​

DELETE
/store/order/{orderId}

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

Parameters​

Path Parameters

orderId*

ID of the order that needs to be deleted

Type
string
Required
Minimum
1

Responses​

Invalid ID supplied

Playground​

Server
Variables
Key
Value

Samples​


Subscribe to the Store events​

POST
/store/subscribe

Add subscription for a store events

Request Body​

application/json

This URL will be called by the server when the desired event will occur

Format"uri"

Event name for the subscription

Valid values"orderInProgress""orderShipped""orderDelivered"

Responses​

Successful operation

application/json
Max Items999
Min Items0

Playground​

Server
Body

Samples​


Create user​

POST
/user

This can only be done by the logged in user.

Request Body​

application/json
Format"int64"

User supplied username

Min Length4

User first name

Min Length1

User last name

Min Length1

User email address

Format"email"

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

Format"password"
Min Length8
Pattern"/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/"

User phone number in international format

Pattern"/^\\+(?:[0-9]-?){6,14}[0-9]$/"

User status

Format"int32"

User image

Min Items0
Max Length10

Responses​

successful operation

Playground​

Server
Body

Samples​


Get user by user name​

GET
/user/{username}

Parameters​

Path Parameters

username*

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

Type
string
Required

Responses​

successful operation

Format"int64"

User supplied username

Min Length4

User first name

Min Length1

User last name

Min Length1

User email address

Format"email"

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

Format"password"
Min Length8
Pattern"/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/"

User phone number in international format

Pattern"/^\\+(?:[0-9]-?){6,14}[0-9]$/"

User status

Format"int32"

User image

Min Items0
Max Length10

Playground​

Server
Variables
Key
Value

Samples​


Updated user​

PUT
/user/{username}

This can only be done by the logged in user.

Parameters​

Path Parameters

username*

name that need to be updated

Type
string
Required

Request Body​

application/json
Format"int64"

User supplied username

Min Length4

User first name

Min Length1

User last name

Min Length1

User email address

Format"email"

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

Format"password"
Min Length8
Pattern"/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/"

User phone number in international format

Pattern"/^\\+(?:[0-9]-?){6,14}[0-9]$/"

User status

Format"int32"

User image

Min Items0
Max Length10

Responses​

User is updated successfully

application/json
Format"int64"

User supplied username

Min Length4

User first name

Min Length1

User last name

Min Length1

User email address

Format"email"

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

Format"password"
Min Length8
Pattern"/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/"

User phone number in international format

Pattern"/^\\+(?:[0-9]-?){6,14}[0-9]$/"

User status

Format"int32"

User image

Min Items0
Max Length10

Playground​

Server
Variables
Key
Value
Body

Samples​


Delete user​

DELETE
/user/{username}

This can only be done by the logged in user.

Parameters​

Path Parameters

username*

The name that needs to be deleted

Type
string
Required

Responses​

User is deleted

Playground​

Server
Variables
Key
Value

Samples​


Creates list of users with given input array​

POST
/user/createWithArray

Request Body​

application/json
Format"int64"

User supplied username

Min Length4

User first name

Min Length1

User last name

Min Length1

User email address

Format"email"

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

Format"password"
Min Length8
Pattern"/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/"

User phone number in international format

Pattern"/^\\+(?:[0-9]-?){6,14}[0-9]$/"

User status

Format"int32"

User image

Min Items0
Max Length10

Responses​

successful operation

Playground​

Server
Body

Samples​


Creates list of users with given input array​

POST
/user/createWithList

Request Body​

application/json
Format"int64"

User supplied username

Min Length4

User first name

Min Length1

User last name

Min Length1

User email address

Format"email"

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

Format"password"
Min Length8
Pattern"/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/"

User phone number in international format

Pattern"/^\\+(?:[0-9]-?){6,14}[0-9]$/"

User status

Format"int32"

User image

Min Items0
Max Length10

Responses​

successful operation

Playground​

Server
Body

Samples​


Logs user into the system​

GET
/user/login

Parameters​

Query Parameters

username*

The user name for login

Type
string
Required
password*

The password for login in clear text

Type
string
Required

Responses​

successful operation

Playground​

Server
Variables
Key
Value

Samples​


Logs out current logged in user session​

GET
/user/logout

Responses​

successful operation

Playground​

Samples​


Powered by VitePress OpenAPI