Questgen API Documentation

Please reach out to [email protected] for the API key and URL.

API Endpoint

POST /https:/xyz.......xyz/getQuestions(provided by Questgen)

Request Headers

Request Parameters

Response Format

The response is a JSON object containing a list of ques_ans_pairs, with each pair representing a quiz question and its corresponding answer(s).

Response Fields

Sample Python Code

import requestsimport jsonurl = "https://xyz......xyz/getQuestions"payload = json.dumps({  "text": "Elon Musk has shown again he can influence the digital currency market with just his tweets. After saying that his electric vehicle-making company Tesla will not accept payments in Bitcoin because of environmental concerns, he tweeted that he was working with developers of Dogecoin to improve system transaction efficiency. Following the two distinct statements from him, the world's largest cryptocurrency hit a two-month low, while Dogecoin rallied by about 20 percent. The SpaceX CEO has in recent months often tweeted in support of Dogecoin, but rarely for Bitcoin.  In a recent tweet, Musk put out a statement from Tesla that it was concerned about the rapidly increasing use of fossil fuels for Bitcoin (price in India) mining and transaction, and hence was suspending vehicle purchases using the cryptocurrency.  A day later he again tweeted saying, To be clear, I strongly believe in crypto, but it can't drive a massive increase in fossil fuel use, especially coal. It triggered a downward spiral for Bitcoin value but the cryptocurrency has stabilised since.   A number of Twitter users welcomed Musk's statement. One of them said it's time people started realising that Dogecoin is here to stay and another referred to Musk's previous assertion that crypto could become the world's future currency.",  "type": "MCQ",  "count": 5,  "difficultylevel": "Hard",  "mcqOptionsCount": 4,
  "output_language": "Auto"})headers = {  'x-api-key': 'xyz71......abc',  'Content-Type': 'application/json'}response = requests.request("POST", url, headers=headers, data=payload)output = response.json()print (output)

Sample Javascript Code

const fetchData = async () => {  const url = "https://xyz......xyz/getQuestions";  const payload = {    text: "Elon Musk has shown again he can influence the digital currency market with just his tweets. After saying that his electric vehicle-making company Tesla will not accept payments in Bitcoin because of environmental concerns, he tweeted that he was working with developers of Dogecoin to improve system transaction efficiency. Following the two distinct statements from him, the world's largest cryptocurrency hit a two-month low, while Dogecoin rallied by about 20 percent. The SpaceX CEO has in recent months often tweeted in support of Dogecoin, but rarely for Bitcoin. In a recent tweet, Musk put out a statement from Tesla that it was concerned about the rapidly increasing use of fossil fuels for Bitcoin (price in India) mining and transaction, and hence was suspending vehicle purchases using the cryptocurrency. A day later he again tweeted saying, To be clear, I strongly believe in crypto, but it can't drive a massive increase in fossil fuel use, especially coal. It triggered a downward spiral for Bitcoin value but the cryptocurrency has stabilised since. A number of Twitter users welcomed Musk's statement. One of them said it's time people started realising that Dogecoin is here to stay and another referred to Musk's previous assertion that crypto could become the world's future currency.",    type: "MCQ",    count: 5,    difficultylevel: "Hard",    mcqOptionsCount: 4,

"output_language": "Auto"

}; const headers = { 'x-api-key': 'xyz71......abc', 'Content-Type': 'application/json' }; try { const response = await fetch(url, { method: "POST", headers: headers, body: JSON.stringify(payload) }); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const output = await response.json(); console.log(output); } catch (error) { console.error('Error fetching data: ', error); }};fetchData();

Sample Output

{  "ques_ans_pairs": [    {      "question": "Why did Elon Musk tweet that Tesla will not accept payments in Bitcoin?",      "choices": ["Because Bitcoin is a volatile currency", "Because of government regulations", "Because of rising electricity costs", "Because of environmental concerns"],      "answers": ["Because of environmental concerns"]    },    // Additional questions...  ],  "text": "Elon Musk has shown again he can influence the digital currency market with just his tweets..."}