Swagger Petstore example
This page renders the Swagger Petstore sample API, a larger reference than the short OpenAPI Spec example. The specification uses the Swagger 2.0 format and contains pets, store orders, and users with path, query, header, and form parameters, enums, and file uploads. The OpenAPI 3.0 Petstore example shows the same API in the newer format.
The page needs only this front matter:
---
openapi: ./openapi-petstore.json
---
openapi-petstore.json is the specification from https://petstore.swagger.io/v2/swagger.json, formatted with indentation. The specification declares the Apache License 2.0.
API overview
Swagger Petstore
Version 1.0.7
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.
https://petstore.swagger.io/v2http://petstore.swagger.io/v2
api_keyAPI keyapi_keyin headerpetstore_authOAuth 2.0
[Pet]
[
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
]
[Pet]
Category
| Property | Description |
|---|---|
| id: int64 | |
| name: string |
Tag
| Property | Description |
|---|---|
| id: int64 | |
| name: string |
[Pet]
{
"type": "array",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
Pet
{
"required": [
"name",
"photoUrls"
],
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"category": {
"$ref": "#/components/schemas/Category"
},
"name": {
"type": "string",
"example": "doggie"
},
"photoUrls": {
"type": "array",
"items": {
"type": "string",
"xml": {
"name": "photoUrl"
}
},
"xml": {
"wrapped": true
}
},
"tags": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Tag"
},
"xml": {
"wrapped": true
}
},
"status": {
"enum": [
"available",
"pending",
"sold"
],
"type": "string",
"description": "pet status in the store"
}
},
"xml": {
"name": "Pet"
}
}
Category
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"xml": {
"name": "Category"
}
}
Tag
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"xml": {
"name": "Tag"
}
}
[Pet]
[
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
]
No example is available.
No schema is defined.
Pet
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
Pet
Category
| Property | Description |
|---|---|
| id: int64 | |
| name: string |
Tag
| Property | Description |
|---|---|
| id: int64 | |
| name: string |
Pet
{
"required": [
"name",
"photoUrls"
],
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"category": {
"$ref": "#/components/schemas/Category"
},
"name": {
"type": "string",
"example": "doggie"
},
"photoUrls": {
"type": "array",
"items": {
"type": "string",
"xml": {
"name": "photoUrl"
}
},
"xml": {
"wrapped": true
}
},
"tags": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Tag"
},
"xml": {
"wrapped": true
}
},
"status": {
"enum": [
"available",
"pending",
"sold"
],
"type": "string",
"description": "pet status in the store"
}
},
"xml": {
"name": "Pet"
}
}
Category
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"xml": {
"name": "Category"
}
}
Tag
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"xml": {
"name": "Tag"
}
}
Pet
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
Order
{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2025-01-31T12:00:00Z",
"status": "placed",
"complete": false
}
Order
| Property | Description |
|---|---|
| id: int64 | |
| petId: int64 | |
| quantity: int32 | |
| shipDate: dateTime | |
status: stringplacedapproveddelivered |
Order Status |
| complete: boolean |
Order
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"petId": {
"type": "integer",
"format": "int64"
},
"quantity": {
"type": "integer",
"format": "int32"
},
"shipDate": {
"type": "string",
"format": "date-time"
},
"status": {
"enum": [
"placed",
"approved",
"delivered"
],
"type": "string",
"description": "Order Status"
},
"complete": {
"type": "boolean"
}
},
"xml": {
"name": "Order"
}
}
Order
{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2025-01-31T12:00:00Z",
"status": "placed",
"complete": false
}
string
| Property | Description |
|---|---|
| value: string |
string
{
"type": "string"
}
User
{
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
}
User
| Property | Description |
|---|---|
| id: int64 | |
| username: string | |
| firstName: string | |
| lastName: string | |
| email: string | |
| password: string | |
| phone: string | |
| userStatus: int32 | User Status |
User
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"username": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"phone": {
"type": "string"
},
"userStatus": {
"type": "integer",
"description": "User Status",
"format": "int32"
}
},
"xml": {
"name": "User"
}
}
[User]
[
{
"id": 0,
"username": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"password": "string",
"phone": "string",
"userStatus": 0
}
]
[User]
| Property | Description |
|---|---|
| id: int64 | |
| username: string | |
| firstName: string | |
| lastName: string | |
| email: string | |
| password: string | |
| phone: string | |
| userStatus: int32 | User Status |
[User]
{
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
}
User
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"username": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"phone": {
"type": "string"
},
"userStatus": {
"type": "integer",
"description": "User Status",
"format": "int32"
}
},
"xml": {
"name": "User"
}
}