curl --request POST \
--url https://api.example.com/api/generate-unified \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"outputType": "<string>",
"userId": "<string>",
"customName": "<string>",
"numQuestions": 123,
"includeMultipleAnswer": true,
"includeTrueFalse": true,
"depthOfKnowledge": "<string>",
"numFlashcards": 123,
"numWritingPrompts": 123,
"notesLength": "<string>"
}
'{
"success": true,
"itemId": "<string>",
"title": "<string>"
}Generate comprehensive study materials including quizzes, flashcards, writing prompts, or notes with advanced options
curl --request POST \
--url https://api.example.com/api/generate-unified \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"outputType": "<string>",
"userId": "<string>",
"customName": "<string>",
"numQuestions": 123,
"includeMultipleAnswer": true,
"includeTrueFalse": true,
"depthOfKnowledge": "<string>",
"numFlashcards": 123,
"numWritingPrompts": 123,
"notesLength": "<string>"
}
'{
"success": true,
"itemId": "<string>",
"title": "<string>"
}POST /api/generate-unified
blob:) for uploaded files (PDF, DOCX, TXT)quiz - Multiple-choice quiz questionsflashcards - Flashcard pairswriting-prompt - Writing prompts with guidancenotes - Comprehensive study notesbeginner - Easy recall and recognition questionsintermediate - Application and understanding questionsadvanced or expert - Analysis and critical thinking questionsshort - 5 sectionsmedium - 8 sectionslong - 12 sectionscurl -X POST https://yourdomain.com/api/generate-unified \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"content": "The mitochondria is the powerhouse of the cell. It generates ATP through cellular respiration...",
"outputType": "quiz",
"customName": "Cell Biology Quiz",
"numQuestions": 10,
"depthOfKnowledge": "intermediate",
"includeMultipleAnswer": true,
"includeTrueFalse": true
}'
{
"success": true,
"itemId": "550e8400-e29b-41d4-a716-446655440000",
"title": "Cell Biology Quiz"
}
curl -X POST https://yourdomain.com/api/generate-unified \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"content": "Common Spanish verbs: hablar (to speak), comer (to eat), vivir (to live)...",
"outputType": "flashcards",
"numFlashcards": 15
}'
curl -X POST https://yourdomain.com/api/generate-unified \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"content": "The American Revolution was a colonial revolt that took place between 1765 and 1783...",
"outputType": "notes",
"notesLength": "long",
"customName": "American Revolution Study Notes"
}'
curl -X POST https://yourdomain.com/api/generate-unified \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"content": "blob:https://yourdomain.com/abc-123",
"outputType": "quiz",
"numQuestions": 15
}'
{
"error": "Not authenticated"
}
{
"error": "Content and output type are required"
}
{
"error": "Invalid output type"
}
outputType is not one of the valid options.
{
"error": "API key not configured"
}
{
"error": "Groq API error: [error details]"
}
{
"error": "Failed to parse generated content: [details]. The AI generated invalid JSON."
}
{
"error": "No valid questions generated"
}
{
"error": "No valid flashcards generated"
}
{
"error": "Failed to save to database: [error details]"
}
{
"error": "The uploaded file appears to be empty or unreadable. Please check the file and try again."
}
pdf-parseofficeparserllama-3.1-8b-instant modelstudy_items table in Supabasequiz, flashcards, writing, or notesuser_id - The authenticated user’s IDtype - One of: quiz, flashcards, writing, notestitle - Custom name or AI-generated titlecontent - JSON string or markdown text{
"questions": [
{
"question": "What is the powerhouse of the cell?",
"type": "multiple-choice",
"options": ["Mitochondria", "Nucleus", "Ribosome", "Chloroplast"],
"correctAnswer": 0,
"explanation": "The mitochondria generates ATP through cellular respiration."
}
],
"topic": "Cell Biology Quiz"
}
{
"flashcards": [
{
"front": "What is hablar in English?",
"back": "to speak"
}
],
"topic": "Spanish Verbs"
}
{
"prompts": [
{
"prompt": "Analyze the causes of the American Revolution",
"guidance": "Consider economic, political, and social factors"
}
],
"topic": "American Revolution"
}