Documentación

La documentación para desarrolladores está en inglés.

Tipo de tarjeta

quiz

One multiple-choice question with the answer key, so the client grades locally. The next question, and the grading of the reply, come when the user's reply follows our question's text unchanged; the last answer, or stopping, is a text-only answer (with the score once a question was answered).

Version 1 · schema quiz.v1.schema.json

Not answered yet: the API sends no quiz cards for now, and such questions come back matched: false (not billed). The type stays in the contract, so handle it like any other.

Layouts

Every card type has full. Pick a layout with the element's layout attribute, render.layout, or a theme.

Fields

The fields of card.data. Values a source doesn't provide are null; new optional fields can appear within version 1.

FieldTypeRequiredNotes
topicstringyes
indexintegeryes
totalintegeryes
questionstringyes
options[]object[]yes
options[].keystringyes
options[].textstringyes
answer_keystringyes
explanationstringyes
scoreinteger | nullCorrect answers so far in this round.
previousnull | objectyesHow the user did on the previous question of the round, if any.
previous.givenstringyes
previous.correctbooleanyes
previous.correct_answerstringyes

Example

A recorded answer to “Quiz me on world capitals”. Open it in the Answer Lab to see every layout and style.

Response
{
  "v": 2,
  "id": "ans_dnzgrfmzirz1b6pg",
  "matched": true,
  "locale": "en",
  "skill": "quiz",
  "confidence": 0.9,
  "text": "Question 1 of 5 (World capitals): What is the capital city of Costa Rica? A) Majuro, B) San Jose, C) Port of Spain, D) Andorra la Vella.",
  "speech": "Let's play! Question 1 of 5: What is the capital city of Costa Rica? A: Majuro, B: San Jose, C: Port of Spain or D: Andorra la Vella.",
  "card": {
    "type": "quiz",
    "version": 1,
    "data": {
      "topic": "World capitals",
      "index": 1,
      "total": 5,
      "question": "What is the capital city of Costa Rica?",
      "options": [
        {
          "key": "A",
          "text": "Majuro"
        },
        {
          "key": "B",
          "text": "San Jose"
        },
        {
          "key": "C",
          "text": "Port of Spain"
        },
        {
          "key": "D",
          "text": "Andorra la Vella"
        }
      ],
      "answer_key": "B",
      "explanation": "",
      "score": 0,
      "previous": null
    }
  },
  "sources": [
    {
      "name": "The Trivia API",
      "url": "https://the-trivia-api.com/",
      "license": "CC BY-NC 4.0"
    }
  ],
  "follow_ups": [
    "Skip",
    "Stop the quiz"
  ],
  "actions": [],
  "usage": {
    "billable": true
  }
}