Skip to main content

Swagger Petstore (1.0.6)

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.

Authentication

api_key

Security Scheme Type API Key
Header parameter name: api_key

petstore_auth

Security Scheme Type OAuth2
implicit OAuth Flow
Authorization URL: https://petstore.swagger.io/oauth/authorize
Scopes:
  • read:pets -

    read your pets

  • write:pets -

    modify pets in your account

pet

Everything about your Pets

uploads an image

Authorizations:
petstore_auth (
  • write:pets
  • read:pets
)
path Parameters
petId
required
integer <int64>

ID of pet to update

Request Body schema: multipart/form-data
additionalMetadata
string

Additional data to pass to server

file
string <binary>

file to upload

Responses

Response samples

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

Add a new pet to the store

Authorizations:
petstore_auth (
  • write:pets
  • read:pets
)
Request Body schema:

Pet object that needs to be added to the store

id
integer <int64>
object (Category)
name
required
string
photoUrls
required
Array of strings
Array of objects (Tag) [ items ]
status
string
Enum: "available" "pending" "sold"

pet status in the store

Responses

Request samples

Content type
{
  • "id": 0,
  • "category": {
    },
  • "name": "doggie",
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Update an existing pet

Authorizations:
petstore_auth (
  • write:pets
  • read:pets
)
Request Body schema:

Pet object that needs to be added to the store

id
integer <int64>
object (Category)
name
required
string
photoUrls
required
Array of strings
Array of objects (Tag) [ items ]
status
string
Enum: "available" "pending" "sold"

pet status in the store

Responses

Request samples

Content type
{
  • "id": 0,
  • "category": {
    },
  • "name": "doggie",
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Finds Pets by status

Multiple status values can be provided with comma separated strings

Authorizations:
petstore_auth (
  • write:pets
  • read:pets
)
query Parameters
status
required
Array of strings
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:pets
  • read:pets
)
query Parameters
tags
required
Array of strings

Tags to filter by

Responses

Response samples

Content type
[
  • {
    }
]

Find pet by ID

Returns a single pet

Authorizations:
path Parameters
petId
required
integer <int64>

ID of pet to return

Responses

Response samples

Content type
{
  • "id": 0,
  • "category": {
    },
  • "name": "doggie",
  • "photoUrls": [
    ],
  • "tags": [
    ],
  • "status": "available"
}

Updates a pet in the store with form data

Authorizations:
petstore_auth (
  • write:pets
  • read: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:pets
  • read:pets
)
path Parameters
petId
required
integer <int64>

Pet id to delete

header Parameters
api_key
string

Responses

store

Access to Petstore orders

Place an order for a pet

Request Body schema: application/json

order placed for purchasing the pet

id
integer <int64>
petId
integer <int64>
quantity
integer <int32>
shipDate
string <date-time>
status
string
Enum: "placed" "approved" "delivered"

Order Status

complete
boolean

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "petId": 0,
  • "quantity": 0,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "placed",
  • "complete": true
}

Response samples

Content type
{
  • "id": 0,
  • "petId": 0,
  • "quantity": 0,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "placed",
  • "complete": true
}

Find purchase order by ID

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

path Parameters
orderId
required
integer <int64> [ 1 .. 10 ]

ID of pet that needs to be fetched

Responses

Response samples

Content type
{
  • "id": 0,
  • "petId": 0,
  • "quantity": 0,
  • "shipDate": "2019-08-24T14:15:22Z",
  • "status": "placed",
  • "complete": true
}

Delete purchase order by ID

For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors

path Parameters
orderId
required
integer <int64> >= 1

ID of the order that needs to be deleted

Responses

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
}

user

Operations about user

Creates list of users with given input array

Request Body schema: application/json

List of user object

Array
id
integer <int64>
username
string
firstName
string
lastName
string
email
string
password
string
phone
string
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
id
integer <int64>
username
string
firstName
string
lastName
string
email
string
password
string
phone
string
userStatus
integer <int32>

User Status

Responses

Request samples

Content type
application/json
[
  • {
    }
]

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,
  • "username": "string",
  • "firstName": "string",
  • "lastName": "string",
  • "email": "string",
  • "password": "string",
  • "phone": "string",
  • "userStatus": 0
}

Updated user

This can only be done by the logged in user.

path Parameters
username
required
string

name that need to be updated

Request Body schema: application/json

Updated user object

id
integer <int64>
username
string
firstName
string
lastName
string
email
string
password
string
phone
string
userStatus
integer <int32>

User Status

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "username": "string",
  • "firstName": "string",
  • "lastName": "string",
  • "email": "string",
  • "password": "string",
  • "phone": "string",
  • "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

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
"string"

Logs out current logged in user session

Responses

Create user

This can only be done by the logged in user.

Request Body schema: application/json

Created user object

id
integer <int64>
username
string
firstName
string
lastName
string
email
string
password
string
phone
string
userStatus
integer <int32>

User Status

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "username": "string",
  • "firstName": "string",
  • "lastName": "string",
  • "email": "string",
  • "password": "string",
  • "phone": "string",
  • "userStatus": 0
}