Skip to main content

Swagger Petstore [Automatic Page From File] (1.0.0)

Download OpenAPI specification:Download

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

New pet Webhook

Information about a new pet in the systems

Request Body schema: application/json
id
integer <int64>

Pet ID

object

Categories this pet belongs to

name
required
string

The name given to a pet

photoUrls
required
Array of strings <url> <= 20 items

The list of URL to a cute photos featuring pet

friend
object Recursive
Array of objects (Tag) non-empty [ items ]

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

Request samples

Content type
application/json
Example
{
  • "id": 0,
  • "category": {
    },
  • "name": "Guru",
  • "photoUrls": [
    ],
  • "friend": { },
  • "tags": [
    ],
  • "status": "available",
  • "petType": "cat",
  • "huntingSkill": "adventurous"
}

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

header Parameters
Accept-Language
string
Default: en-AU
Example: en-US

The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US

Request Body schema:

Pet object that needs to be added to the store

object

Categories this pet belongs to

name
required
string

The name given to a pet

photoUrls
required
Array of strings <url> <= 20 items

The list of URL to a cute photos featuring pet

friend
object Recursive
Array of objects (Tag) non-empty [ items ]

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

Request samples

Content type
Example
{
  • "category": {
    },
  • "name": "Guru",
  • "photoUrls": [
    ],
  • "friend": { },
  • "tags": [
    ],
  • "status": "available",
  • "petType": "cat",
  • "huntingSkill": "adventurous"
}

Update an existing pet

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

Some cookie

header Parameters
Accept-Language
string
Default: en-AU
Example: en-US

The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US

Request Body schema:

Pet object that needs to be added to the store

object

Categories this pet belongs to

name
required
string

The name given to a pet

photoUrls
required
Array of strings <url> <= 20 items

The list of URL to a cute photos featuring pet

friend
object Recursive
Array of objects (Tag) non-empty [ items ]

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

Request samples

Content type
Example
{
  • "category": {
    },
  • "name": "Guru",
  • "photoUrls": [
    ],
  • "friend": { },
  • "tags": [
    ],
  • "status": "available",
  • "petType": "cat",
  • "huntingSkill": "adventurous"
}

Find pet by ID

Returns a single pet

Authorizations:
path Parameters
petId
required
integer <int64>
Deprecated

ID of pet to return

Responses

Response samples

Content type
Example
{
  • "id": 0,
  • "category": {
    },
  • "name": "Guru",
  • "photoUrls": [
    ],
  • "friend": { },
  • "tags": [
    ],
  • "status": "available",
  • "petType": "cat",
  • "huntingSkill": "adventurous"
}

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

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

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

Response samples

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

Finds Pets by status

Multiple status values can be provided with comma separated strings

Authorizations:
petstore_auth (write:petsread:pets)
query Parameters
status
required
Array of strings [ 1 .. 3 ] items
Items Enum: "available" "pending" "sold"

Status values that need to be considered for filter

Responses

Response samples

Content type
[
  • {
    }
]

Finds Pets by tags Deprecated

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

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

Tags to filter by

Responses

Response samples

Content type
[
  • {
    }
]

store

Access to Petstore orders

Returns pet inventories by status

Returns a map of status codes to quantities

Authorizations:

Responses

Response samples

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

Place an order for a pet

Request Body schema: application/json

order placed for purchasing the pet

quantity
integer <int32> >= 1
Default: 1
shipDate
string <date-time>

Estimated ship date

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

Order Status

requestId
string

Unique Request Id

Responses

Request samples

Content type
application/json
{
  • "quantity": 1,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "placed",
  • "requestId": "string"
}

Response samples

Content type
{
  • "id": 0,
  • "petId": 0,
  • "quantity": 1,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "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

Response samples

Content type
{
  • "id": 0,
  • "petId": 0,
  • "quantity": 1,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "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

Subscribe to the Store events

Add subscription for a store events

Request Body schema: application/json
callbackUrl
required
string <uri>

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

eventName
required
string
Enum: "orderInProgress" "orderShipped" "orderDelivered"

Event name for the subscription

Responses

Callbacks

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "subscriptionId": "AAA-123-BBB-456"
}

Callback payload samples

Callback
Content type
{
  • "orderId": "123",
  • "timestamp": "2018-10-19T16:46:45Z",
  • "status": "inProgress"
}

user

Operations about user

Create user

This can only be done by the logged in user.

Request Body schema: application/json

Created user object

Pet (object) or Tag (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/^\+(?:[0-9]-?){6,14}[0-9]$/

User phone number in international format

userStatus
integer <int32>

User status

Responses

Request samples

Content type
application/json
{
  • "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

Response samples

Content type
{
  • "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

Updated user object

Pet (object) or Tag (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/^\+(?:[0-9]-?){6,14}[0-9]$/

User phone number in international format

userStatus
integer <int32>

User status

Responses

Request samples

Content type
application/json
{
  • "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

Creates list of users with given input array

Request Body schema: application/json

List of user object

Array
Pet (object) or Tag (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/^\+(?:[0-9]-?){6,14}[0-9]$/

User phone number in international format

userStatus
integer <int32>

User status

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Creates list of users with given input array

Request Body schema: application/json

List of user object

Array
Pet (object) or Tag (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/^\+(?:[0-9]-?){6,14}[0-9]$/

User phone number in international format

userStatus
integer <int32>

User status

Responses

Request samples

Content type
application/json
[
  • {
    }
]

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

Response samples

Content type
"OK"

Logs out current logged in user session

Responses

The Pet Model

id
integer <int64>

Pet ID

object

Categories this pet belongs to

name
required
string

The name given to a pet

photoUrls
required
Array of strings <url> <= 20 items

The list of URL to a cute photos featuring pet

friend
object Recursive
Array of objects (Tag) non-empty [ items ]

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

Example
{
  • "id": 0,
  • "category": {
    },
  • "name": "Guru",
  • "photoUrls": [
    ],
  • "friend": { },
  • "tags": [
    ],
  • "status": "available",
  • "petType": "cat",
  • "huntingSkill": "adventurous"
}

The Order Model

id
integer <int64>

Order ID

petId
integer <int64>

Pet ID

quantity
integer <int32> >= 1
Default: 1
shipDate
string <date-time>

Estimated ship date

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

Order Status

complete
boolean
Default: false

Indicates whenever order was completed or not

requestId
string

Unique Request Id

{
  • "quantity": 1,
  • "shipDate": "2018-10-19T16:46:45Z",
  • "status": "placed",
  • "complete": false
}