{ "text": "Today was an incredible day. I finally finished the project I've been working on for months, and the client loved it. Feeling grateful and accomplished."}
curl -X POST https://istory.vercel.app/api/ai/enhance \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"text": "today i went to the store and bought some stuff it was good"}'
curl -X POST https://istory.vercel.app/api/ai/analyze \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "storyId": "123e4567-e89b-12d3-a456-426614174000", "storyText": "Today I had an important conversation with my mom about my career. She finally understood why I left my corporate job to pursue my passion for art. It felt liberating." }'
{ "success": true, "metadata": { "themes": ["family", "identity", "freedom", "career"], "emotional_tone": "hopeful", "life_domain": "relationships", "intensity_score": 0.75, "significance_score": 0.85, "people_mentioned": ["mom"], "places_mentioned": [], "time_references": ["today"], "brief_insight": "This represents a significant breakthrough in family communication and personal authenticity." }, "insight": "This represents a significant breakthrough in family communication and personal authenticity."}
{ "success": true, "reflection": { "id": "456e7890-e89b-12d3-a456-426614174111", "reflection_text": "This week, your entries reveal a strong focus on personal growth and creative expression. You've been navigating changes in your career while maintaining meaningful connections with family.\n\nThere's a notable sense of hope and determination running through your stories, particularly around your decision to pursue art professionally. The conversation with your mom stands out as a key moment of mutual understanding and validation.\n\nYour reflections show increasing clarity about your values and priorities. Continue to honor these insights as you move forward.", "themes_identified": ["growth", "family", "creativity", "identity", "career"], "dominant_tone": "hopeful", "dominant_domain": "growth", "stories_analyzed": ["123e4567-e89b-12d3-a456-426614174000", "...3 more"], "canonical_weight": 6.0, "week_start": "2026-03-02T00:00:00.000Z", "week_end": "2026-03-08T23:59:59.999Z", "created_at": "2026-03-04T10:30:00.000Z" }, "storiesAnalyzed": 4, "canonicalWeight": 6.0}
{ "error": "Missing required fields: userId and userWallet" }
Show 429 Too Many Requests
{ "error": "You can only generate one reflection per week", "nextAvailable": "2026-03-09T00:00:00.000Z", "existingReflection": { /* existing reflection object */ }}
Reflections are limited to 1 per week (7-day cooldown).
If the user has no stories from the past 7 days, the AI generates an encouraging message:
{ "reflection_text": "It looks like you haven't captured any stories this week. Journaling is a powerful tool for self-reflection and growth. Consider setting aside a few minutes today to record your thoughts, experiences, or even small moments of gratitude.", "themes_identified": [], "dominant_tone": "hopeful", "dominant_domain": "growth"}
Show Canonical Story Weighting
Stories marked as “Important” (canonical) are weighted 2x in the reflection:
// Stories with is_canonical: true are repeated in the promptif (isCanonical) { storyEntry = `**KEY MOMENT**\n${storyEntry}`; canonicalWeight += 2.0;}