Skip to content
v1.0.0

Swagger Petstore

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

ID: delete\PetById

OperationId with backslash

GET
/pet
Server

Samples


ID: addPet

Add a new pet to the store

POST
/pet
Server

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 URLhttp://petstore.swagger.io/api/oauth/dialog
Scopes:
  • write:petsmodify pets in your account
  • read:petsread your pets

Request Body

JSON
{
"id": 0,
"category": {
"id": 0,
"name": "string",
"sub": {
"prop1": "string"
}
},
"name": "Guru",
"photoUrls": [
],
"friend": "[Circular Reference]",
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "string",
"petType": "string",
"huntingSkill": {
}
}

Responses

Invalid input

Samples


ID: updatePet

Update an existing pet

PUT
/pet
Server

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 URLhttp://petstore.swagger.io/api/oauth/dialog
Scopes:
  • write:petsmodify pets in your account
  • read:petsread your pets

Request Body

JSON
{
"id": 0,
"category": {
"id": 0,
"name": "string",
"sub": {
"prop1": "string"
}
},
"name": "Guru",
"photoUrls": [
],
"friend": "[Circular Reference]",
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "string",
"petType": "string",
"huntingSkill": {
}
}

Responses

Invalid ID supplied

Samples


ID: deletePetBy"Id

OperationId with quotes

DELETE
/pet
Server

Samples


ID: getPetById

Find pet by ID

GET
/pet/{petId}
Server

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
formatint64

Responses

successful operation
JSON
{
"id": 0,
"category": {
"id": 0,
"name": "string",
"sub": {
"prop1": "string"
}
},
"name": "Guru",
"photoUrls": [
],
"friend": "[Circular Reference]",
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "string",
"petType": "string",
"huntingSkill": {
}
}

Samples


ID: updatePetWithForm

Updates a pet in the store with form data

POST
/pet/{petId}
Server

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 URLhttp://petstore.swagger.io/api/oauth/dialog
Scopes:
  • write:petsmodify pets in your account
  • read:petsread your pets

Parameters

Path Parameters

petId*

ID of pet that needs to be updated

Typeinteger
Required
formatint64

Request Body

JSON
{
"name": "string",
"status": "string"
}

Responses

Invalid input

Samples


ID: deletePet

Deletes a pet

DELETE
/pet/{petId}
Server

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 URLhttp://petstore.swagger.io/api/oauth/dialog
Scopes:
  • write:petsmodify pets in your account
  • read:petsread your pets

Parameters

Header Parameters

api_key
Typestring
ExampleBearer <TOKEN>

Path Parameters

petId*

Pet id to delete

Typeinteger
Required
formatint64

Responses

Invalid pet value

Samples


ID: uploadFile

uploads an image

POST
/pet/{petId}/uploadImage
Server

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 URLhttp://petstore.swagger.io/api/oauth/dialog
Scopes:
  • write:petsmodify pets in your account
  • read:petsread your pets

Parameters

Path Parameters

petId*

ID of pet to update

Typeinteger
Required
formatint64

Request Body

JSON
"string"

Responses

successful operation
application/json
JSON
{
"code": 0,
"type": "string",
"message": "string"
}

Samples


ID: findPetsByStatus

Finds Pets by status

GET
/pet/findByStatus
Server

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 URLhttp://petstore.swagger.io/api/oauth/dialog
Scopes:
  • write:petsmodify pets in your account
  • read:petsread your pets

Parameters

Query Parameters

status*

Status values that need to be considered for filter

Typearray
Required
minItems1
maxItems3

Responses

successful operation
JSON
[
{
"id": 0,
"category": {
"id": 0,
"name": "string",
"sub": {
"prop1": "string"
}
},
"name": "Guru",
"photoUrls": [
],
"friend": "[Circular Reference]",
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "string",
"petType": "string",
"huntingSkill": {
}
}
]

Samples


Deprecated
ID: findPetsByTags

Finds Pets by tags

GET
/pet/findByTags
Server

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 URLhttp://petstore.swagger.io/api/oauth/dialog
Scopes:
  • write:petsmodify pets in your account
  • read:petsread your pets

Parameters

Query Parameters

tags*

Tags to filter by

