How to hit the Open Trivia DB API

Open Trivia DB at https://opentdb.com is a free, user-contributed trivia database. Question text is HTML-encoded unless you ask for another encode.

Authentication

None — no key, no signup. Every example runs as-is.

Full reference: https://opentdb.com/api_config.php

Get questions

response_code 0 means success.

curl "https://opentdb.com/api.php?amount=2&type=multiple"
Run in PostTaco
Example response (trimmed)
{
  "response_code": 0,
  "results": [
    {
      "type": "multiple",
      "difficulty": "medium",
      "category": "Science: Computers",
      "question": "All of the following programs are classified as raster graphics editors EXCEPT:",
      "correct_answer": "Inkscape",
      "incorrect_answers": [
        "Paint.NET",
        "GIMP"
      ]
    },
    {
      "type": "multiple",
      "difficulty": "medium",
      "category": "Entertainment: Video Games",
      "question": "Which town was Seamus "Sledge" Cowden from "Tom Clancy's Rainbow Six Siege" born in?",
      "correct_answer": "John O'Groats",
      "incorrect_answers": [
        "Brawl",
        "Kearvaig"
      ]
    }
  ]
}

List categories

Use a category's id as category=.

curl https://opentdb.com/api_category.php
Run in PostTaco
Example response (trimmed)
{
  "trivia_categories": [
    {
      "id": 9,
      "name": "General Knowledge"
    },
    {
      "id": 10,
      "name": "Entertainment: Books"
    }
  ]
}