API Documentation
Official Specifications
- OpenAPI 3.2 Spec (REST, SSE): JSON | YAML
- AsyncAPI 3.0 Spec (WebSocket, Socket.IO, MQTT): JSON | YAML
Interactive Documentation
- Apidog UI (REST API): https://docs.petstoreapi.com/get-pet-25725398e0
- Swagger UI (REST API): https://api.petstoreapi.com/v1/swagger-ui.html
- AsyncAPI UI (Real-time APIs): https://api.petstoreapi.com/v1/asyncapi-ui.html
API Endpoints by Protocol
REST API (HTTPS)
Base URL:https://api.petstoreapi.com/v1
Server-Sent Events (SSE)
Endpoint:https://api.petstoreapi.com/v1/chat/completions (with stream: true)
WebSocket
Endpoint:wss://api.petstoreapi.com/v1/ws/chat
Socket.IO
Endpoint:wss://api.petstoreapi.com
MQTT (IoT)
Endpoint:mqtts://mqtt.petstoreapi.com:8883
Quick Examples
1. REST API
List Available Pets
Get a Specific Pet
Create a New Pet (Authenticated)
Search Pets with Filters
Advanced Search with QUERY Method
Create an Order
2. Server-Sent Events (SSE)
AI Chat with Streaming Response
JavaScript Example:3. WebSocket
Customer Support Chat
JavaScript Example:4. Socket.IO
Real-time Support Chat
JavaScript Example:5. MQTT (IoT Devices)
Order Status Updates
Python Example (paho-mqtt):Authentication
All authenticated endpoints require either OAuth 2.0 or Bearer Token (JWT) authentication.Getting an Access Token
Using the Token
Include the token in theAuthorization header:
Multi-Tenancy
Isolate your data using theX-Tenant-ID header:
- The tenant ID must be a valid UUID (v4 or v7)
- Use the same tenant ID consistently for all related operations
- Without a tenant ID, data is shared across all users
Rate Limits
The API uses IETF standard rate limiting headers:429 Too Many Requests response:
Error Handling
All errors follow RFC 9457 Problem Details format:Next Steps
- Explore the Full API: Visit the Swagger UI
- Read the Specifications: Download the OpenAPI and AsyncAPI specs
- Join the Community: Visit our GitHub repository
- Get Support: Contact us at support@petstoreapi.com
Common Use Cases
Browse Available Pets
Get Pet Details
Create an Adoption Application
Chat with AI Pet Advisor
Ready to build something amazing? Start exploring the Modern Petstore API today!