Typearray
Required

Responses

successful operation
JSON
[
{
"id": 0,
"category": {
"id": 0,
"name": "string",
"sub": {
"prop1": "string"
}
},
"name": "Guru",
"photoUrls": [
],
"friend": "[Circular Reference]",
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "string",
"petType": "string",
"huntingSkill": {
}
}
]

Samples


ID: getInventory

Returns pet inventories by status

GET
/store/inventory
Server

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
JSON
{
"additionalProperties": 0
}

Samples


ID: placeOrder

Place an order for a pet

POST
/store/order
Server

Request Body

JSON
{
"id": 0,
"petId": 0,
"quantity": 1,
"shipDate": "string",
"status": "string",
"complete": false,
"requestId": "string"
}

Responses

successful operation
JSON
{
"id": 0,
"petId": 0,
"quantity": 1,
"shipDate": "string",
"status": "string",
"complete": false,
"requestId": "string"
}

Samples


ID: getOrderById

Find purchase order by ID

GET
/store/order/{orderId}
Server

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
formatint64
minimum1
maximum5

Responses

successful operation
JSON
{
"id": 0,
"petId": 0,
"quantity": 1,
"shipDate": "string",
"status": "string",
"complete": false,
"requestId": "string"
}

Samples


ID: deleteOrder

Delete purchase order by ID

DELETE
/store/order/{orderId}
Server

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

Samples


ID: post-store-subscribe

Subscribe to the Store events

POST
/store/subscribe
Server

Add subscription for a store events

Request Body

JSON
{
"callbackUrl": "https://myserver.com/send/callback/here",
"eventName": "string"
}

Responses

Successful operation
application/json
JSON
[
[
]
]

Samples


ID: createUser

Create user

POST
/user
Server

This can only be done by the logged in user.

Request Body

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

Responses

successful operation

Samples


ID: getUserByName

Get user by user name

GET
/user/{username}
Server

Parameters

Path Parameters

username*

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

Typestring
Required

Responses

successful operation
JSON
{
"id": 0,
"pet": {
"id": 0,
"category": {
"id": 0,
"name": "string",
"sub": {
"prop1": "string"
}
},
"name": "Guru",
"photoUrls": [
],
"friend": "[Circular Reference]",
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "string",
"petType": "string",
"huntingSkill": {
}
},
"username": "John78",
"firstName": "John",
"lastName": "Smith",
"email": "john.smith@example.com",
"password": "drowssaP123",
"phone": "+1-202-555-0192",
"userStatus": 0,
"image": "string",
"addresses": [
"string"
]
}

Samples


ID: updateUser

Updated user

PUT
/user/{username}
Server

This can only be done by the logged in user.

Parameters

Path Parameters

username*

name that need to be updated

Typestring
Required

Request Body

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

Responses

User is updated successfully
application/json
JSON
{
"id": 0,
"pet": {
"id": 0,
"category": {
"id": 0,
"name": "string",
"sub": {
"prop1": "string"
}
},
"name": "Guru",
"photoUrls": [
],
"friend": "[Circular Reference]",
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "string",
"petType": "string",
"huntingSkill": {
}
},
"username": "John78",
"firstName": "John",
"lastName": "Smith",
"email": "john.smith@example.com",
"password": "drowssaP123",
"phone": "+1-202-555-0192",
"userStatus": 0,
"image": "string",
"addresses": [
"string"
]
}

Samples


ID: deleteUser

Delete user

DELETE
/user/{username}
Server

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

Samples


ID: createUsersWithArrayInput

Creates list of users with given input array

POST
/user/createWithArray
Server

Request Body

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

Responses

successful operation

Samples


ID: createUsersWithListInput

Creates list of users with given input array

POST
/user/createWithList
Server

Request Body

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

Responses

successful operation

Samples


ID: loginUser

Logs user into the system

GET
/user/login
Server

Parameters

Query Parameters

username*

The user name for login

Typestring
Required
password*

The password for login in clear text

Typestring
Required

Responses

successful operation
JSON
"OK"

Samples


ID: logoutUser

Logs out current logged in user session

GET
/user/logout
Server

Responses

successful operation

Samples


Powered by VitePress OpenAPI