Identify a breed from a photo
Create a pet with a photo or two, then ask for its breed. The result gives up to three breeds with a confidence for each, whether it looks like a mix, and why.
1. Create the pet with photos
curl -X POST -H "x-api-key: YOUR-API-KEY" -H "Content-Type: multipart/form-data" \
-F "name=Buddy" \
-F "external_owner_id=usr_8b3d91" \
-F "images=@/path/to/side.jpg" \
-F "images=@/path/to/face.jpg" \
https://api.thedogapi.com/v1/pets
Keep the id from the response. To add photos later, POST /pets/{pet_id}/images.
2. Identify the breed
curl -X POST -H "x-api-key: YOUR-API-KEY" https://api.thedogapi.com/v1/pets/{pet_id}/genealogy
{
"genealogy": {
"is_mixed_breed": true,
"mixed_breed_reasoning": "Ear set and coat texture point to two parent breeds rather than one.",
"primary_breed": { "id": "115", "label": "German Shepherd", "confidence": 0.64 },
"secondary_breed": { "id": "1", "label": "Affenpinscher", "confidence": 0.31 },
"tertiary_breed": { "id": "", "label": "", "confidence": 0 },
"breed_probabilities": {
"ids": ["115", "1"],
"labels": ["German Shepherd", "Affenpinscher"],
"confidences": [0.64, 0.31]
}
},
"creative_descriptions": {
"fun_description": "…",
"fun_caption": "…",
"happy_sentence": "…",
"breed_fact": "…"
}
}
Breed IDs are chosen from our breed list, so they should resolve with GET /breeds/{breed_id} and take you straight to breed data. Handle an ID that doesn't resolve by falling back to the label. Pass ?lang= with a two-letter code for translated reasoning and descriptions.
The result is saved on the pet. Calling it again returns the saved result, in the language of the first call, until new photos are added.
How to read the confidence
Confidence is between 0 and 1 for each breed. It is the model's own weighting, not a measured accuracy, so use it to rank the breeds rather than as a percentage to show owners. When the top two are close, show the mix.
Expect lower confidence and more mixed results for rare breeds. It is a visual estimate, so present it as "looks like", not as a pedigree or DNA result.
Photos that work
- The whole dog, side on, in good light.
- One clear photo of the face.
- Not a portrait or filtered image. Portraits generated by this API are ignored automatically.
Video
Breed identification works from photos. If your app records video, take a sharp still from it and upload that as an image. You can also store the video on the pet with POST /pets/{pet_id}/videos for later analysis.
Switching it off
If you don't want breed identification in your product, switch it off (breed_identification) and the endpoint returns 403 for your account.