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

POST api.wecompleteapp.com/api/users/user/:userId/moodsCreate a Mood

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"
  ]
}
GET api.wecompleteapp.com/api/users/user/:userId/moods/{moodId}Get Mood by ID

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"
  ]
}
GET api.wecompleteapp.com/api/users/user/:userId/moodsGet User Moods

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"
    ]
  }
]
GET api.wecompleteapp.com/api/users/user/:userId/moods?startDate=2024-01-28&endDate=2024-01-29Get Mood Stats

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"
  }
}
GET api.wecompleteapp.com/api/users/user/:userId/partner/daily-moodGet Partner's Daily Mood

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"
    ]
  }
}
PUT api.wecompleteapp.com/api/users/user/:userId/moods/{moodId}Update Mood

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"
  ]
}
DELETE api.wecompleteapp.com/api/users/user/:userId/moods/{moodId}Delete Mood

Deletes a mood entry.

Response (200 OK):

{
  "success": true
}
GET api.wecompleteapp.com/api/users/user/:userId/moods/{moodId}/commentsGet Mood Comments

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
    }
  ]
}
POST api.wecompleteapp.com/api/users/user/:userId/moods/{moodId}/commentsCreate Mood Comment

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
  }
}
PUT api.wecompleteapp.com/api/users/user/:userId/moods/{moodId}/comments/{commentId}Update Mood Comment

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
  }
}
DELETE api.wecompleteapp.com/api/users/user/:userId/moods/{moodId}/comments/{commentId}Delete Mood Comment

Deletes a comment you created on a mood.

Response (200 OK):

{
  "success": true
}
PATCH api.wecompleteapp.com/api/users/user/:userId/moods/{moodId}/comments/{commentId}/reactionAdd Reaction to Mood Comment

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"
}