Filtering by Subject
By default, querying the SdashAPI /q endpoint returns a completely random question from any subject. To build a targeted quiz, you need to restrict the returned questions to a specific field of study.
The Subject Parameter
2.10.1To filter questions by subject, append the subject query parameter to your API URL. The value of this parameter must be the exact slug returned by the /subjects endpoint (e.g., "chemistry", "mathematics", "civiledu").
GET https://sdashapi.com/api/v1/q?subject=biology
Handling Multiple Questions
2.10.2Filtering by subject works seamlessly with the limit parameter. If you want to generate a 20-question Biology quiz, you combine both parameters using the & symbol.
GET https://sdashapi.com/api/v1/q?subject=biology&limit=20
This guarantees that all 20 questions in the returned JSON array will be Biology questions.
Invalid Subjects
2.10.3If you pass a subject slug that does not exist in our database (for example, a typo like ?subject=biologgy), the API will return a 404 Not Found status code with a message indicating that no questions could be found for that specific filter.