Swagger Petstore OpenAPI 3.0 example
This page renders the Swagger Petstore - OpenAPI 3.0 sample API. It describes the same pets, store orders, and users as the Swagger 2.0 Petstore example, but uses OpenAPI 3.0 with reusable components, request bodies in several media types, and enums.
The page needs only this front matter:
---
openapi: ./openapi-petstore-v3.json
---
openapi-petstore-v3.json is the specification from https://petstore3.swagger.io/api/v3/openapi.json, formatted with indentation. The specification declares the Apache License 2.0.
API overview
Swagger Petstore - OpenAPI 3.0
Version 1.0.27
This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about Swagger at https://swagger.io. In the third iteration of the pet store, we've switched to the design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
Some useful links:
/api/v3
petstore_authOAuth 2.0api_keyAPI keyapi_keyin header
[Pet]
[
{
"id": 10,
"name": "doggie",
"category": {
"id": 1,
"name": "Dogs"
},
"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",
"example": 10
},
"name": {
"type": "string",
"example": "doggie"
},
"category": {
"$ref": "#/components/schemas/Category"
},
"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",
"example": 1
},
"name": {
"type": "string",
"example": "Dogs"
}
},
"xml": {
"name": "category"
}
}
Tag
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"xml": {
"name": "tag"
}
}
[Pet]
[
{
"id": 10,
"name": "doggie",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
]
Pet
{
"id": 10,
"name": "doggie",
"category": {
"id": 1,
"name": "Dogs"
},
"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",
"example": 10
},
"name": {
"type": "string",
"example": "doggie"
},
"category": {
"$ref": "#/components/schemas/Category"
},
"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",
"example": 1
},
"name": {
"type": "string",
"example": "Dogs"
}
},
"xml": {
"name": "category"
}
}
Tag
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"xml": {
"name": "tag"
}
}
Pet
{
"id": 10,
"name": "doggie",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
Order
{
"id": 10,
"petId": 198772,
"quantity": 7,
"shipDate": "2025-01-31T12:00:00Z",
"status": "approved",
"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",
"example": 10
},
"petId": {
"type": "integer",
"format": "int64",
"example": 198772
},
"quantity": {
"type": "integer",
"format": "int32",
"example": 7
},
"shipDate": {
"type": "string",
"format": "date-time"
},
"status": {
"enum": [
"placed",
"approved",
"delivered"
],
"type": "string",
"description": "Order Status",
"example": "approved"
},
"complete": {
"type": "boolean"
}
},
"xml": {
"name": "order"
}
}
Order
{
"id": 10,
"petId": 198772,
"quantity": 7,
"shipDate": "2025-01-31T12:00:00Z",
"status": "approved",
"complete": false
}
string
| Property | Description |
|---|---|
| value: string |
string
{
"type": "string"
}
User
{
"id": 10,
"username": "theUser",
"firstName": "John",
"lastName": "James",
"email": "john@email.com",
"password": "12345",
"phone": "12345",
"userStatus": 1
}
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",
"example": 10
},
"username": {
"type": "string",
"example": "theUser"
},
"firstName": {
"type": "string",
"example": "John"
},
"lastName": {
"type": "string",
"example": "James"
},
"email": {
"type": "string",
"example": "john@email.com"
},
"password": {
"type": "string",
"example": "12345"
},
"phone": {
"type": "string",
"example": "12345"
},
"userStatus": {
"type": "integer",
"description": "User Status",
"format": "int32",
"example": 1
}
},
"xml": {
"name": "user"
}
}
User
{
"id": 10,
"username": "theUser",
"firstName": "John",
"lastName": "James",
"email": "john@email.com",
"password": "12345",
"phone": "12345",
"userStatus": 1
}