Wallhaven API

Beginner's Pick Photography / API Key Intermediate HTTPS
45 per window (44 remaining at test time)
72 B
Measured Score 0 50 100 Speed 17/30 Consistency 20/20 Security 20/20 Browser access 0/15 Transparency 15/15 TESTED 2026-08-10

Overview

Wallhaven is a curated wallpaper community, and its API lets you search and browse its large collection of high-resolution wallpapers by keyword, category, and resolution. Public wallpapers can be accessed without an API key, while an API key unlocks NSFW and personal favorites. It is a great API for building custom wallpaper apps or desktop clients.

Beginner Tip

Start with the /search endpoint without an API key to browse SFW wallpapers immediately — authentication is only needed to access adult-rated content or your personal account data.

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://wallhaven.cc/api/v1/search?q=nature&categories=010&purity=100&sorting=relevance
Result
HTTP 200 · application/json · 15,610 bytes · compressed
Response time
219 ms (median of 3) · fastest 218 ms
Transport
TLSv1.3 · TLS_AES_256_GCM_SHA384 · certificate issued by Google Trust Services
Browser CORS
No Access-Control-Allow-Origin header — call it from a server, not the browser
Rate limit
45 per window (44 remaining at test time)
Served by
cloudflare
Recorded
2026-08-10

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 p2o5yj
url string (url) https://wallhaven.cc/w/p2o5yj
short_url string (url) https://whvn.cc/p2o5yj
views integer 8470
favorites integer 51
source string
purity string sfw
category string anime
dimension_x integer 3200
dimension_y integer 1800
resolution string 3200x1800
ratio string 1.78
file_size integer 1234213
file_type string image/jpeg

Captured Response

Captured from a real request to https://wallhaven.cc/api/v1/search?q=nature&categories=010&purity=100&sorting=relevance on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "data": [
    {
      "id": "p2o5yj",
      "url": "https://wallhaven.cc/w/p2o5yj",
      "short_url": "https://whvn.cc/p2o5yj",
      "views": 8470,
      "favorites": 51,
      "source": "",
      "purity": "sfw",
      "category": "anime",
      "dimension_x": 3200,
      "dimension_y": 1800,
      "resolution": "3200x1800",
      "ratio": "1.78",
      "file_size": 1234213,
      "file_type": "image/jpeg",
      "…": "(4 more fields)"
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 251,
    "per_page": 24,
    "total": 6007,
    "query": "nature",
    "seed": null
  }
}

Implementation Example

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

Request
const url = "https://wallhaven.cc/api/v1/search?q=nature&categories=010&purity=100&sorting=relevance";
// 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-08-10. 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
{
  "error": "Not Found"
}

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.

HTTP 401 Unauthorized on account endpoints The endpoint requires authentication and either no API key was provided or it is invalid.
Log into wallhaven.cc, go to Account Settings > API Key, generate a key, and include it as the X-API-Key header.
Empty results on search The purity or category filter combination excludes all results for the given query.
Broaden your search by setting categories=111 and purity=100 to include all SFW categories.
HTTP 429 Too Many Requests Wallhaven enforces rate limits on API access.
Add a delay between requests (at least 1 second) and cache responses to avoid hitting limits.

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 17/30
Consistency 20/20
Security 20/20
Browser access 0/15
Transparency 15/15
Endpoint Response Time 219ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Photography
Difficulty Intermediate
Endpoint last called: 2026-08-10

Related Tags

Similar APIs

View All →