Vai al contenuto
GET /v1/random

A random comic

Provalo dal vivo

10 chiamate gratuite al giorno — senza registrazione, senza chiave API. Passa dal gateway oanor.

Intestazioni personalizzate (facoltative)
api.oanor.com/xkcd-api

Funziona. Prendi una chiave API e usala nel tuo progetto.

Ottieni una chiave API

Frammenti di codice

curl "https://api.oanor.com/xkcd-api/v1/random" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/xkcd-api/v1/random", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/xkcd-api/v1/random");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-oanor-key: oanor_test_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
import requests
requests.get(
    "https://api.oanor.com/xkcd-api/v1/random",
    headers={"x-oanor-key": "oanor_test_..."}
)

Risposta di esempio

Una risposta reale di questo endpoint, acquisita dall'ultimo health check.

{
    "data": {
        "comic": {
            "alt": "An occasional source of mild Thanksgiving tension in my family is that my mother is a die-hard fan of The Core (2003), and various family members sometimes have differing levels of enthusiasm for her annual tradition of watching it.",
            "date": "2023-11-22",
            "link": null,
            "news": null,
            "image": "https://imgs.xkcd.com/comics/thanksgiving_arguments.png",
            "title": "Thanksgiving Arguments",
            "number": 2858,
            "comic_url": "https://xkcd.com/2858/",
            "safe_title": "Thanksgiving Arguments",
            "transcript": null,
            "explain_url": "https://www.explainxkcd.com/wiki/index.php/2858"
        }
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:29.229Z",
        "request_id": "d8be89c3-4a9e-4cfd-800f-8ef38b59be85"
    },
    "status": "ok",
    "message": "Random comic retrieved",
    "success": true
}