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 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:
Property | Type | Description | Default |
---|---|---|---|
project | integer|null | The project the generated Riddle will be assigned to; pass NULL if it should be added to the personal project | |
publish | boolean | Whether to publish the Riddle immediately after generation; pass false to only generate a draft | false |
callbackUrl | string | A URL to which the generated Riddle will be sent; useful as the generation happens asynchronously |
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",
}