Link pets to your users
Every pet belongs to your account. To know which of your users a pet belongs to, pass your own identifier when you create it.
| Field | Use it for |
|---|---|
sub_id | Your identifier for the person or session that created the record. Also used on images, votes and favourites. |
external_owner_id | Your identifier for the pet's owner. Filter pets by it with GET /pets?external_owner_id=.... |
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 "sub_id=usr_8b3d91" \
-F "images=@/path/to/side.jpg" \
https://api.thedogapi.com/v1/pets
List every pet for one of your users:
curl -H "x-api-key: YOUR-API-KEY" "https://api.thedogapi.com/v1/pets?external_owner_id=usr_8b3d91"
Use identifiers that mean nothing outside your system
Send an opaque ID, such as your database's user ID. Don't send an email address, phone number or name. We don't need to know who the owner is to analyse their dog, and keeping personal information out of these fields means less of it is shared with a third party. Health-check webhooks (pet.bcs.*) include the pet's sub_id and external_owner_id, so you can match results back to your user.
Deleting a user's data
When a user closes their account with you, delete each of their pets:
curl -X DELETE -H "x-api-key: YOUR-API-KEY" https://api.thedogapi.com/v1/pets/{pet_id}
This removes the pet from your account straight away: it no longer appears in lists and its endpoints return 404. The underlying photos and results are not erased by this call. To have a user's data erased from our systems, for example to meet a deletion request, email us the pet IDs.