Cats API

Beginner's Pick Animals / API Key Intermediate HTTPS
69 C
Measured Score 0 50 100 Speed 9/30 Consistency 17/20 Security 20/20 Browser access 15/15 Transparency 8/15 TESTED 2026-09-21

Overview

The Cat API provides random cat images, breed data, and voting features. Beginners use it to learn image APIs and optional API key usage, since it works with or without a key.

Beginner Tip

Works without a key but limited to 10 req/hour. Register free at developers.thecatapi.com to raise the limit to 10 req/second.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://api.thecatapi.com/v1/images/search?limit=1
Result
HTTP 200 · application/json · 117 bytes · compressed
Response time
366 ms (median of 3) · fastest 326 ms
Transport
TLSv1.3 · TLS_AES_256_GCM_SHA384 · certificate issued by Google Trust Services
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Served by
cloudflare
Answered
8 of 8 weekly checks (100%, since 2026-07-31)
Recorded
2026-09-21

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
id string a0p
url string (url) https://s3.us-west-2.amazonaws.com/cdn2.theca…
width integer 1024
height integer 909

Captured Response

Captured from a real request to https://api.thecatapi.com/v1/images/search?limit=1 on 2026-09-21. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
[
  {
    "id": "a0p",
    "url": "https://s3.us-west-2.amazonaws.com/cdn2.thecatapi.com/images/a0p.jpg",
    "width": 1024,
    "height": 909
  }
]

Field Reference

id Unique identifier for the cat image
url Direct URL to the cat image (jpg or gif)
width Width of the image in pixels
height Height of the image in pixels

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://docs.thecatapi.com/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-09-21. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 404 Requesting a path that does not exist application/json
{
  "statusCode": 404,
  "timestamp": "2026-09-21T19:40:29.373Z",
  "path": "/v1/images/search/apisscore-nonexistent-path?limit=1",
  "message": "Cannot GET /v1/images/search/apisscore-nonexistent-path?limit=1",
  "error": "Not Found"
}
HTTP 400 Sending an invalid value for "limit" application/json
{
  "statusCode": 400,
  "timestamp": "2026-09-21T19:40:29.709Z",
  "path": "/v1/images/search?limit=!!!invalid!!!",
  "message": [
    "limit must not be greater than 100",
    "limit must not be less than 1",
    "limit must be an integer number"
  ],
  "error": "Bad Request"
}

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

429 Too Many Requests Exceeded unauthenticated rate limit of 10 requests per hour
✓ Register for a free API key and pass it as header x-api-key
Empty array response No images match the breed_id filter you provided
✓ Check valid breed IDs at /v1/breeds first before filtering
Image URL returns 404 CDN-cached image was deleted from upstream
✓ Request a new random image rather than caching the URL long-term

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 9/30
Consistency 17/20
Security 20/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 366ms

Fully tested on Sep 21, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS NO
Category Animals
Difficulty Intermediate
Endpoint last called: 2026-09-21

Related Tags

Recipes Using Cats

Build something with this API. Each recipe includes step-by-step instructions and code outlines.

Similar APIs

View All →