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

cURL
JavaScript
PHP
Python

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

object

My Pet

Pet ID

Format"int64"
object

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

object[]

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

cURL
JavaScript
PHP
Python

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

object

My Pet

Pet ID

Format"int64"
object

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

object[]

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

cURL
JavaScript
PHP
Python

OperationId with quotes

DELETE
/pet

Playground

Samples

cURL
JavaScript
PHP
Python

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.

TypeAPI Key (header: api_key)

Parameters

Path Parameters

petId*

ID of pet to return

Typeinteger
Required
format"int64"

Responses

successful operation

object

Pet ID

Format"int64"
object

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

object[]

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

cURL
JavaScript
PHP
Python

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

Typeinteger
Required
format"int64"

Request Body

application/x-www-form-urlencoded
object

Updated name of the pet

Updated status of the pet

Responses

Invalid input

Playground

Server
Authorization
Variables
Key
Value
Body

Samples

cURL
JavaScript
PHP
Python

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
Typestring
Example"Bearer <TOKEN>"

Path Parameters

petId*

Pet id to delete

Typeinteger
Required
format"int64"

Responses

Invalid pet value

Playground

Server
Authorization
Headers
Variables
Key
Value

Samples

cURL
JavaScript
PHP
Python

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

Typeinteger
Required
format"int64"

Request Body

application/octet-stream
Format"binary"

Responses

successful operation

application/json
object
Format"int32"

Playground

Server
Authorization
Variables
Key
Value
Body

Samples

cURL
JavaScript
PHP
Python

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

Typearray
Required
minItems1
maxItems3

Responses

successful operation

object[]

Pet ID

Format"int64"
object

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

object[]

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

cURL
JavaScript
PHP
Python

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

Typearray
Required

Responses

successful operation

object[]

Pet ID

Format"int64"
object

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

object[]

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

cURL
JavaScript
PHP
Python

store


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.

TypeAPI Key (header: api_key)

Responses

successful operation

application/json
object

Playground

Server
Authorization

Samples

cURL
JavaScript
PHP
Python

Place an order for a pet

POST
/store/order

Request Body

application/json
object

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

object

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

cURL
JavaScript
PHP
Python

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

Typeinteger
Required
format"int64"
minimum1
maximum5

Responses

successful operation

object

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

cURL
JavaScript
PHP
Python

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

Typestring
Required
minimum1

Responses

Invalid ID supplied

Playground

Server
Variables
Key
Value

Samples

cURL
JavaScript
PHP
Python

Subscribe to the Store events

POST
/store/subscribe

Add subscription for a store events

Request Body

application/json
object

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

cURL
JavaScript
PHP
Python

user


Create user

POST
/user

This can only be done by the logged in user.

Request Body

application/json
object
Format"int64"
object

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

array
Min Items0
Max Length10

Responses

successful operation

Playground

Server
Body

Samples

cURL
JavaScript
PHP
Python

Get user by user name

GET
/user/{username}

Parameters

Path Parameters

username*

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

Typestring
Required

Responses

successful operation

object
Format"int64"
object

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

array
Min Items0
Max Length10

Playground

Server
Variables
Key
Value

Samples

cURL
JavaScript
PHP
Python

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

Typestring
Required

Request Body

application/json
object
Format"int64"
object

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

array
Min Items0
Max Length10

Responses

User is updated successfully

application/json
object
Format"int64"
object

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

array
Min Items0
Max Length10

Playground

Server
Variables
Key
Value
Body

Samples

cURL
JavaScript
PHP
Python

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

Typestring
Required

Responses

User is deleted

Playground

Server
Variables
Key
Value

Samples

cURL
JavaScript
PHP
Python

Creates list of users with given input array

POST
/user/createWithArray

Request Body

application/json
object[]
Format"int64"
object

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

array
Min Items0
Max Length10

Responses

successful operation

Playground

Server
Body

Samples

cURL
JavaScript
PHP
Python

Creates list of users with given input array

POST
/user/createWithList

Request Body

application/json
object[]
Format"int64"
object

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

array
Min Items0
Max Length10

Responses

successful operation

Playground

Server
Body

Samples

cURL
JavaScript
PHP
Python

Logs user into the system

GET
/user/login

Parameters

Query Parameters

username*

The user name for login

Typestring
Required
password*

The password for login in clear text

Typestring
Required

Responses

successful operation

Playground

Server
Variables
Key
Value

Samples

cURL
JavaScript
PHP
Python

Logs out current logged in user session

GET
/user/logout

Responses

successful operation

Playground

Samples

cURL
JavaScript
PHP
Python

Powered by VitePress OpenAPI