Skip to main content
POST
/
api
/
generate-notes
Generate Notes
curl --request POST \
  --url https://api.example.com/api/generate-notes \
  --header 'Content-Type: application/json' \
  --data '
{
  "topic": "<string>",
  "content": "<string>"
}
'
{
  "notes": "<string>",
  "topic": "<string>",
  "error": "<string>"
}

Endpoint

POST /api/generate-notes
Generates AI-powered study notes using the Groq API. Creates well-structured markdown notes with headers, bullet points, and key concepts highlighted.

Request Body

topic
string
required
The topic or subject for the study notes. This field is required.
content
string
Optional additional content or context to base the notes on. Up to 1000 characters will be used.

Response

notes
string
required
The generated study notes in markdown format. Includes headers (##), bullet points, and bold text for emphasis.
topic
string
The topic that was provided in the request.

Example Request

curl -X POST https://yourdomain.com/api/generate-notes \
  -H "Content-Type: application/json" \
  -d '{
    "topic": "Photosynthesis",
    "content": "Photosynthesis is the process by which plants convert light energy into chemical energy..."
  }'

Example Response

{
  "notes": "## Photosynthesis Overview\n\nPhotosynthesis is the process by which plants, algae, and some bacteria convert light energy into chemical energy stored in glucose.\n\n## Key Components\n\n- **Chloroplasts**: Organelles where photosynthesis occurs\n- **Chlorophyll**: Green pigment that absorbs light\n- **Sunlight**: Energy source for the reaction\n\n## The Chemical Equation\n\n6CO₂ + 6H₂O + light energy → C₆H₁₂O₆ + 6O₂\n\n## Two Main Stages\n\n### Light-Dependent Reactions\n\n- Occur in the thylakoid membranes\n- Convert light energy to ATP and NADPH\n- Produce oxygen as a byproduct\n\n### Light-Independent Reactions (Calvin Cycle)\n\n- Occur in the stroma\n- Use ATP and NADPH to convert CO₂ into glucose\n- Do not require direct light\n\n## Importance\n\n- Primary source of energy for most life on Earth\n- Produces oxygen for aerobic organisms\n- Foundation of most food chains",
  "topic": "Photosynthesis"
}

Error Responses

error
string
Error message describing what went wrong.

400 Bad Request

{
  "error": "Topic is required"
}
Returned when the topic field is missing or empty.

500 Internal Server Error

{
  "error": "Failed to generate notes: [error details]"
}
Returned when the Groq API request fails. Includes specific error details from the API.
{
  "error": "Failed to generate notes"
}
Returned when an unexpected error occurs during note generation.

Implementation Details

  • Uses Groq’s mixtral-8x7b-32768 model
  • Temperature set to 0.7 for balanced creativity
  • Maximum 2000 tokens per response
  • Content is truncated to first 1000 characters (vs. 500 for other endpoints)
  • System prompt emphasizes comprehensive, well-structured notes
  • Output format: Markdown with ## headers, bullet points, and bold emphasis

Build docs developers (and LLMs) love