{
  "openapi": "3.1.0",
  "info": {
    "title": "NutriLog API",
    "version": "1.0.5",
    "description": "NutriLog API for facilitating communication between the GPT chat assistant and the NutriLog platform, enabling actions such as calorie tracking, goal monitoring, and personalized guidance."
  },
  "servers": [
    {
      "url": "https://nutrilog.app.wiredgeese.com"
    }
  ],
  "paths": {
    "/app/api/calorie/log/get": {
      "get": {
        "summary": "Retrieve calorie logs for a user within a specified period",
        "description": "This endpoint allows a user to retrieve both draft and finalized calorie logs within a given date range. The response includes logs for both draft and final records.",
        "operationId": "Calorie_Log_Get",
        "parameters": [
          {
            "name": "dateFrom",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date",
              "description": "The start date of the period (inclusive). Format: YYYY-MM-DD."
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date",
              "description": "The end date of the period (inclusive). Format: YYYY-MM-DD."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved the calorie logs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draftLogs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Calorie_Log"
                      },
                      "description": "Calorie logs for the requested period that are in draft records."
                    },
                    "finalLogs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Calorie_Log"
                      },
                      "description": "Calorie logs for the requested period that are finalized."
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request due to missing or invalid date parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/api/calorie/log/save": {
      "post": {
        "summary": "Save a draft of a calorie log.",
        "description": "This endpoint allows users to save a draft of their calorie log for a specific date, including a list of consumed items.",
        "operationId": "Calorie_Log_Save",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date",
                    "description": "The date of the calorie log in YYYY-MM-DD format."
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Calorie_Log_Item"
                    },
                    "description": "List of calorie log items."
                  }
                },
                "required": ["date", "items"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calorie log draft saved successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Missing or invalid data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required. User does not have an active subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/api/feedback/submit": {
      "post": {
        "summary": "Submit feedback to the support team.",
        "description": "Allows an authorized user to submit multilingual free-form feedback through the Assistant. The assistant processes and translates the message before submission.",
        "operationId": "Feedback_Submit",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "feedback": {
                    "$ref": "#/components/schemas/Feedback_Inbox"
                  }
                },
                "required": ["feedback"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Feedback was successfully submitted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The user must be logged in to submit feedback.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/api/profile/get": {
      "get": {
        "summary": "Get user profile information.",
        "description": "This endpoint allows users to retrieve their profile information, including metadata and profile details.",
        "operationId": "Profile_Get",
        "x-openai-isConsequential": false,
        "responses": {
          "200": {
            "description": "User profile retrieved successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    },
                    "profile": {
                      "$ref": "#/components/schemas/User_Profile"
                    }
                  },
                  "required": ["meta", "profile"],
                  "description": "Response structure for retrieving the user profile, including meta data and profile information."
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Missing or invalid data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/api/profile/update": {
      "post": {
        "summary": "Update user profile information.",
        "description": "This endpoint updates the user's profile with the provided data.",
        "operationId": "Profile_Update",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "profile": {
                    "$ref": "#/components/schemas/User_Profile"
                  }
                },
                "required": ["profile"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Profile successfully updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or missing required fields.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required. User does not have an active subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/api/weight/goal/get": {
      "get": {
        "summary": "Get goal weight history.",
        "description": "Returns a list of target weight values defined by the user for specific dates within the selected range.",
        "operationId": "Weight_Goal_Get",
        "parameters": [
          {
            "name": "dateFrom",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Start date of the period (inclusive). Format: YYYY-MM-DD."
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "End date of the period (inclusive). Format: YYYY-MM-DD."
          }
        ],
        "responses": {
          "200": {
            "description": "Goal weight entries successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Weight"
                      },
                      "description": "List of user-defined goal weights."
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid query parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/api/weight/goal/save": {
      "post": {
        "summary": "Save a goal weight.",
        "description": "This endpoint allows users to save or update their goal weight for a specific date.",
        "operationId": "Weight_Goal_Save",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "weight": {
                    "$ref": "#/components/schemas/Weight"
                  }
                },
                "required": ["weight"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Goal weight successfully created or updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  },
                  "required": ["meta"]
                },
                "examples": {
                  "inserted": {
                    "summary": "New goal weight entry created",
                    "value": {
                      "meta": {
                        "ok": true,
                        "code": "SUCCESS_INSERTED"
                      }
                    }
                  },
                  "updated": {
                    "summary": "Existing goal weight entry updated",
                    "value": {
                      "meta": {
                        "ok": true,
                        "code": "SUCCESS_UPDATED"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Missing or invalid data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required. User does not have an active subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/api/weight/log/get": {
      "get": {
        "summary": "Get current weight history.",
        "description": "Returns the list of user-submitted weight measurements for a given date range.",
        "operationId": "Weight_Log_Get",
        "parameters": [
          {
            "name": "dateFrom",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Start date of the period (inclusive). Format: YYYY-MM-DD."
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "End date of the period (inclusive). Format: YYYY-MM-DD."
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved current weight measurements.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Weight"
                      },
                      "description": "List of recorded current weight entries."
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid query parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/api/weight/log/save": {
      "post": {
        "summary": "Save a current weight measurement.",
        "description": "This endpoint allows users to save or update their current body weight for a specific date.",
        "operationId": "Weight_Log_Save",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "weight": {
                    "$ref": "#/components/schemas/Weight"
                  }
                },
                "required": ["weight"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current weight entry saved or updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Missing or invalid data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required. User does not have an active subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "$ref": "#/components/schemas/Response_Meta"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Calorie_Log": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "The date of the calorie log entry."
          },
          "dateCommitted": {
            "type": "string",
            "format": "date-time",
            "description": "The date when the calorie log was committed."
          },
          "totalCalories": {
            "type": "number",
            "description": "Total calories consumed on this date."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Calorie_Log_Item"
            },
            "description": "List of food items consumed on the given date."
          }
        }
      },
      "Calorie_Log_Item": {
        "type": "object",
        "properties": {
          "food": {
            "type": "string",
            "description": "The name of the consumed food item."
          },
          "quantity": {
            "type": "number",
            "description": "The amount of the food item consumed."
          },
          "measure": {
            "type": "string",
            "enum": ["GRAMS", "MILLILITERS", "PIECES"],
            "description": "The unit of measurement for the food item."
          },
          "unitCalories": {
            "type": "number",
            "description": "The caloric value of the food item per standard unit."
          },
          "totalCalories": {
            "type": "number",
            "description": "The total calories for the consumed quantity, calculated based on quantity and measure."
          }
        }
      },
      "Feedback_Inbox": {
        "type": "object",
        "properties": {
          "lang": {
            "type": "string",
            "description": "ISO 639-1 language code of the original feedback text (e.g., 'ru', 'es'). Required only if the original text is not in English."
          },
          "subject": {
            "type": "string",
            "description": "Short summary of the feedback for display in UI or notification emails. Generated by the Assistant."
          },
          "textEn": {
            "type": "string",
            "description": "Feedback message translated to English, or the original message if it was already in English."
          },
          "textOrigin": {
            "type": "string",
            "nullable": true,
            "description": "Original feedback text in the user's native language. Null if the original was in English."
          }
        },
        "required": [
          "subject",
          "textEn"
        ],
        "description": "Structured user feedback submitted via the Assistant. Includes translation and optional metadata for multilingual input."
      },
      "Response_Meta": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "The result code depends on the endpoint."
          },
          "message": {
            "type": "string",
            "description": "Optional message explaining the result code, if necessary."
          },
          "ok": {
            "type": "boolean",
            "description": "`true` means the application processed the message normally and without errors."
          }
        },
        "required": ["code", "ok"],
        "description": "Standard meta information for the API response, explaining the processing result."
      },
      "User_Profile": {
        "type": "object",
        "properties": {
          "dateBirth": {
            "type": "string",
            "format": "date",
            "description": "Date of birth in YYYY-MM-DD format. Used for BMR (Basal Metabolic Rate) and age-related calculations."
          },
          "dateCreated": {
            "type": "string",
            "format": "date-time",
            "description": "ISO timestamp of profile creation. Indicates the account registration time."
          },
          "dateSubscriptionEnd": {
            "type": "string",
            "format": "date-time",
            "description": "ISO timestamp indicating when the current subscription expires. Determines access to premium features and data persistence."
          },
          "dateUpdated": {
            "type": "string",
            "format": "date-time",
            "description": "ISO timestamp of the most recent profile update."
          },
          "goal": {
            "type": "string",
            "description": "User-defined wellness goal, such as target weight or deadline. Interpreted by the Assistant for motivation and progress analysis."
          },
          "height": {
            "type": "number",
            "description": "User's height in centimeters. Used for BMR and calorie goal calculations."
          },
          "locale": {
            "type": "string",
            "description": "Language preference of the user, in BCP 47 format (e.g., en, fr). Used to personalize Assistant responses."
          },
          "measureSystem": {
            "type": "string",
            "enum": ["METRIC", "IMPERIAL"],
            "description": "User's preferred measurement system for displaying weight and other metrics."
          },
          "name": {
            "type": "string",
            "description": "User's display name shown in the interface. Not necessarily unique."
          },
          "promptStart": {
            "type": "string",
            "description": "Brief context for GPT-based Assistant to resume personalized conversations. Encapsulates prior user goals, preferences, and tone."
          },
          "sex": {
            "type": "string",
            "enum": ["FEMALE", "MALE", "UNDEFINED"],
            "description": "User's biological sex. Used in metabolic calculations."
          },
          "timezone": {
            "type": "string",
            "description": "User's timezone in IANA format (e.g., Europe/Riga). Used for localizing reminders and daily logs."
          },
          "uuid": {
            "type": "string",
            "description": "Universally unique identifier of the user profile. Used as a public key across all user-related operations."
          },
          "weight": {
            "type": "number",
            "description": "Current body weight in kilograms. Used in progress tracking and metabolic analysis."
          },
          "weightGoal": {
            "type": "number",
            "description": "Current target body weight in kilograms. Used to assess progress toward the user's goal."
          }
        },
        "required": [
          "dateBirth", "dateCreated", "goal", "height", "locale", "name", "promptStart", "sex", "timezone"
        ],
        "description": "User profile details including personal and physical information."
      },
      "Weight": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "Date of the weight measurement (format: YYYY-MM-DD, no time part)."
          },
          "note": {
            "type": "string",
            "description": "Optional user comment related to the measurement."
          },
          "value": {
            "type": "number",
            "description": "Body weight value in kilograms."
          }
        },
        "required": [
          "date", "value"
        ],
        "description": "Represents a weight measurement for a specific date."
      }
    }
  }
}
