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

Returns pet inventories by status

Request

Returns a map of status codes to quantities

curl -i -X GET \
  https://redocly.com/_mock/docs/openapi/petstore/store/inventory \
  -H 'api_key: YOUR_API_KEY_HERE'
Experience it firsthand in the API Explorer!

Responses

successful operation

Bodyapplication/json
property name*integer(int32)additional property
Response
application/json
{ "property1": 0, "property2": 0 }

Place an order for a pet

Request

Bodyapplication/jsonrequired

order placed for purchasing the pet

quantityinteger(int32)>= 1
Default 1
shipDatestring(date-time)

Estimated ship date

statusstring

Order Status

Enum"placed""approved""delivered"
requestIdstringwrite-only

Unique Request Id

curl -i -X POST \
  https://redocly.com/_mock/docs/openapi/petstore/store/order \
  -H 'Content-Type: application/json' \
  -d '{
    "quantity": 1,
    "shipDate": "2019-08-24T14:15:22Z",
    "status": "placed",
    "requestId": "string"
  }'
Experience it firsthand in the API Explorer!

Responses

successful operation

Body
idinteger(int64)read-only

Order ID

petIdinteger(int64)read-only

Pet ID

quantityinteger(int32)>= 1
Default 1
shipDatestring(date-time)

Estimated ship date

statusstring

Order Status

Enum"placed""approved""delivered"
completebooleanread-only

Indicates whenever order was completed or not

Default false
Response
{ "id": 0, "petId": 0, "quantity": 1, "shipDate": "2019-08-24T14:15:22Z", "status": "placed", "complete": false }

Find purchase order by ID

Request

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

Path
orderIdinteger(int64)[ 1 .. 5 ]required

ID of pet that needs to be fetched

curl -i -X GET \
  'https://redocly.com/_mock/docs/openapi/petstore/store/order/{orderId}'
Experience it firsthand in the API Explorer!

Responses

successful operation

Body
idinteger(int64)read-only

Order ID

petIdinteger(int64)read-only

Pet ID

quantityinteger(int32)>= 1
Default 1
shipDatestring(date-time)

Estimated ship date

statusstring

Order Status

Enum"placed""approved""delivered"
completebooleanread-only

Indicates whenever order was completed or not

Default false
Response
{ "id": 0, "petId": 0, "quantity": 1, "shipDate": "2019-08-24T14:15:22Z", "status": "placed", "complete": false }

Delete purchase order by ID

Request

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

Path
orderIdstring>= 1required

ID of the order that needs to be deleted

curl -i -X DELETE \
  'https://redocly.com/_mock/docs/openapi/petstore/store/order/{orderId}'
Experience it firsthand in the API Explorer!

Responses

Invalid ID supplied

Subscribe to the Store events

Request

Add subscription for a store events

Bodyapplication/json
callbackUrlstring(uri)required

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

Example:

"https://myserver.com/send/callback/here"

eventNamestringrequired

Event name for the subscription

Enum"orderInProgress""orderShipped""orderDelivered"
Example:

"orderInProgress"

curl -i -X POST \
  https://redocly.com/_mock/docs/openapi/petstore/store/subscribe \
  -H 'Content-Type: application/json' \
  -d '{
    "callbackUrl": "https://myserver.com/send/callback/here",
    "eventName": "orderInProgress"
  }'
Experience it firsthand in the API Explorer!

Responses

Subscription added

Bodyapplication/json
subscriptionIdstring
Example:

"AAA-123-BBB-456"

Response
application/json
{ "subscriptionId": "AAA-123-BBB-456" }

Callbacks

Order in Progress (Summary)
post
Order in Progress (Only Description)
put
Very long description Lorem ipsum dolor sit amet,
post
Order delivered
post
Deprecated

user

Operations about user

Operations

The Pet Model

The Order Model