Open documentation ↗Overview
Retrieve xkcd comics as JSON
xkcd is a games & comics API from xkcd.com. It needs no API key. It is served over HTTPS and does not allow direct browser requests (no CORS). Its OpenAPI description documents 2 endpoints.
At a glance
- Authentication
- No auth
- HTTPS
- Yes
- CORS
- No
- Category
- Games & Comics
- Base URL
http://xkcd.com/- Version
- 1.0.0
- Endpoints
- 2
- OpenAPI
- Specification ↗
- Spec updated
- 2021-04-07
Make a first request
Replace the placeholders; the documentation says exactly where credentials go.
curl -X GET "http://xkcd.com/info.0.json" \
-H "Accept: application/json"const response = await fetch("http://xkcd.com/info.0.json", {
method: "GET",
headers: {
"Accept": "application/json",
},
});
const data = await response.json();
console.log(data);import requests
response = requests.request(
"GET",
"http://xkcd.com/info.0.json",
headers={
"Accept": "application/json",
},
timeout=30,
)
print(response.json())Endpoints
| Method | Path | What it does |
|---|---|---|
| GET | /info.0.json | Fetch current comic and metadata. |
| GET | /{comicId}/info.0.json | Fetch comics and metadata by comic id. |
Questions
Does the xkcd API need an API key?
No. The xkcd API can be called without an API key or sign-up, which makes it handy for prototypes and front-end demos.
Can I call the xkcd API from the browser?
Not directly. The xkcd API does not send CORS headers, so call it from your server or a proxy instead of browser JavaScript.
Does the xkcd API support HTTPS?
Yes, the xkcd API is served over HTTPS.
How many endpoints does the xkcd API have?
Its OpenAPI description lists 2 endpoints in version 1.0.0. All of them are shown on this page.
What are alternatives to the xkcd API?
Other Games & Comics APIs include Chess.com, Scryfall, Riot Games, Lichess, Comic Vine.
Similar games & comics APIs
Compare alternatives →Chess.com
Games & ComicsChess.com read-only REST API
Scryfall
Games & ComicsMagic: The Gathering database
Riot Games
Games & ComicsLeague of Legends Game Information
Lichess
Games & ComicsAccess to all data of users, games, puzzles and etc on Lichess
Comic Vine
Games & ComicsThe largest comic database online, Comic Vine features Comic Reviews, News, Videos, and Forums for the latest in and more!
RuneScape
Games & ComicsRuneScape and OSRS RPGs information
Listed from public-apis (MIT), public-apis database (MIT), Free Public APIs, APIs.guru (CC0).