Unfortunately, this feature is not supported on mobile devices. For the best experience, please use a computer.

Swagger Petstore (1.0.0)

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.

Download OpenAPI description
Languages
Servers
Mock server
https://redocly.com/_mock/docs/openapi/petstore/
Default server
https://petstore.swagger.io/v2/
Sandbox server
https://petstore.swagger.io/sandbox/

pet

Everything about your Pets

Operations

store

Access to Petstore orders

Operations

user

Operations about user

Operations

Create user

Request

This can only be done by the logged in user.

Bodyapplication/jsonrequired

Created user object

petPet (object) or Tag (object)
One of:
usernamestring>= 4 characters

User supplied username

Example:

"John78"

firstNamestringnon-empty

User first name

Example:

"John"

lastNamestringnon-empty

User last name

Example:

"Smith"

emailstring(email)

User email address

Example:

"john.smith@example.com"

passwordstring(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

Example:

"drowssaP123"

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

User phone number in international format

Example:

"+1-202-555-0192"

userStatusinteger(int32)

User status

curl -i -X POST \
  https://redocly.com/_mock/docs/openapi/petstore/user \
  -H 'Content-Type: application/json' \
  -d '{
    "pet": {
      "category": {
        "name": "string",
        "sub": {
          "prop1": "string"
        }
      },
      "name": "Guru",
      "photoUrls": [
        "string"
      ],
      "friend": {},
      "tags": [
        {
          "name": "string"
        }
      ],
      "status": "available",
      "petType": "string"
    },
    "username": "John78",
    "firstName": "John",
    "lastName": "Smith",
    "email": "john.smith@example.com",
    "password": "drowssaP123",
    "phone": "+1-202-555-0192",
    "userStatus": 0
  }'
Experience it firsthand in the API Explorer!

Responses

successful operation

Get user by user name

Request

Path
usernamestringrequired

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

Responses

successful operation

Body
idinteger(int64)(Id)read-only
petPet (object) or Tag (object)
One of:
usernamestring>= 4 characters

User supplied username

Example:

"John78"

firstNamestringnon-empty

User first name

Example:

"John"

lastNamestringnon-empty

User last name

Example:

"Smith"

emailstring(email)

User email address

Example:

"john.smith@example.com"

passwordstring(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

Example:

"drowssaP123"

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

User phone number in international format

Example:

"+1-202-555-0192"

userStatusinteger(int32)

User status

Response
{ "id": 0, "pet": { "id": 0, "category": {}, "name": "Guru", "photoUrls": [], "friend": {}, "tags": [], "status": "available", "petType": "string" }, "username": "John78", "firstName": "John", "lastName": "Smith", "email": "john.smith@example.com", "password": "drowssaP123", "phone": "+1-202-555-0192", "userStatus": 0 }

Updated user

Request

This can only be done by the logged in user.

Path
usernamestringrequired

name that need to be deleted

Bodyapplication/jsonrequired

Updated user object

petPet (object) or Tag (object)
One of:
usernamestring>= 4 characters

User supplied username

Example:

"John78"

firstNamestringnon-empty

User first name

Example:

"John"

lastNamestringnon-empty

User last name

Example:

"Smith"

emailstring(email)

User email address

Example:

"john.smith@example.com"

passwordstring(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

Example:

"drowssaP123"

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

User phone number in international format

Example:

"+1-202-555-0192"

userStatusinteger(int32)

User status

curl -i -X PUT \
  'https://redocly.com/_mock/docs/openapi/petstore/user/{username}' \
  -H 'Content-Type: application/json' \
  -d '{
    "pet": {
      "category": {
        "name": "string",
        "sub": {
          "prop1": "string"
        }
      },
      "name": "Guru",
      "photoUrls": [
        "string"
      ],
      "friend": {},
      "tags": [
        {
          "name": "string"
        }
      ],
      "status": "available",
      "petType": "string"
    },
    "username": "John78",
    "firstName": "John",
    "lastName": "Smith",
    "email": "john.smith@example.com",
    "password": "drowssaP123",
    "phone": "+1-202-555-0192",
    "userStatus": 0
  }'
Experience it firsthand in the API Explorer!

Responses

Invalid user supplied

Delete user

Request

This can only be done by the logged in user.

Path
usernamestringrequired

The name that needs to be deleted

Responses

Invalid username supplied

Creates list of users with given input array

Request

Bodyapplication/jsonrequired

List of user object

Array [
petPet (object) or Tag (object)
One of:
usernamestring>= 4 characters

User supplied username

Example:

"John78"

firstNamestringnon-empty

User first name

Example:

"John"

lastNamestringnon-empty

User last name

Example:

"Smith"

emailstring(email)

User email address

Example:

"john.smith@example.com"

passwordstring(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

Example:

"drowssaP123"

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

User phone number in international format

Example:

"+1-202-555-0192"

userStatusinteger(int32)

User status

]
curl -i -X POST \
  https://redocly.com/_mock/docs/openapi/petstore/user/createWithArray \
  -H 'Content-Type: application/json' \
  -d '{}'
Experience it firsthand in the API Explorer!

Responses

successful operation

Creates list of users with given input array

Request

Bodyapplication/jsonrequired

List of user object

Array [
petPet (object) or Tag (object)
One of:
usernamestring>= 4 characters

User supplied username

Example:

"John78"

firstNamestringnon-empty

User first name

Example:

"John"

lastNamestringnon-empty

User last name

Example:

"Smith"

emailstring(email)

User email address

Example:

"john.smith@example.com"

passwordstring(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

Example:

"drowssaP123"

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

User phone number in international format

Example:

"+1-202-555-0192"

userStatusinteger(int32)

User status

]
curl -i -X POST \
  https://redocly.com/_mock/docs/openapi/petstore/user/createWithList \
  -H 'Content-Type: application/json' \
  -d '{}'
Experience it firsthand in the API Explorer!

Responses

successful operation

Logs user into the system

Request

Query
usernamestringrequired

The user name for login

passwordstringrequired

The password for login in clear text

curl -i -X GET \
  'https://redocly.com/_mock/docs/openapi/petstore/user/login?password=string&username=string'
Experience it firsthand in the API Explorer!

Responses

successful operation

Headers
X-Rate-Limitinteger(int32)

calls per hour allowed by the user

X-Expires-Afterstring(date-time)

date in UTC when token expires

Body
string
Response
"OK"

Logs out current logged in user session

Responses

successful operation

The Pet Model

The Order Model