Petstore API

Interactive OpenAPI 3.0 demonstration with the Swagger Petstore API - Complete API documentation with sidebar navigation, live testing, and comprehensive endpoint coverage

Swagger Petstore - OpenAPI 3.0

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](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: - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore) - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)

v1.0.27
Base URL
https://petstore.swagger.io/api/v3

Fast & Reliable

Optimized for speed with CDN caching and 99.9% uptime

CORS Enabled

Use from any frontend application without restrictions

No Authentication

Public endpoints accessible without API keys

Get Started

Start using the API in minutes

3 minutes
1

Authenticate Your Requests

Get your API key and start making authenticated requests

JavaScriptcURLPython
JavaScript
javascript
// Set up your API key
const API_KEY = 'your-api-key-here';
const baseURL = '/api/v3';

// Make authenticated request
const response = await fetch(`${baseURL}/pet/findByStatus?status=available`, {
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  }
});

const pets = await response.json();
console.log('Available pets:', pets);

Basic API authentication and request

cURL
curl
# Get available pets
curl -X GET "/api/v3/pet/findByStatus?status=available" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Command line request with authentication

Python
python
import requests

# API configuration
API_KEY = "your-api-key-here"
BASE_URL = "/api/v3"

# Make authenticated request
headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

response = requests.get(
    f"{BASE_URL}/pet/findByStatus",
    params={"status": "available"},
    headers=headers
)

pets = response.json()
print(f"Found {len(pets)} available pets")

Python example with requests library

1 of 3

API Endpoints

🐾

pet

pet

Everything about your Pets

POST
/pet

Add a new pet to the store.

PUT
/pet

Update an existing pet.

GET
/pet/findByStatus

Finds Pets by status.

GET
/pet/findByTags

Finds Pets by tags.

GET
/pet/{petId}

Find pet by ID.

POST
/pet/{petId}

Updates a pet in the store with form data.

DELETE
/pet/{petId}

Deletes a pet.

POST
/pet/{petId}/uploadImage

Uploads an image.

🏪

store

store

Access to Petstore orders

GET
/store/inventory

Returns pet inventories by status.

POST
/store/order

Place an order for a pet.

GET
/store/order/{orderId}

Find purchase order by ID.

DELETE
/store/order/{orderId}

Delete purchase order by identifier.

👤

user

user

Operations about user

POST
/user

Create user.

POST
/user/createWithList

Creates list of users with given input array.

GET
/user/login

Logs user into the system.

GET
/user/logout

Logs out current logged in user session.

GET
/user/{username}

Get user by user name.

PUT
/user/{username}

Update user resource.

DELETE
/user/{username}

Delete user resource.

License & Legal

This API is licensed under the Apache 2.0

View License DetailsTerms of Service

Need Help?

Additional Resources

🔧 Developer Tools

📚 Learning Resources

⚡ Key Features Demonstrated

🔄 CRUD Operations

Complete Create, Read, Update, Delete functionality across all resources

🔐 Authentication

Multiple authentication methods including API Key, OAuth2, and HTTP Basic

📁 File Uploads

Image upload capabilities for pet photos and attachments

🛡️ Error Handling

Comprehensive error responses with detailed status codes and messages

📊 Response Formats

The API supports multiple response formats to meet different integration needs:

  • JSON (default) - Standard REST API format
  • XML - Legacy system compatibility
  • Form Data - Browser form submissions

🚨 Important Notes

⚠️

Live Demo Environment

This is a live API maintained by Swagger for demonstration and testing purposes. Data may be reset periodically, so don't rely on it for persistent storage.

🎯 Perfect For

  • Learning OpenAPI 3.0 specification and standards
  • Testing API tools and client libraries
  • Prototyping API integrations and workflows
  • Training developers on REST API best practices