Moods API Documentation
A comprehensive guide to tracking and managing moods
Overview
The Moods API enables users to track and manage their moods. It supports recording moods with optional details like reason, images, and tags. The API provides functionality for creating, updating, and retrieving mood data.
Key Features
- Create and manage mood entries
- Track mood history with timestamps
- Add images, tags, and notes to moods
- Retrieve mood statistics and trends
- Get partner's daily mood with images
- Comment on partner's moods
- Add reactions to mood comments
API Documentation
Creates a new mood entry.
Request Body:
{
"userId": "user_123",
"mood": "happy",
"reason": "Had a great day!",
"images": [
"https://example.com/image1.jpg"
],
"note": "Feeling grateful",
"tags": [
"grateful",
"productive"
],
"interests": [
"work",
"family"
],
"createdAt": 1706474340000
}Response (200 OK):
{
"id": "mood_12345",
"userId": "user_123",
"mood": "happy",
"reason": "Had a great day!",
"images": [
"https://example.com/image1.jpg"
],
"note": "Feeling grateful",
"createdAt": "2024-01-28,20:39",
"tags": [
"grateful",
"productive"
],
"interests": [
"work",
"family"
]
}Retrieves a specific mood entry by ID.
Response (200 OK):
{
"id": "mood_12345",
"userId": "user_123",
"mood": "happy",
"reason": "Had a great day!",
"images": [
"https://example.com/image1.jpg"
],
"note": "Feeling grateful",
"createdAt": "2024-01-28,20:39",
"tags": [
"grateful",
"productive"
],
"interests": [
"work",
"family"
]
}Retrieves all moods for a user.
Response (200 OK):
[
{
"id": "mood_12345",
"userId": "user_123",
"mood": "happy",
"reason": "Had a great day!",
"images": [
"https://example.com/image1.jpg"
],
"note": "Feeling grateful",
"createdAt": "2024-01-28,20:39",
"tags": [
"grateful",
"productive"
],
"interests": [
"work",
"family"
]
},
{
"id": "mood_67890",
"userId": "user_123",
"mood": "excited",
"reason": "Birthday party",
"images": [],
"note": "Best day ever!",
"createdAt": "2024-01-29,18:00",
"tags": [
"celebration"
],
"interests": [
"family"
]
}
]Retrieves mood statistics for a date range.
Response (200 OK):
{
"moods": [
{
"id": "mood_12345",
"userId": "user_123",
"mood": "happy",
"reason": "Had a great day!",
"images": [
"https://example.com/image1.jpg"
],
"note": "Feeling grateful",
"createdAt": "2024-01-28,20:39",
"tags": [
"grateful",
"productive"
],
"interests": [
"work",
"family"
]
},
{
"id": "mood_67890",
"userId": "user_123",
"mood": "excited",
"reason": "Birthday party",
"images": [],
"note": "Best day ever!",
"createdAt": "2024-01-29,18:00",
"tags": [
"celebration"
],
"interests": [
"family"
]
}
],
"stats": {
"total": 2,
"moodDistribution": {
"happy": 1,
"excited": 1
},
"mostFrequentMood": "happy"
}
}Retrieves the partner's most recent mood for the current day.
Response (200 OK):
{
"hasMood": true,
"mood": {
"_id": "mood_12345",
"mood": "happy",
"createdAt": "2024-01-28T20:39:00.000Z",
"reason": "Had a great day!",
"images": [
"https://example.com/image1.jpg"
],
"note": "Feeling grateful",
"tags": [
"grateful",
"productive"
],
"interests": [
"work",
"family"
]
}
}Updates an existing mood entry.
Request Body:
{
"userId": "user_123",
"mood": "excited",
"reason": "Got a bigger promotion!",
"images": [
"https://example.com/image1.jpg"
],
"note": "Updated my feelings about the promotion"
}Response (200 OK):
{
"id": "mood_12345",
"userId": "user_123",
"mood": "excited",
"reason": "Got a bigger promotion!",
"images": [
"https://example.com/image1.jpg"
],
"note": "Updated my feelings about the promotion",
"createdAt": "2024-01-28,20:39",
"tags": [
"grateful",
"productive"
],
"interests": [
"work",
"family"
]
}Deletes a mood entry.
Response (200 OK):
{
"success": true
}Retrieves all comments for a specific mood. Only the mood owner or their partner can view comments.
Response (200 OK):
{
"success": true,
"comments": [
{
"id": "comment_123",
"userId": "user_456",
"moodId": "mood_12345",
"comment": "That's wonderful! I'm so happy for you!",
"replyToCommentId": null,
"reaction": null,
"createdAt": 1706474400000,
"editedAt": null,
"isEdited": false
}
]
}Creates a comment on a partner's mood. You can only comment on your partner's moods, not your own.
Request Body:
{
"comment": "That's wonderful! I'm so happy for you!",
"replyToCommentId": null
}Response (200 OK):
{
"success": true,
"comment": {
"id": "comment_123",
"userId": "user_456",
"moodId": "mood_12345",
"comment": "That's wonderful! I'm so happy for you!",
"replyToCommentId": null,
"reaction": null,
"createdAt": 1706474400000,
"editedAt": null,
"isEdited": false
}
}Updates (edits) a comment you created on a mood.
Request Body:
{
"comment": "Updated comment text"
}Response (200 OK):
{
"success": true,
"comment": {
"id": "comment_123",
"userId": "user_456",
"moodId": "mood_12345",
"comment": "Updated comment text",
"replyToCommentId": null,
"reaction": null,
"createdAt": 1706474400000,
"editedAt": 1706474500000,
"isEdited": true
}
}Deletes a comment you created on a mood.
Response (200 OK):
{
"success": true
}Adds an emoji reaction to a comment on a mood. You can only react to your partner's comments.
Request Body:
{
"reaction": "❤️"
}Response (200 OK):
{
"success": true
}Data Models
Mood
interface Mood {
id: string;
userId: string;
mood: string;
reason?: string;
images: string[];
note?: string;
tags?: string[];
interests?: string[];
createdAt: string; // Formatted as YYYY-MM-DD,HH:mm
}Mood Stats
interface MoodStats {
moods: Mood[];
stats: {
total: number;
moodDistribution: Record<string, number>;
mostFrequentMood: string;
};
}Partner Daily Mood
interface PartnerDailyMood {
hasMood: boolean;
mood?: {
_id: string;
mood: string;
createdAt: string; // ISO 8601 format
reason?: string;
images: string[];
note?: string;
tags?: string[];
interests?: string[];
};
}Mood Comment
interface MoodComment {
id: string;
userId: string;
moodId: string;
comment: string;
replyToCommentId?: string | null;
reaction?: string | null;
createdAt: number; // Unix timestamp in milliseconds
editedAt?: number | null;
isEdited: boolean;
}Error Handling
400 - Invalid mood data
{
"error": "Invalid mood data",
"code": "invalid_data"
}404 - Mood not found
{
"error": "Mood not found",
"code": "not_found"
}404 - No partner connection found
{
"error": "No partner connection found",
"code": "not_found"
}400 - Cannot comment on your own mood
{
"error": "Cannot comment on your own mood",
"code": "UNAUTHORIZED"
}400 - You can only comment on your partner's moods
{
"error": "You can only comment on your partner's moods",
"code": "UNAUTHORIZED"
}500 - Internal server error
{
"error": "Internal server error",
"code": "internal_error"
}