ElliottLandsborough/dog-ceo-api
Über uns
Die bei dog.ceo gehostete API
EntwicklerwerkzeugeGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- +5
- in 15 days
- +4
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
OriginalDog CEO API
Buy me a coffee and support the API
Status
Info
- Images are hosted on Vultr, The Everywhere Cloud
- To add your own images submit a pull request to https://github.com/jigsawpieces/dog-api-images
- Some API requests are cached from AWS lambda https://github.com/ElliottLandsborough/dog-ceo-api-golang
Examples
- p5.js: https://editor.p5js.org/codingtrain/sketches/lQxT7PTKC
- Vanilla JS: https://codepen.io/elliottlan/pen/MNEWNx
- Jquery: https://codepen.io/elliottlan/pen/KOXKLG
- Flutter: https://github.com/LIVELUCKY/dogs
- Node.js: https://github.com/mrbrunelli/dog-time-decorator
Stats

Dependencies
- PHP 8.4.1+ (CI and Docker use PHP 8.6)
- Symfony 8
- Composer
- Run
composer check-platform-reqsto verify required PHP extensions. - run
make build; make install; make test;for unit tests
Setup
- Clone repo
- composer install
- cd public
- php -S 127.0.0.1:6969
.env.local
DOG_CEO_CACHE_KEY="something-really-secure"
DOG_CEO_LAMBDA_URI=https://example.execute-api.us-east-1.amazonaws.com/dev/
Cache clear:
$ curl -X GET http://127.0.0.1:8000/cache-clear -H 'auth-key: something-really-secure'
Response Structure
All endpoints return JSON in this format:
{
"message": "...",
"status": "success"
}
The message field contains the actual data and varies by endpoint:
- String: single image URL
- Array: lists of breeds, sub-breeds, or multiple image URLs
- Object: breeds with their sub-breeds (key-value pairs)
Error responses include a code field:
{
"status": "error",
"message": "Breed not found (main breed does not exist)",
"code": 404
}
Endpoints
The curl examples below use the production API base URL, https://dog.ceo/api.
Breed Lists
/breeds/list/all
List all breed names including sub breeds.
Returns object with breed names as keys and sub-breed arrays as values. Empty arrays indicate no sub-breeds exist for that breed.
{
"message": {
"affenpinscher": [],
"bulldog": ["boston", "english", "french"],
"hound": ["afghan", "basset", "blood", "english", "ibizan", "plott", "walker"],
// ... 98 breeds total
},
"status": "success"
}
curl 'https://dog.ceo/api/breeds/list/all'
/breeds/list/all/random
Get random breed including any sub breeds.
curl 'https://dog.ceo/api/breeds/list/all/random'
/breeds/list/all/random/10
Get 10 random breeds including any sub breeds.
Returns at most as many breeds as exist.
curl 'https://dog.ceo/api/breeds/list/all/random/10'
/breeds/list
List all main breed names.
Returns simple array of breed names (excludes sub-breed information).
curl 'https://dog.ceo/api/breeds/list'
/breeds/list/random
Get single random main breed.
curl 'https://dog.ceo/api/breeds/list/random'
/breeds/list/random/10
Get 10 random main breeds.
Returns at most as many breeds as exist, in random order.
curl 'https://dog.ceo/api/breeds/list/random/10'
/breeds/list/subbreeds
List sub-breeds for multiple main breeds. Pass each breed as a repeated
breeds query parameter. A breed without sub-breeds maps to an empty array.
Requests accept up to 256 breed values and 32 KiB of query data.
Missing or empty values return 400; invalid or unknown breed names return 404.
Invalid-breed responses use a fixed message and include an invalid_breed field
containing up to 50 lowercase ASCII letters from the rejected value. Other
errors omit this field.
curl --get \
--data-urlencode 'breeds=bulldog' \
--data-urlencode 'breeds=retriever' \
--data-urlencode 'breeds=terrier' \
'https://dog.ceo/api/breeds/list/subbreeds'
Example response:
{
"message": {
"bulldog": ["boston", "english", "french"],
"beagle": []
},
"status": "success"
}
Sub-Breed Operations
/breed/{breed}/list
List sub breeds for a specific breed.
Returns array of sub-breed names without the main breed prefix. Returns empty array if breed has no sub-breeds.
curl 'https://dog.ceo/api/breed/hound/list'
/breed/{breed}/list/random
List random sub breed.
Returns 404 with "Breed not found (no sub breeds exist for this main breed)" if the breed has no sub-breeds.
curl 'https://dog.ceo/api/breed/hound/list/random'
/breed/{breed}/list/random/10
List 10 random sub breeds.
Returns at most as many sub-breeds as the breed has, in random order. Returns 404 with "Breed not found (no sub breeds exist for this main breed)" if the breed has no sub-breeds.
curl 'https://dog.ceo/api/breed/hound/list/random/10'
Breed Information
/breed/{breed}
Get main breed info (data is incomplete, see content folder).
Note: Most breeds return 404 with message "No info file for this breed exists". This is a known limitation.
curl 'https://dog.ceo/api/breed/affenpinscher'
/breed/{breed}/{breed2}
Get sub breed info (data is incomplete, see content folder).
Note: Most sub-breeds return 404 with message "No info file for this breed exists". This is a known limitation.
curl 'https://dog.ceo/api/breed/bullterrier/staffordshire'
Random Images
/breeds/image/random
Random image from any breed.
curl 'https://dog.ceo/api/breeds/image/random'
The API chooses a main breed uniformly, then chooses an image from that breed's image pool (including its sub-breeds).
/breeds/image/random/3
Get 3 random images from any breed.
Returns an array of unique image URLs in random order. Each image is picked the
same way as /breeds/image/random (a breed is chosen uniformly first), so
breeds with many photos are not over-represented. Requests are silently
capped at 1,000 images. Invalid numbers (non-numeric, zero, or negative)
default to 1 image.
curl 'https://dog.ceo/api/breeds/image/random/3'
Breed Images
/breed/{breed}/images
Get all breed images.
Important: Returns images from the main breed AND all its sub-breeds combined. For example, /breed/hound/images returns 808 images from all hound sub-breeds (afghan, basset, blood, english, ibizan, plott, walker). No pagination is applied.
curl 'https://dog.ceo/api/breed/hound/images'
/breed/{breed}/images/random
Get random image from a breed (and all its sub-breeds).
curl 'https://dog.ceo/api/breed/hound/images/random'
/breed/{breed}/images/random/4
Get 4 random images from a breed (and all its sub-breeds).
Returns unique images in random order, capped at 1,000 and at the number of images the breed has.
curl 'https://dog.ceo/api/breed/hound/images/random/4'
Sub-Breed Images
/breed/{breed}/{breed2}/images
Get all images from a sub breed.
curl 'https://dog.ceo/api/breed/hound/afghan/images'
/breed/{breed}/{breed2}/images/random
Get random image from a sub breed.
curl 'https://dog.ceo/api/breed/hound/afghan/images/random'
/breed/{breed}/{breed2}/images/random/5
Get 5 random images from a sub breed.
Returns unique images in random order, capped at 1,000 and at the number of images the sub-breed has.
curl 'https://dog.ceo/api/breed/hound/afghan/images/random/5'
Understanding Sub-Breeds
Sub-breeds are variations within a main breed. Key behaviors:
/breed/{breed}/list- Returns sub-breed names as array:["afghan", "basset", ...]/breed/{breed}/images- Returns ALL images including all sub-breeds (aggregated)/breed/{breed}/{sub-breed}/images- Returns only that specific sub-breed's images
Sub-breed names in responses do not include the main breed prefix, but image URLs use hyphenated format: hound-afghan.
Example breeds with sub-breeds:
bulldog: boston, english, frenchhound: afghan, basset, blood, english, ibizan, plott, walkerterrier: 25 sub-breeds including american, border, scottish, yorkshire
Image URLs
All image URLs follow this pattern:
https://images.dog.ceo/breeds/{breed-subbreed}/{filename}.jpg
- Direct CDN links (no authentication required)
- All images are .jpg format
- Can be used directly in HTML
<img>tags - Example:
https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg
Error Handling
The API returns different error messages for different scenarios:
Invalid breed name (404):
{
"status": "error",
"message": "Breed not found (main breed does not exist)",
"code": 404
}
Invalid sub-breed for valid breed (404), e.g. /breed/hound/xyz/images:
{
"status": "error",
"message": "Breed not found (sub breed does not exist)",
"code": 404
}
Random sub-breed requested for a breed with no sub-breeds (404), e.g. /breed/beagle/list/random:
{
"status": "error",
"message": "Breed not found (no sub breeds exist for this main breed)",
"code": 404
}
Missing breed info files (404):
{
"status": "error",
"message": "Breed not found (No info file for this breed exists)",
"code": 404
}
Invalid route/typo (404):
{
"status": "error",
"message": "Not found",
"code": 404
}
Important Notes
- Breed names are case-insensitive: The API accepts any letter case (
hound,HoundandHOUNDall work). Responses always use lowercase names. Use lowercase in requests anyway, because cached responses are stored per URL. Breed and sub-breed names may only contain the letters a–z; anything else returns 404. - Number parameters are permissive: Non-numeric values, zero, and negative numbers all default to 1 (no error). Only plain digits are accepted, so a value with a sign such as
+5is also treated as invalid. - Random count limits: Random image count endpoints are capped at 1,000. Random breed and sub-breed lists are capped at the number of breeds or sub-breeds available.
- No pagination: Endpoints like
/breed/{breed}/imagesreturn all images at once (can be hundreds).
Ähnliche Projekte entdecken
Wird geladen…