List Pets
curl --request GET \
--url https://api.petstoreapi.com/v1/petsimport requests
url = "https://api.petstoreapi.com/v1/pets"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.petstoreapi.com/v1/pets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.petstoreapi.com/v1/pets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.petstoreapi.com/v1/pets"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.petstoreapi.com/v1/pets")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.petstoreapi.com/v1/pets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "01936c8f-1234-7000-8000-111111111111",
"species": "CAT",
"name": "Whiskers",
"breed": "Domestic Shorthair",
"ageMonths": 18,
"size": "MEDIUM",
"color": "Orange Tabby",
"gender": "MALE",
"goodWithKids": true,
"price": "75.00",
"description": "Friendly and playful orange tabby looking for a loving home",
"status": "AVAILABLE",
"photos": [
"https://cdn.petstoreapi.com/pets/01936c8f-1234-7000-8000-111111111111/photo1.jpg"
]
},
{
"id": "01936c8f-2345-7000-8000-222222222222",
"species": "DOG",
"name": "Max",
"breed": "Labrador Retriever",
"ageMonths": 36,
"size": "LARGE",
"color": "Yellow",
"gender": "MALE",
"goodWithKids": true,
"price": "150.00",
"description": "Energetic and loyal lab who loves fetch and long walks",
"status": "AVAILABLE",
"photos": [
"https://cdn.petstoreapi.com/pets/01936c8f-2345-7000-8000-222222222222/photo1.jpg"
]
}
],
"pagination": {
"page": 1,
"limit": 20,
"totalItems": 45,
"totalPages": 3
}
}{
"type": "https://petstoreapi.com/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Invalid value for parameter 'status'. Must be one of: available, pending, sold.",
"instance": "/pets"
}{
"type": "https://petstoreapi.com/errors/validation-error",
"title": "Validation Error",
"status": 422,
"detail": "The request body contains validation errors.",
"instance": "/pets",
"errors": [
{
"field": "name",
"message": "Pet name is required",
"code": "required_field"
},
{
"field": "status",
"message": "Invalid status value",
"code": "invalid_format"
}
]
}{
"type": "https://petstoreapi.com/errors/rate-limit-exceeded",
"title": "Too Many Requests",
"status": 429,
"detail": "Rate limit exceeded. Please wait 60 seconds before making another request."
}Pet
List Pets
Retrieve a paginated list of pets available for adoption with optional filtering.
GET
/
pets
List Pets
curl --request GET \
--url https://api.petstoreapi.com/v1/petsimport requests
url = "https://api.petstoreapi.com/v1/pets"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.petstoreapi.com/v1/pets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.petstoreapi.com/v1/pets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.petstoreapi.com/v1/pets"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.petstoreapi.com/v1/pets")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.petstoreapi.com/v1/pets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "01936c8f-1234-7000-8000-111111111111",
"species": "CAT",
"name": "Whiskers",
"breed": "Domestic Shorthair",
"ageMonths": 18,
"size": "MEDIUM",
"color": "Orange Tabby",
"gender": "MALE",
"goodWithKids": true,
"price": "75.00",
"description": "Friendly and playful orange tabby looking for a loving home",
"status": "AVAILABLE",
"photos": [
"https://cdn.petstoreapi.com/pets/01936c8f-1234-7000-8000-111111111111/photo1.jpg"
]
},
{
"id": "01936c8f-2345-7000-8000-222222222222",
"species": "DOG",
"name": "Max",
"breed": "Labrador Retriever",
"ageMonths": 36,
"size": "LARGE",
"color": "Yellow",
"gender": "MALE",
"goodWithKids": true,
"price": "150.00",
"description": "Energetic and loyal lab who loves fetch and long walks",
"status": "AVAILABLE",
"photos": [
"https://cdn.petstoreapi.com/pets/01936c8f-2345-7000-8000-222222222222/photo1.jpg"
]
}
],
"pagination": {
"page": 1,
"limit": 20,
"totalItems": 45,
"totalPages": 3
}
}{
"type": "https://petstoreapi.com/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Invalid value for parameter 'status'. Must be one of: available, pending, sold.",
"instance": "/pets"
}{
"type": "https://petstoreapi.com/errors/validation-error",
"title": "Validation Error",
"status": 422,
"detail": "The request body contains validation errors.",
"instance": "/pets",
"errors": [
{
"field": "name",
"message": "Pet name is required",
"code": "required_field"
},
{
"field": "status",
"message": "Invalid status value",
"code": "invalid_format"
}
]
}{
"type": "https://petstoreapi.com/errors/rate-limit-exceeded",
"title": "Too Many Requests",
"status": 429,
"detail": "Rate limit exceeded. Please wait 60 seconds before making another request."
}Headers
Optional tenant identifier for data isolation. When provided, all operations will be scoped to this tenant, ensuring data separation between different organizations or users. If omitted, operations will access the shared/public data pool where data may be visible to and modified by other users.
Query Parameters
Filter by pet species
Available options:
DOG, CAT, RABBIT, BIRD, REPTILE, OTHER Filter by adoption status
Available options:
AVAILABLE, PENDING, ADOPTED Minimum age in months
Required range:
x >= 0Maximum age in months
Required range:
x >= 0Filter by pet size
Available options:
SMALL, MEDIUM, LARGE Filter pets that are good with children
Page number for pagination
Required range:
x >= 1Number of items per page
Required range:
1 <= x <= 100