Aller au contenu
GET /v1/comic

A comic by number

Essayez-le en direct

10 appels gratuits par jour — sans inscription, sans clé API. Passe par la passerelle oanor.

En-têtes personnalisés (facultatif)
api.oanor.com/xkcd-api

Ça marche. Récupérez une clé API et utilisez-la dans votre projet.

Obtenez une clé API

Extraits de code

curl "https://api.oanor.com/xkcd-api/v1/comic" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/xkcd-api/v1/comic", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/xkcd-api/v1/comic");
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/comic",
    headers={"x-oanor-key": "oanor_test_..."}
)

Exemple de réponse

Une réponse réelle de ce endpoint, capturée lors du dernier contrôle de santé.

{
    "data": {
        "comic": {
            "alt": "I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you.",
            "date": "2007-12-05",
            "link": null,
            "news": null,
            "image": "https://imgs.xkcd.com/comics/python.png",
            "title": "Python",
            "number": 353,
            "comic_url": "https://xkcd.com/353/",
            "safe_title": "Python",
            "transcript": "[[ Guy 1 is talking to Guy 2, who is floating in the sky ]] Guy 1: You're flying! How? Guy 2: Python! Guy 2: I learned it last night! Everything is so simple! Guy 2: Hello world is just 'print \"Hello, World!\" ' Guy 1: I dunno... Dynamic typing? Whitespace? Guy 2: Come join us! Programming is fun again! It's a whole new world up here! Guy 1: But how are you flying? Guy 2: I just typed 'import antigravity' Guy 1: That's it? Guy 2: ...I also sampled everything in the medicine cabinet for comparison. Guy 2: But i think this is the python. {{ I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you. }}",
            "explain_url": "https://www.explainxkcd.com/wiki/index.php/353"
        }
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:28.749Z",
        "request_id": "4d84ec2d-3603-49b8-922f-717cde6b6932"
    },
    "status": "ok",
    "message": "Comic retrieved",
    "success": true
}