Search
Search images.
GET
https://api.waifu.im/search
Retrieves images randomly or by tag based on the specified search criteria.
Query Parameters
Headers
{
"images": [
{
"artist": {
"artist_id": 1,
"deviant_art": "https://www.deviantart.com/4thwallzart",
"name": "fourthwallzart",
"patreon": "string",
"pixiv": "string",
"twitter": "https://twitter.com/4thWallzArt"
},
"byte_size": 3299586,
"dominant_color": "#bbb7b2",
"extension": ".png",
"favorites": 1,
"height": 2304,
"image_id": 8108,
"is_nsfw": false,
"liked_at": "string",
"preview_url": "https://www.waifu.im/preview/8108/",
"signature": "58e6f0372364abda",
"source": "https://www.patreon.com/posts/persephone-78224476",
"tags": [
{
"description": "A female anime/manga character.",
"is_nsfw": false,
"name": "waifu",
"tag_id": 12
}
],
"uploaded_at": "2023-05-03T18:40:04.381354+02:00",
"url": "https://cdn.waifu.im/8108.png",
"width": 1536
}
]
}
{"detail":"Bad Request"}
{"detail":"Unauthorized"}
{"detail":"Forbidden"}
{"detail":"Not Found"}
{"detail":"Internal Server Error"}
Here is an example to get a random image with the maid
tag with an height superior or equal to 2000 pixels:
curl -X GET \
'https://api.waifu.im/search?included_tags=maid&height=>=2000' \
-H 'Content-Type: application/json'
import requests
url = 'https://api.waifu.im/search'
params = {
'included_tags': ['maid'],
'height': '>=2000'
}
response = requests.get(url, params=params)
if response.status_code == 200:
data = response.json()
# Process the response data as needed
else:
print('Request failed with status code:', response.status_code)
const apiUrl = 'https://api.waifu.im/search'; // Replace with the actual API endpoint URL
const params = {
included_tags: 'maid',
height: '>=2000'
};
const queryParams = new URLSearchParams();
for (const key in params) {
if (Array.isArray(params[key])) {
params[key].forEach(value => {
queryParams.append(key, value);
});
} else {
queryParams.set(key, params[key]);
}
}
const requestUrl = `${apiUrl}?${queryParams.toString()}`;
fetch(requestUrl)
.then(response => {
if (response.ok) {
return response.json();
} else {
throw new Error('Request failed with status code: ' + response.status);
}
})
.then(data => {
// Process the response data as needed
console.log(data);
})
.catch(error => {
console.error('An error occurred:', error.message);
});
Last updated