random

Here's an example of fetching a random nsfw image with the random endpoint. Returns a random image from any of our hentai endpoints.

Fetching a random nsfw image

Get a random nsfw image & its details.

GET https://nekos.pro/api/random

Please note, this returns NSFW images.

{
    "id": 1263,
    "character_name": "Yuigahama Yui's Mother",
    "url": "https://cdn.nekos.pro/fucking/20b220dd8a494553bb4beb2c07332849.jpg"
}

Python example:

import aiohttp

headers = {'Content-type': 'application/json'}
async with aiohttp.ClientSession(headers=headers) as session:
    async with session.get('https://nekos.pro/api/random') as resp:
        image = await resp.json()
        print(image['url'])

This example assumes you are using asyncio & running a Discord bot, which you should be using instead of requests, which is blocking.

Last updated