RandomDuck API

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

Overview

RandomDuck serves random photos and illustrations of ducks from a community-curated collection, returning a JSON object with the direct image URL. It requires no authentication and responds to a single GET request, making it ideal for a first fetch() exercise. The API also supports a plain-text endpoint that returns just the image URL for even simpler integration.

💡

Beginner Tip

Hit https://random-d.uk/api/v2/random to get a JSON response with a "url" field — assign that value directly to an img src to display the duck photo.

Available Data

randomly generated data
customizable output format
Use case: Integrate random pictures of ducks data into web and mobile applications

Example Response

JSON Response
{
  "image_url": "https://api.example.com/randomduck/random.jpg",
  "status": "success"
}

Field Reference

url Direct URL to the duck image — suitable for use as an img src.
message A fun duck-related message, typically "quack".

Implementation Example

// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://random-d.uk/api";
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

Unexpected illustration instead of photo The collection mixes real duck photos and cartoon illustrations without a way to filter
Use the ?type=jpg parameter to request only photographic images
Response is a plain string, not JSON Hitting the /quack endpoint instead of /v2/random returns just the URL as a plain string
Use /api/v2/random for a JSON response, or treat the /quack response directly as a URL string
fetch() fails silently Not checking HTTP response status before calling .json()
Add: if (!response.ok) throw new Error(response.status) before parsing the response body

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 15/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 7/15
Response Time 297ms

Fully tested on Apr 5, 2026

Technical Specifications

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

Similar APIs

View All →