Petfinder Public API Docs

Petfinder is a website that helps people find adoptable pets in their area. The website provides a public API that developers can use to access some of their data.

Getting Started

Before you can start using the Petfinder API, you will need to sign up for an API key. You can do this by creating an account on the Petfinder Developers website and following the instructions.

Once you have your API key, you can start making API requests.

API Endpoints

The Petfinder API provides several endpoints that you can use to access pet data. Here are some examples:

Get Random Pets

This endpoint returns a list of pets that match the specified criteria.

fetch("https://api.petfinder.com/v2/animals?type=dog&location=94109&distance=20", {
    headers: {
      Authorization: "Bearer API_KEY",
      "Content-Type": "application/json"
    }
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error(error));

Get A Specific Pet

This endpoint returns a specific pet based on their ID.

fetch("https://api.petfinder.com/v2/animals/123456", {
    headers: {
      Authorization: "Bearer API_KEY",
      "Content-Type": "application/json"
    }
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error(error));

Get A List Of Breeds

This endpoint returns a list of breeds for a specific animal type.

fetch("https://api.petfinder.com/v2/types/dog/breeds", {
    headers: {
      Authorization: "Bearer API_KEY",
      "Content-Type": "application/json"
    }
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error(error));

Conclusion

The Petfinder API provides a convenient way for developers to access adoptable pet data. With the above examples, you can get started with using the API in your applications. Remember to always include your API key in the headers of your requests to authenticate with the API.

Related APIs in Animals