Generating AI Riddle via URL

A URL can be provided to the AI API to get a Riddle surrounding a rather specific context, as opposed to general content, e.g., topics or trivia quizzes.

Generating different Riddle types

Generate a Quiz

To generate a quiz about any URL, use the /riddle-ai/url/quiz API endpoint. Here is an example payload which generates a quiz about Riddle's pricing:

{
    "url": "https://www.riddle.com/pricing",
    "language": "en",
    "numQuestions": 5,
    "difficulty": "easy"
}

Generate a Quiz from multiple URLs

You can also generate a single quiz from multiple URLs at once. Use the /riddle-ai/url/quiz/bulk API endpoint and pass the URLs as an array via the urls parameter – the AI combines the content of all pages into one quiz:

{
    "urls": [
        "https://www.riddle.com/pricing",
        "https://www.riddle.com/quiz-maker"
    ],
    "language": "en",
    "numQuestions": 5,
    "difficulty": "easy"
}

Generate a Poll

To generate a poll about any URL, use the /riddle-ai/url/poll API endpoint. Here is an example payload which generates a poll about Riddle's pricing (not particularly interesting/engaging, but you get the idea):

{
    "url": "https://www.riddle.com/pricing",
    "language": "en",
    "numQuestions": 5
}

Optional parameters

There are several optional parameters you can use with every Riddle type to further customize the generated Riddle and control its flow:

PropertyTypeDescriptionDefault
projectinteger|nullThe project the generated Riddle will be assigned to; pass NULL if it should be added to the personal project
publishbooleanWhether to publish the Riddle immediately after generation; pass false to only generate a draftfalse
callbackUrlstringA URL to which the generated Riddle will be sent; useful as the generation happens asynchronously
buildobjectA Riddle Builder API configuration applied on top of the generated content (result pages, preset, publish settings, ...); learn more

Tip: Using the callbackUrl parameter is a good way to avoid having to poll the API for the Riddle ID. You can use this URL to trigger a webhook to your server and be notified when the Riddle is ready to use and for embedding.

Example Poll object

{
    "url": "https://www.riddle.com/pricing",
    "language": "en",
    "numQuestions": 5,
    "project": 123,
    "publish": true,
    "callbackUrl": "https://example.com/callback",
    "build": {
        "result": {
            "title": "Thanks for voting!",
            "description": "Check back tomorrow for a new poll."
        },
        "preset": {
            "preset": 805,
            "palette": "Zymx"
        }
    }
}

The build object here replaces the generated result page and applies your own preset and palette. As this is a Poll, the result page is set with result – for a Quiz you would send an array of results instead. Click here to see everything you can configure per Riddle type.