Cats API

The Cats API provides detailed, qualitative information on every recognized cat breed.

/v1/cats

HTTP GET

Get a list of cat breeds matching specified parameters. Returns at most 20 results. To access more than 20 results, use the offset parameter to offset results in multiple API calls.

Parameters

At least one of the following parameters (excluding offset) is required.

name (optional) - the name of cat breed.

min_weight (optional) - minimum weight in pounds.

max_weight (optional) - maximum weight in pounds.

min_life_expectancy (optional) - minimum life expectancy in years.

max_life_expectancy (optional) - maximum life expectancy in years.

shedding (optional) - How much hair the cat sheds. Possible values: 1, 2, 3, 4, 5, where 1 indicates no shedding and 5 indicates maximum shedding.

family_friendly (optional) - How affectionate the cat is to family. Possible values: 1, 2, 3, 4, 5, where 1 indicates minimal affection and 5 indicates maximum affection.

playfulness (optional) - How playful the cat is. Possible values: 1, 2, 3, 4, 5, where 1 indicates serious and stern and 5 indicates maximum playfulness.

grooming (optional) - How much work is required to properly groom the cat. Possible values: 1, 2, 3, 4, 5, where 1 indicates maximum grooming effort and 5 indicates minimum grooming effort.

other_pets_friendly (optional) - How well the cat gets along with other pets in the household (for example, dogs). Possible values: 1, 2, 3, 4, 5, where 1 indicates the cat isn't very friendly to other pets and 5 indicates the cat gets along very well with other pets.

children_friendly (optional) - How well the cat gets along with children. Possible values: 1, 2, 3, 4, 5, where 1 indicates the cat does not get along well with kids and 5 indicates the cat is very kid-friendly.

offset (optional) - number of results to offset for pagination.

Headers

X-Api-Key (required) - API Key associated with your account.

Sample Request URL

Live Demo!

https://api.api-ninjas.com/v1/cats?name=

Sample Response

[
  {
    "length": "12 to 16 inches",
    "origin": "Southeast Asia",
    "image_link": "https://api-ninjas.com/images/cats/abyssinian.jpg",
    "family_friendly": 3,
    "shedding": 3,
    "general_health": 2,
    "playfulness": 5,
    "children_friendly": 5,
    "grooming": 3,
    "intelligence": 5,
    "other_pets_friendly": 5,
    "min_weight": 6,
    "max_weight": 10,
    "min_life_expectancy": 9,
    "max_life_expectancy": 15,
    "name": "Abyssinian"
  }
]

import requests
name = 'abyssinian'
api_url = 'https://api.api-ninjas.com/v1/cats?name={}'.format(name)
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
    print(response.text)
else:
    print("Error:", response.status_code, response.text)
var name = 'abyssinian'
$.ajax({
    method: 'GET',
    url: 'https://api.api-ninjas.com/v1/cats?name=' + name,
    headers: { 'X-Api-Key': 'YOUR_API_KEY'},
    contentType: 'application/json',
    success: function(result) {
        console.log(result);
    },
    error: function ajaxError(jqXHR) {
        console.error('Error: ', jqXHR.responseText);
    }
});
const request = require('request');
var name = 'abyssinian';
request.get({
  url: 'https://api.api-ninjas.com/v1/cats?name=' + name,
  headers: {
    'X-Api-Key': 'YOUR_API_KEY'
  },
}, function(error, response, body) {
  if(error) return console.error('Request failed:', error);
  else if(response.statusCode != 200) return console.error('Error:', response.statusCode, body.toString('utf8'));
  else console.log(body)
});
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import com.fasterxml.jackson.databind.ObjectMapper;

URL url = new URL("https://api.api-ninjas.com/v1/cats?name=abyssinian");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("accept", "application/json");
InputStream responseStream = connection.getInputStream();
ObjectMapper mapper = new ObjectMapper();
JsonNode root = mapper.readTree(responseStream);
System.out.println(root.path("fact").asText());
let name = "abyssinian".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
let url = URL(string: "https://api.api-ninjas.com/v1/cats?name="+name!)!
var request = URLRequest(url: url)
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "X-Api-Key")
let task = URLSession.shared.dataTask(with: request) {(data, response, error) in
    guard let data = data else { return }
    print(String(data: data, encoding: .utf8)!)
}
task.resume()
If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.