Find an API

Search public APIs with auth details & Postman guides

← All APIs

Cat Facts API

catfact.ninja · Developer Tools

Developer Tools No Auth Free & Open Fun Animals Facts

Random facts about cats and a list of cat breeds. Simple beginner-friendly API. No authentication required.

Authentication

No authentication requiredFree to use with no key needed.

Sample Requests

GET Random cat fact

Get a random cat fact.

https://catfact.ninja/fact

Hover any highlighted part to learn what it does

curl -X GET "https://catfact.ninja/fact"
import requests
response = requests.get(
    "https://catfact.ninja/fact",
)
print(response.json())
const url = 'https://catfact.ninja/fact';

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	targetURL := "https://catfact.ninja/fact"
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://catfact.ninja/fact")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://catfact.ninja/fact";
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Cat breeds

Get a list of cat breeds.

https://catfact.ninja/breeds?limit=5

Hover any highlighted part to learn what it does

curl -X GET "https://catfact.ninja/breeds?limit=5"
import requests
params = {
    "limit": "5"
}
response = requests.get(
    "https://catfact.ninja/breeds",
    params=params,
)
print(response.json())
const url = new URL('https://catfact.ninja/breeds');
url.searchParams.set('limit', '5');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://catfact.ninja/breeds")
	q := baseURL.Query()
	q.Set("limit", "5")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://catfact.ninja/breeds")
uri.query = URI.encode_www_form({
  "limit" => "5"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://catfact.ninja/breeds?" . http_build_query([
    "limit" => "5"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. No API key needed
  2. Fact: GET https://catfact.ninja/fact
  3. Multiple facts: GET https://catfact.ninja/facts?limit=10
  4. Breeds: GET https://catfact.ninja/breeds?limit=10

Open documentation ↗