TL;DR
Dog CEO (Dog API) is the web's most popular dog image API, serving up high-quality photos of every breed imaginable. You can get a completely random dog, filter by breed (like "husky" or "labrador"), drill into sub-breeds (like "corgi cardigan"), or browse the entire breed list. All images are sourced from trusted photo repositories and returned as JSON with direct image URLs.
Quick start: https://dog.ceo/api/breeds/image/random
No API key needed — just make a request!
How to Use This API
1. Random Dog Image
https://dog.ceo/api/breeds/image/random
Returns {"message":"https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg","status":"success"}
2. Random Image of a Specific Breed
https://dog.ceo/api/breed/husky/images/random
3. Multiple Images at Once
https://dog.ceo/api/breeds/image/random/3
Get 3 random dog images in one call. Replace 3 with any number.
4. List All Breeds
https://dog.ceo/api/breeds/list/all
Returns all breeds with their sub-breeds. Example: {"corgi":["cardigan","pembroke"]}
5. JavaScript — Random Dog Display
async function showRandomDog(breed = null) {
let url = 'https://dog.ceo/api/breeds/image/random';
if (breed) {
url = `https://dog.ceo/api/breed/${breed}/images/random`;
}
const resp = await fetch(url);
const data = await resp.json();
return data.message; // image URL
}
showRandomDog('corgi').then(imgUrl => {
console.log('Random corgi:', imgUrl);
// Set as src on an
element
});
6. Python — Breed Gallery
import requests
def get_breed_images(breed, count=5):
resp = requests.get(
f'https://dog.ceo/api/breed/{breed}/images/random/{count}'
)
return resp.json()['message']
# Get 5 corgi images
images = get_breed_images('corgi', 5)
for i, url in enumerate(images, 1):
print(f"Corgi {i}: {url}")
https://dog.ceo/api/breeds/image/random
Frequently Asked Questions
- How many dog breeds are supported?
- Over 100 breeds including sub-breeds. The
/breeds/list/allendpoint returns the complete list. Examples: husky, labrador, corgi (cardigan + pembroke), hound (afghan, basset, blood, etc.). - Where do the images come from?
- Images are sourced from the Stanford Dogs Dataset and other curated collections. All are verified as dog photos (not AI-generated) and hosted on Dog CEO's CDN.
- Can I browse all images for a breed?
- Yes! Use
/api/breed/{breed}/imagesto get every image URL for that breed. For breeds with hundreds of images, consider pagination or using/images/random/{n}instead. - Does the API have rate limits?
- No documented rate limits. The API has been running for years and handles heavy traffic reliably. As always, be respectful with your request frequency.
- What if I request a breed that doesn't exist?
- The API returns HTTP 404 with
{"status":"error","message":"Breed not found (master breed does not exist)"}. Check the breed list endpoint first. - Are the images free to use?
- Yes, the images are freely available. The API itself is open source and free for any use, commercial or personal.
API Details
- API URL
https://dog.ceo/dog-api/- Documentation
- dog.ceo/dog-api
- Category
- Fun
- Authentication
- Not Required
- Geographic Coverage
- Global
What You Can Build
- Random dog photo gallery with breed filter dropdown
- Dog breed identifier trainer — show photo, guess the breed
- "Daily dog" email subscription service
- Pet store website with breed-specific image showcases
- Mood booster app — show a random cute dog on command