RandomDog API

Beginner's Pick Animals / No Auth Required Beginner HTTPS CORS
Free to Use Varies (check documentation)

Overview

RandomDog returns a JSON object with the URL of a random dog image (JPEG, PNG, or GIF) sourced from user-submitted photos on random.dog. Beginners love it because getting a dog photo on screen takes just two lines of code — fetch the JSON, then set an img src to the "url" field. It requires no API key and is reliable enough for portfolio projects.

Beginner Tip

The JSON response contains a "url" field — use response.url to get the image address, then set document.getElementById("dog").src = response.url to display it instantly.

Available Data

random dog image URLs
breed and sub-breed lists
breed-specific images
randomly generated data
customizable output format
Use case: Integrate random pictures of dogs data into web and mobile applications

Example Response

JSON Response
{
  "message": "https://images.dog.ceo/breeds/retriever-golden/n02099601_1.jpg",
  "status": "success"
}

Field Reference

url Direct URL to a random dog image or video file — use as img src or video src.
fileSizeBytes File size of the image in bytes — useful for filtering out very large files before displaying.

Implementation Example

Request
const url = "https://random.dog/";
const response = await fetch(url);
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.

Common Errors & Troubleshooting

Broken image or unexpected video file The API occasionally returns .mp4 video files or large GIFs that do not display in an img tag
Check that the URL ends in .jpg or .png before assigning to img src; if not, fetch again
TypeError: Cannot read property "url" of undefined Not awaiting the .json() call before accessing the field
Make sure to await both fetch() and .json(): const data = await (await fetch(url)).json()
CORS error on local file Opening the HTML file directly from disk (file://) instead of a server
Serve your HTML through a local dev server such as VS Code Live Server or python -m http.server

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS YES
Category Animals
Difficulty Beginner
Verified: 2026-04-04

Related Tags

Similar APIs

View All →