openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path # Default security: every operation accepts a session cookie. Public # operations (e.g. /menu/public, /auth/phone/send-otp) override with # `security: []` to declare they do not require auth. Admin operations # may additionally accept `adminToken`. security: - sessionCookie: [] tags: - name: health description: Health operations - name: preferences description: User taste & wellness preferences - name: wellness description: Wellness dashboard, wearables, and daily activity sync - name: recipes description: RD/chef-authored recipe library - name: challenges description: Cohort challenges with shared progress feed - name: reviews description: Per-dish customer reviews and moderation - name: rd-partners description: RD partner & advisory onboarding wizard (public) - name: team-profiles description: Public chef & RD profiles for trust & transparency - name: dish-rationales description: AI-generated "why this meal" rationales for recommended dishes - name: meal-plans description: Smart weekly meal planner — generate, edit, and accept 7-day plans paths: /orders/first-order-offer: get: operationId: getFirstOrderOffer tags: [orders] summary: | First-order offer eligibility for the signed-in user (flat 25% off, capped at Rs.80, auto-applied at finalize). Display-only — finalizeOrder re-checks eligibility server-side. responses: "200": description: Eligibility and offer parameters. content: application/json: schema: { $ref: "#/components/schemas/FirstOrderOffer" } "401": { description: Unauthorized } /orders/finalize: post: operationId: finalizeOrder tags: [orders] summary: | Atomically persist an order, redeem credits, and award referrals in one transaction. Server-managed idempotency is REQUIRED — see the `Idempotency-Key` header. parameters: - $ref: "#/components/parameters/IdempotencyKey" requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/FinalizeOrderRequest" } responses: "200": description: | Order persisted (or cached response replayed for a retry of the same key + body). Replays carry `Idempotent-Replay: true`. content: application/json: schema: { $ref: "#/components/schemas/OrderFinalizeResult" } "400": { description: Invalid payload or missing/invalid Idempotency-Key } "401": { description: Unauthorized } "409": { description: Idempotency-Key reused with a different body } /marketplace/checkout: post: operationId: marketplaceCheckout tags: [marketplace] summary: | Place a marketplace order. Server-managed idempotency is REQUIRED so that a retried POST does not double-charge the customer or double-decrement stock. parameters: - $ref: "#/components/parameters/IdempotencyKey" requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/MarketplaceCheckoutRequest" } responses: "200": description: | Order placed (or cached response replayed). Replays carry `Idempotent-Replay: true`. content: application/json: schema: { $ref: "#/components/schemas/MarketplaceCheckoutResult" } "400": { description: Invalid payload or missing/invalid Idempotency-Key } "401": { description: Unauthorized } "409": { description: Idempotency-Key reused with a different body } /recipes: get: operationId: listRecipes tags: [recipes] summary: List published recipes with optional filters parameters: - in: query name: goal schema: { type: string } - in: query name: diet schema: { type: string } - in: query name: maxTime schema: { type: integer, minimum: 1 } - in: query name: q schema: { type: string } responses: "200": description: Recipes content: application/json: schema: type: object required: [recipes] properties: recipes: type: array items: { $ref: "#/components/schemas/Recipe" } /recipes/{slug}: get: operationId: getRecipe tags: [recipes] summary: Get a recipe by slug parameters: - in: path name: slug required: true schema: { type: string } responses: "200": description: Recipe content: application/json: schema: type: object required: [recipe] properties: recipe: { $ref: "#/components/schemas/Recipe" } "404": description: Not found /challenges: get: operationId: listChallenges tags: [challenges] summary: List cohort challenges responses: "200": description: Challenges content: application/json: schema: type: object required: [challenges] properties: challenges: type: array items: { $ref: "#/components/schemas/Challenge" } /challenges/{slug}: get: operationId: getChallenge tags: [challenges] summary: Get a challenge with cohort feed parameters: - in: path name: slug required: true schema: { type: string } responses: "200": description: Challenge detail content: application/json: schema: type: object required: [challenge, joined, posts] properties: challenge: { $ref: "#/components/schemas/Challenge" } joined: { type: boolean } posts: type: array items: { $ref: "#/components/schemas/ChallengePost" } "404": description: Not found /challenges/{slug}/join: post: operationId: joinChallenge tags: [challenges] summary: Join a challenge (auth required) parameters: - in: path name: slug required: true schema: { type: string } responses: "200": description: OK "401": description: Unauthorized /challenges/{slug}/leave: post: operationId: leaveChallenge tags: [challenges] summary: Leave a challenge (auth required) parameters: - in: path name: slug required: true schema: { type: string } responses: "200": description: OK "401": description: Unauthorized /challenges/{slug}/posts: post: operationId: postToChallenge tags: [challenges] summary: Post to the cohort feed (members only) parameters: - in: path name: slug required: true schema: { type: string } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ChallengePostInput" responses: "200": description: Created content: application/json: schema: type: object required: [post] properties: post: { $ref: "#/components/schemas/ChallengePost" } "401": description: Unauthorized "403": description: Not a member /dish-reviews: post: operationId: createDishReview tags: [reviews] summary: Submit a review for a dish (auth required) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DishReviewInput" responses: "200": description: Created "401": description: Unauthorized /dish-reviews/{slug}: get: operationId: listDishReviews tags: [reviews] summary: Public reviews and AI summary for a dish parameters: - in: path name: slug required: true schema: { type: string } responses: "200": description: Reviews /dish-reviews-mod: get: operationId: listReviewsForModeration tags: [reviews] summary: Catalog-scoped — list recent reviews including hidden responses: "200": description: Reviews "403": description: Catalog scope required /dish-reviews/{id}/hide: post: operationId: hideDishReview tags: [reviews] summary: Catalog-scoped — hide a review parameters: - in: path name: id required: true schema: { type: integer } responses: "200": description: Updated "403": description: Catalog scope required "404": description: Not found /dish-reviews/{id}/unhide: post: operationId: unhideDishReview tags: [reviews] summary: Catalog-scoped — unhide a review parameters: - in: path name: id required: true schema: { type: integer } responses: "200": description: Updated "403": description: Catalog scope required "404": description: Not found /team-profiles: get: operationId: listTeamProfiles tags: [team-profiles] summary: List published chef and RD profiles parameters: - in: query name: role schema: { type: string, enum: [chef, rd] } responses: "200": description: Team profiles content: application/json: schema: type: object required: [profiles] properties: profiles: type: array items: { $ref: "#/components/schemas/TeamProfile" } /team-profiles/{slug}: get: operationId: getTeamProfile tags: [team-profiles] summary: Get a chef or RD profile by slug, including owned dishes parameters: - in: path name: slug required: true schema: { type: string } responses: "200": description: Team profile content: application/json: schema: type: object required: [profile, ownedDishSlugs] properties: profile: { $ref: "#/components/schemas/TeamProfile" } ownedDishSlugs: type: array items: { type: string } "404": description: Not found /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /preferences: get: operationId: getPreferences tags: [preferences] summary: Get the signed-in user's preferences responses: "200": description: Current preferences (null when unset) content: application/json: schema: $ref: "#/components/schemas/PreferencesEnvelope" "401": description: Unauthorized put: operationId: putPreferences tags: [preferences] summary: Upsert preferences (partial) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PreferencesPatch" responses: "200": description: Updated preferences content: application/json: schema: $ref: "#/components/schemas/PreferencesEnvelopeRequired" "400": description: Invalid payload "401": description: Unauthorized patch: operationId: patchPreferences tags: [preferences] summary: Partial update of preferences requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PreferencesPatch" responses: "200": description: Updated preferences content: application/json: schema: $ref: "#/components/schemas/PreferencesEnvelopeRequired" "400": description: Invalid payload "401": description: Unauthorized /wellness/today: get: operationId: getWellnessToday tags: [wellness] summary: Get today's wellness summary (targets, totals, wearables, streaks) responses: "200": description: Today's wellness snapshot content: application/json: schema: $ref: "#/components/schemas/WellnessTodayEnvelope" "401": description: Unauthorized /wellness/wearable/connect: post: operationId: connectWearable tags: [wellness] summary: Mark a wearable provider as connected for the signed-in user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WearableConnectInput" responses: "200": description: Connected wearable link content: application/json: schema: $ref: "#/components/schemas/WearableLinkEnvelope" "400": description: Invalid payload "401": description: Unauthorized /wellness/wearable/disconnect: post: operationId: disconnectWearable tags: [wellness] summary: Mark a wearable provider as disconnected for the signed-in user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WearableConnectInput" responses: "200": description: Disconnect ok content: application/json: schema: $ref: "#/components/schemas/OkEnvelope" "400": description: Invalid payload "401": description: Unauthorized /wellness/wearable/sync: post: operationId: syncWearable tags: [wellness] summary: Push today's activity (steps + active kcal) from a wearable requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WearableSyncInput" responses: "200": description: Updated wearable link content: application/json: schema: $ref: "#/components/schemas/WearableLinkEnvelope" "400": description: Invalid payload "401": description: Unauthorized "409": description: Wearable not connected /rd-partners/events: post: operationId: trackRdPartnersEvent tags: [rd-partners] summary: Record a wizard funnel event requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RdPartnersEvent" responses: "200": description: Recorded content: application/json: schema: type: object required: [ok] properties: ok: { type: boolean } "400": description: Invalid payload "429": description: Too many events /rd-partners/whatsapp/send-otp: post: operationId: rdPartnersSendOtp tags: [rd-partners] summary: Send a WhatsApp verification code via Twilio Verify requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RdPartnersOtpSendRequest" responses: "200": description: Code sent (devCode echoed when no Twilio credentials are configured) content: application/json: schema: $ref: "#/components/schemas/RdPartnersOtpSendResponse" "400": description: Invalid phone "429": description: Too many requests /rd-partners/whatsapp/verify-otp: post: operationId: rdPartnersVerifyOtp tags: [rd-partners] summary: Verify a WhatsApp code and record a server-side proof requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RdPartnersOtpVerifyRequest" responses: "200": description: Verified content: application/json: schema: $ref: "#/components/schemas/RdPartnersOtpVerifyResponse" "400": description: Invalid code "429": description: Too many attempts /rd-partners/applications: post: operationId: rdPartnersSubmitApplication tags: [rd-partners] summary: Submit an RD partner / advisory application requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RdPartnersApplicationRequest" responses: "200": description: Application accepted content: application/json: schema: $ref: "#/components/schemas/RdPartnersApplicationResponse" "400": description: Invalid payload "409": description: Email already used "429": description: Too many submissions /rd-partners/applications/{id}/create-account: post: operationId: rdPartnersAttachAccount tags: [rd-partners] summary: Attach the signed-in user (and provision an RD seat for advisory paths) parameters: - in: path name: id required: true schema: { type: integer, minimum: 1 } responses: "200": description: Attached / provisioned content: application/json: schema: $ref: "#/components/schemas/RdPartnersAttachAccountResult" "401": description: Sign in required "403": description: Email mismatch with application "404": description: Application not found /admin/rd-applications: get: operationId: listAdminRdApplications tags: [rd-partners] summary: List RD applications for ops review parameters: - in: query name: status schema: type: string enum: [all, new, contacted, approved, rejected] default: all - in: query name: limit schema: { type: integer, minimum: 1, maximum: 200, default: 50 } responses: "200": description: Applications and per-status counts content: application/json: schema: $ref: "#/components/schemas/AdminRdApplicationsList" "403": description: Ops scope required /admin/rd-applications/{id}: patch: operationId: patchAdminRdApplication tags: [rd-partners] summary: Update an application's status / notes and optionally provision an RD seat parameters: - in: path name: id required: true schema: { type: integer, minimum: 1 } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AdminRdApplicationPatch" responses: "200": description: Updated row content: application/json: schema: $ref: "#/components/schemas/AdminRdApplicationPatchResult" "400": description: Invalid payload "403": description: Ops scope required "404": description: Application not found "409": description: rdSlug already claimed by another user "412": description: Provisioning requires a linked user account /dish-rationales: post: operationId: getDishRationales tags: [dish-rationales] summary: Batch-generate "why this meal" rationales for the signed-in user description: | Returns one rationale per requested dishId. Cached per (user, dish, brief-version) — only newly seen dishes (or dishes whose user brief moved) are sent to the model. On generation failure, a generic macro-based rationale is returned with source = "fallback". requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DishRationaleRequest" responses: "200": description: Rationales (one per requested dishId) content: application/json: schema: $ref: "#/components/schemas/DishRationaleEnvelope" "400": description: Invalid payload "401": description: Unauthorized /meal-plan-settings: get: operationId: getMealPlanSettings tags: [meal-plans] summary: Get the signed-in user's auto-replan + budget settings responses: "200": description: Settings content: application/json: schema: type: object required: [settings] properties: settings: $ref: "#/components/schemas/MealPlanSettings" "401": { description: Unauthorized } put: operationId: updateMealPlanSettings tags: [meal-plans] summary: Update the signed-in user's auto-replan + budget settings requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/MealPlanSettingsInput" responses: "200": description: Updated settings content: application/json: schema: type: object required: [settings] properties: settings: $ref: "#/components/schemas/MealPlanSettings" "400": { description: Invalid payload } "401": { description: Unauthorized } /meal-plans: get: operationId: listMealPlans tags: [meal-plans] summary: List the signed-in user's most recent meal plans responses: "200": description: Plans content: application/json: schema: type: object required: [plans] properties: plans: type: array items: { $ref: "#/components/schemas/MealPlan" } "401": { description: Unauthorized } /meal-plans/generate: post: operationId: generateMealPlan tags: [meal-plans] summary: Generate (or regenerate) a draft 7-day plan for a given week requestBody: required: false content: application/json: schema: $ref: "#/components/schemas/MealPlanGenerateRequest" responses: "201": description: Created draft plan content: application/json: schema: type: object required: [plan, usedFallback] properties: plan: { $ref: "#/components/schemas/MealPlan" } usedFallback: { type: boolean } "400": { description: Invalid payload } "401": { description: Unauthorized } /meal-plans/{id}: get: operationId: getMealPlan tags: [meal-plans] summary: Get a single meal plan by id parameters: - in: path name: id required: true schema: { type: integer, minimum: 1 } responses: "200": description: Plan content: application/json: schema: type: object required: [plan] properties: plan: { $ref: "#/components/schemas/MealPlan" } "401": { description: Unauthorized } "404": { description: Not found } /meal-plans/{id}/regenerate-day: post: operationId: regenerateMealPlanDay tags: [meal-plans] summary: Regenerate a single day in a draft plan parameters: - in: path name: id required: true schema: { type: integer, minimum: 1 } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegenerateMealPlanDayInput" responses: "200": description: Updated plan content: application/json: schema: type: object required: [plan] properties: plan: { $ref: "#/components/schemas/MealPlan" } "400": { description: Invalid payload } "401": { description: Unauthorized } "404": { description: Not found } "409": { description: Plan is not editable } /meal-plans/{id}/slot: patch: operationId: swapMealPlanSlot tags: [meal-plans] summary: Swap a single slot in a draft plan to a chosen dish parameters: - in: path name: id required: true schema: { type: integer, minimum: 1 } requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SwapMealPlanSlotInput" responses: "200": description: Updated plan content: application/json: schema: type: object required: [plan] properties: plan: { $ref: "#/components/schemas/MealPlan" } "400": { description: Invalid swap (allergen / repetition / unknown dish) } "401": { description: Unauthorized } "404": { description: Not found } "409": { description: Plan is not editable } /meal-plans/swap-suggestions: post: operationId: getMealPlanSwapSuggestions tags: [meal-plans] summary: List candidate dishes that could replace a given slot requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GetMealPlanSwapSuggestionsInput" responses: "200": description: Suggestions content: application/json: schema: type: object required: [suggestions] properties: suggestions: type: array items: { $ref: "#/components/schemas/MealPlanSlotEntry" } "400": { description: Invalid parameters } "401": { description: Unauthorized } "404": { description: Not found } /meal-plans/{id}/accept: post: operationId: acceptMealPlan tags: [meal-plans] summary: Accept a draft plan; attaches to active weekly subscription if any parameters: - in: path name: id required: true schema: { type: integer, minimum: 1 } responses: "200": description: Accepted plan content: application/json: schema: type: object required: [plan, subscriptionId, deliveryIds] properties: plan: { $ref: "#/components/schemas/MealPlan" } subscriptionId: type: integer nullable: true deliveryIds: type: array items: { type: integer } "400": { description: Plan no longer valid } "401": { description: Unauthorized } "404": { description: Not found } "409": { description: Plan is not draft } /meal-plans/{id}/discard: post: operationId: discardMealPlan tags: [meal-plans] summary: Discard a draft plan parameters: - in: path name: id required: true schema: { type: integer, minimum: 1 } responses: "200": description: Discarded content: application/json: schema: type: object required: [plan] properties: plan: { $ref: "#/components/schemas/MealPlan" } "401": { description: Unauthorized } "404": { description: Not found } "409": { description: Plan is not draft } components: parameters: # Server-managed idempotency. The client picks ONE url-safe token # per submit attempt and reuses it for every retry of THAT attempt # (network failure, 5xx, soft refresh). The server stores the first # response keyed by (user_id, key) for 24h and replays it byte-for- # byte on retries. Reusing the same key with a different request # body returns 409 idempotency_key_mismatch. IdempotencyKey: in: header name: Idempotency-Key required: true schema: type: string pattern: "^[A-Za-z0-9._\\-:]{8,128}$" description: | Required server-managed idempotency token. 8–128 characters, url-safe alphabet `[A-Za-z0-9._-:]`. Reuse the same value for every retry of the SAME submit attempt; pick a fresh value (e.g. crypto.randomUUID()) for each NEW user-initiated submit. securitySchemes: # Phone-OTP session — server reads the `sid` cookie set by # /auth/phone/verify-otp. sessionCookie: type: apiKey in: cookie name: sid description: | Phone-OTP session id. Set automatically by the server on /auth/phone/verify-otp. Sent on every same-origin request as an httpOnly cookie. Routes annotated "(auth required)" require a valid session. # Operator / RD admin static-token gate. Sent in the # `x-admin-token` request header for ops & catalog endpoints. adminToken: type: apiKey in: header name: x-admin-token description: | Operator-only static token for admin / catalog routes. Falls back to OPS_USER_IDS / CATALOG_USER_IDS allowlist matching when the caller has a valid session cookie. schemas: FinalizeOrderRequest: type: object required: [orderId, items] additionalProperties: true properties: orderId: { type: string, description: Client-generated order id } items: type: array items: type: object required: [id, name, qty, price] properties: id: { type: integer } name: { type: string } qty: { type: integer, minimum: 1 } price: { type: integer, description: Per-unit price in paise } applyCreditsPaise: { type: integer, nullable: true } scheduledFor: { type: string, format: date-time, nullable: true } bundleSlugs: { type: array, items: { type: string } } fulfillmentType: { type: string, enum: [delivery, pickup] } deliverySlotId: { type: integer, nullable: true } pickupLocationId: { type: integer, nullable: true } ecoPackagingOptIn: { type: boolean } deliveryInstructions: { type: string, nullable: true } OrderFinalizeResult: type: object required: [ok] additionalProperties: true properties: ok: { type: boolean } serverOrderId: { type: integer } finalTotalPaise: { type: integer } creditsRedeemedPaise: { type: integer } firstOrderDiscountPaise: { type: integer } referralAwarded: { type: boolean } FirstOrderOffer: type: object required: [eligible, percentBps, capPaise] properties: eligible: { type: boolean } percentBps: { type: integer, description: "Discount in basis points (2500 = 25%)" } capPaise: { type: integer, description: "Maximum discount in paise (8000 = Rs.80)" } MarketplaceCheckoutRequest: type: object required: [items, deliveryMode] properties: items: type: array minItems: 1 items: type: object required: [itemId, qty] properties: itemId: { type: integer } qty: { type: integer, minimum: 1 } deliveryMode: { type: string, enum: [ship, bundle_with_meal] } bundleWithOrderId: { type: integer, nullable: true } address: type: object properties: label: { type: string } line: { type: string } city: { type: string } pincode: { type: string } phone: { type: string } MarketplaceCheckoutResult: type: object required: [order] properties: order: type: object additionalProperties: true required: [id] properties: id: { type: integer } MealPlanSlot: type: string enum: [breakfast, lunch, dinner] MealPlanStatus: type: string enum: [draft, accepted, scheduled, discarded] MealPlanSlotEntry: type: object required: [dishId, slug, name, image, pricePaise, calories, protein, carbs, fat] properties: dishId: { type: integer } slug: { type: string } name: { type: string } image: { type: string } pricePaise: { type: integer } calories: { type: integer } protein: { type: integer } carbs: { type: integer } fat: { type: integer } MealPlanDay: type: object required: [date] properties: date: { type: string } breakfast: { $ref: "#/components/schemas/MealPlanSlotEntry" } lunch: { $ref: "#/components/schemas/MealPlanSlotEntry" } dinner: { $ref: "#/components/schemas/MealPlanSlotEntry" } WeekDayCalendarKind: type: string enum: [normal, gym, travel, wfh] MealPlanConstraints: type: object required: [maxRepetitionsPerDish, allergens] properties: dailyCalorieTarget: { type: integer, nullable: true } dailyProteinTargetGrams: { type: integer, nullable: true } weeklyBudgetPaise: { type: integer, nullable: true } maxRepetitionsPerDish: { type: integer } allergens: type: array items: { type: string } dietaryStyle: { type: string, nullable: true } spiceLevel: { type: string, nullable: true } goal: { type: string, nullable: true } weekCalendar: type: array minItems: 7 maxItems: 7 items: { $ref: "#/components/schemas/WeekDayCalendarKind" } MealPlanTotals: type: object required: [totalPaise, avgCalories, avgProteinGrams, avgCarbsGrams, avgFatGrams] properties: totalPaise: { type: integer } avgCalories: { type: integer } avgProteinGrams: { type: integer } avgCarbsGrams: { type: integer } avgFatGrams: { type: integer } MealPlan: type: object required: [id, userId, weekStartDate, status, constraints, days, createdAt, updatedAt] properties: id: { type: integer } userId: { type: string } weekStartDate: { type: string } status: { $ref: "#/components/schemas/MealPlanStatus" } constraints: { $ref: "#/components/schemas/MealPlanConstraints" } days: type: array items: { $ref: "#/components/schemas/MealPlanDay" } totals: oneOf: - { $ref: "#/components/schemas/MealPlanTotals" } - { type: "null" } subscriptionId: { type: integer, nullable: true } model: { type: string, nullable: true } notes: { type: string, nullable: true } acceptedAt: { type: string, format: date-time, nullable: true } createdAt: { type: string, format: date-time } updatedAt: { type: string, format: date-time } MealPlanGenerateRequest: type: object properties: weekStartDate: { type: string } overrides: type: object properties: weeklyBudgetPaise: { type: integer, nullable: true } maxRepetitionsPerDish: { type: integer, minimum: 1, maximum: 7 } dailyCalorieTarget: { type: integer, nullable: true } dailyProteinTargetGrams: { type: integer, nullable: true } weekCalendar: type: array minItems: 7 maxItems: 7 items: { $ref: "#/components/schemas/WeekDayCalendarKind" } MealPlanSettings: type: object required: [userId, autoReplanEnabled, maxRepetitionsPerDish] properties: userId: { type: string } autoReplanEnabled: { type: boolean } weeklyBudgetPaise: { type: integer, nullable: true } maxRepetitionsPerDish: { type: integer } lastPlannedWeekStart: { type: string, nullable: true } MealPlanSettingsInput: type: object properties: autoReplanEnabled: { type: boolean } weeklyBudgetPaise: { type: integer, nullable: true } maxRepetitionsPerDish: { type: integer, minimum: 1, maximum: 7 } RegenerateMealPlanDayInput: type: object required: [dayIndex] properties: dayIndex: { type: integer, minimum: 0, maximum: 6 } SwapMealPlanSlotInput: type: object required: [dayIndex, slot, dishId] properties: dayIndex: { type: integer, minimum: 0, maximum: 6 } slot: { $ref: "#/components/schemas/MealPlanSlot" } dishId: { type: integer, minimum: 1 } GetMealPlanSwapSuggestionsInput: type: object required: [planId, dayIndex, slot] properties: planId: { type: integer, minimum: 1 } dayIndex: { type: integer, minimum: 0, maximum: 6 } slot: { $ref: "#/components/schemas/MealPlanSlot" } DishRationaleRequest: type: object required: [dishIds] properties: dishIds: type: array minItems: 1 maxItems: 12 items: type: integer minimum: 1 DishRationaleSource: type: string enum: [cache, generated, fallback] DishRationale: type: object required: [dishId, rationale, expanded, source] properties: dishId: { type: integer } rationale: { type: string } expanded: { type: string } source: $ref: "#/components/schemas/DishRationaleSource" DishRationaleEnvelope: type: object required: [rationales] properties: rationales: type: array items: $ref: "#/components/schemas/DishRationale" HealthStatus: type: object properties: status: type: string required: - status DietaryStyle: type: string enum: [omnivore, vegetarian, vegan, pescatarian, keto] SpiceLevel: type: string enum: [none, mild, medium, hot] ActivityLevel: type: string enum: [sedentary, light, moderate, active, very_active] WellnessGoal: type: string enum: [lose_weight, maintain, gain_muscle, general_wellness] UserPreferences: type: object required: - userId - allergens - dislikedIngredients - cuisines - spiceLevel - dietaryStyle - goal - activityLevel - createdAt - updatedAt properties: userId: type: string allergens: type: array items: { type: string } dislikedIngredients: type: array items: { type: string } cuisines: type: array items: { type: string } spiceLevel: $ref: "#/components/schemas/SpiceLevel" dietaryStyle: $ref: "#/components/schemas/DietaryStyle" goal: $ref: "#/components/schemas/WellnessGoal" activityLevel: $ref: "#/components/schemas/ActivityLevel" calorieTarget: type: integer nullable: true minimum: 800 maximum: 6000 proteinTargetGrams: type: integer nullable: true minimum: 20 maximum: 400 carbsTargetGrams: type: integer nullable: true minimum: 0 maximum: 800 fatTargetGrams: type: integer nullable: true minimum: 0 maximum: 300 quizCompletedAt: type: string format: date-time nullable: true createdAt: type: string format: date-time updatedAt: type: string format: date-time PreferencesPatch: type: object properties: allergens: type: array items: { type: string, minLength: 1, maxLength: 64 } maxItems: 50 dislikedIngredients: type: array items: { type: string, minLength: 1, maxLength: 64 } maxItems: 50 cuisines: type: array items: { type: string, minLength: 1, maxLength: 64 } maxItems: 50 spiceLevel: $ref: "#/components/schemas/SpiceLevel" dietaryStyle: $ref: "#/components/schemas/DietaryStyle" goal: $ref: "#/components/schemas/WellnessGoal" activityLevel: $ref: "#/components/schemas/ActivityLevel" calorieTarget: type: integer nullable: true minimum: 800 maximum: 6000 proteinTargetGrams: type: integer nullable: true minimum: 20 maximum: 400 carbsTargetGrams: type: integer nullable: true minimum: 0 maximum: 800 fatTargetGrams: type: integer nullable: true minimum: 0 maximum: 300 markQuizComplete: type: boolean PreferencesEnvelope: type: object required: [preferences] properties: preferences: oneOf: - $ref: "#/components/schemas/UserPreferences" - type: "null" PreferencesEnvelopeRequired: type: object required: [preferences] properties: preferences: $ref: "#/components/schemas/UserPreferences" WearableProvider: type: string enum: [apple_health, google_fit] WearableConnectInput: type: object required: [provider] properties: provider: $ref: "#/components/schemas/WearableProvider" WearableSyncInput: type: object required: [provider, activityKcal] properties: provider: $ref: "#/components/schemas/WearableProvider" activityKcal: type: integer minimum: 0 maximum: 3000 steps: type: integer minimum: 0 maximum: 60000 WearableLink: type: object required: [id, userId, provider, connected] properties: id: type: string userId: type: string provider: $ref: "#/components/schemas/WearableProvider" connected: type: boolean lastSyncedAt: type: string format: date-time nullable: true lastActivityKcal: type: integer nullable: true lastSteps: type: integer nullable: true WearableLinkEnvelope: type: object required: [link] properties: link: $ref: "#/components/schemas/WearableLink" OkEnvelope: type: object required: [ok] properties: ok: type: boolean WellnessDailyTotals: type: object required: [date, calories, proteinGrams] properties: date: type: string calories: type: number proteinGrams: type: number carbsGrams: type: number fatGrams: type: number fiberGrams: type: number waterMl: type: number vegServings: type: number WellnessTargets: type: object required: [calorieTarget, proteinTargetGrams, effectiveCalorieTarget, activityKcal] properties: calorieTarget: type: integer proteinTargetGrams: type: integer fiberTargetGrams: type: integer waterTargetMl: type: integer vegTargetServings: type: integer effectiveCalorieTarget: type: integer activityKcal: type: integer WellnessTodayEnvelope: type: object required: [date, targets, totals, wearables] properties: date: type: string targets: $ref: "#/components/schemas/WellnessTargets" totals: $ref: "#/components/schemas/WellnessDailyTotals" wearables: type: array items: $ref: "#/components/schemas/WearableLink" Recipe: type: object required: [id, slug, title, summary, goalTags, dietTags, totalTimeMinutes, status] properties: id: { type: integer } slug: { type: string } title: { type: string } summary: { type: string } heroImageUrl: { type: string, nullable: true } authorName: { type: string, nullable: true } authorRole: { type: string, nullable: true } goalTags: type: array items: { type: string } dietTags: type: array items: { type: string } totalTimeMinutes: { type: integer } servings: { type: integer, nullable: true } ingredients: type: array items: type: object required: [text] properties: text: { type: string } steps: type: array items: { type: string } nutrition: type: object nullable: true properties: kcal: { type: number } proteinG: { type: number } carbsG: { type: number } fatG: { type: number } fiberG: { type: number } saturatedFatG: { type: number } sugarG: { type: number } sodiumMg: { type: number } allergens: type: array items: { type: string } sourcingNotes: type: array items: type: object required: [area, detail] properties: area: { type: string } detail: { type: string } micronutrients: type: array items: type: object required: [key, label, value, unit, dailyTargetPct] properties: key: { type: string } label: { type: string } value: { type: number } unit: { type: string } dailyTargetPct: { type: number } status: { type: string } TeamProfile: type: object required: [slug, name, role, title, bio, yearsExperience, initials, accent, credentials] properties: slug: { type: string } name: { type: string } role: { type: string, enum: [chef, rd] } title: { type: string } bio: { type: string } signatureLine: { type: string, nullable: true } yearsExperience: { type: integer } initials: { type: string } accent: { type: string, enum: [gold, sage, blue] } credentials: type: array items: { type: string } kitchens: type: array items: { type: string } lifestyles: type: array items: { type: string } Challenge: type: object required: [id, slug, title, summary, durationDays, status] properties: id: { type: integer } slug: { type: string } title: { type: string } summary: { type: string } heroImageUrl: { type: string, nullable: true } durationDays: { type: integer } startDate: { type: string, nullable: true } endDate: { type: string, nullable: true } bundleSlug: { type: string, nullable: true } rdName: { type: string, nullable: true } rdCheckinCadence: { type: string, nullable: true } memberCount: { type: integer } status: { type: string } ChallengePost: type: object required: [id, challengeId, body, createdAt] properties: id: { type: integer } challengeId: { type: integer } userId: { type: string, nullable: true } authorName: { type: string, nullable: true } body: { type: string } kind: { type: string, nullable: true } createdAt: { type: string } ChallengePostInput: type: object required: [body] properties: body: { type: string, minLength: 1, maxLength: 1000 } DishReviewInput: type: object required: [slug, rating] properties: slug: { type: string } rating: { type: integer, minimum: 1, maximum: 5 } body: { type: string, maxLength: 2000 } photoUrl: type: string format: uri maxLength: 1024 nullable: true RdPartnersEvent: type: object required: [sessionId, eventName] properties: sessionId: { type: string, minLength: 8, maxLength: 64 } eventName: { type: string, minLength: 2, maxLength: 64 } step: { type: integer, minimum: 0, maximum: 10 } applicationId: { type: integer, minimum: 1 } extra: type: object additionalProperties: true RdPartnersOtpSendRequest: type: object required: [countryCode, phone] properties: countryCode: { type: string, minLength: 2, maxLength: 8 } phone: { type: string, minLength: 5, maxLength: 20 } RdPartnersOtpSendResponse: type: object required: [ok] properties: ok: { type: boolean } devCode: type: string nullable: true description: Echoed only when no Twilio credentials are configured RdPartnersOtpVerifyRequest: type: object required: [countryCode, phone, code, sessionId] properties: countryCode: { type: string, minLength: 2, maxLength: 8 } phone: { type: string, minLength: 5, maxLength: 20 } code: { type: string, minLength: 4, maxLength: 10 } sessionId: { type: string, minLength: 8, maxLength: 64 } RdPartnersOtpVerifyResponse: type: object required: [ok] properties: ok: { type: boolean } e164: { type: string } RdPartnersWhatsApp: type: object required: [countryCode, phone] properties: countryCode: { type: string, minLength: 2, maxLength: 8 } phone: { type: string, minLength: 5, maxLength: 20 } RdPartnersApplicationRequest: type: object required: - path - fullName - email - credentials - yearsExperience - cityRegion - languages - practiceSetting - sessionId properties: path: type: string enum: [partner, advisory, both] fullName: { type: string, minLength: 2, maxLength: 200 } email: { type: string, format: email, maxLength: 200 } credentials: { type: string, minLength: 1, maxLength: 200 } registrationBody: type: string maxLength: 120 nullable: true registrationNumber: type: string maxLength: 80 nullable: true yearsExperience: { type: integer, minimum: 0, maximum: 80 } specializations: type: array items: { type: string, maxLength: 80 } cityRegion: { type: string, minLength: 2, maxLength: 200 } languages: type: array minItems: 1 items: { type: string, maxLength: 80 } practiceSetting: type: string enum: [solo, clinic, hospital, corporate, academia, online-only, other] clientVolumeBucket: type: string maxLength: 32 nullable: true interests: type: array items: { type: string, maxLength: 80 } bio: type: string maxLength: 4000 nullable: true whatsapp: $ref: "#/components/schemas/RdPartnersWhatsApp" whatsappOptIn: { type: boolean, default: false } notifyPref: type: string enum: [daily, weekly, critical] sessionId: { type: string, minLength: 8, maxLength: 64 } RdPartnersApplicationSummary: type: object required: [id, status, path, email] properties: id: { type: integer } status: type: string enum: [new, contacted, approved, rejected] path: type: string enum: [partner, advisory, both] email: { type: string } whatsappOptIn: { type: boolean } whatsappVerifiedAt: type: string format: date-time nullable: true RdPartnersApplicationResponse: type: object required: [application, notify] properties: application: $ref: "#/components/schemas/RdPartnersApplicationSummary" notify: type: object required: [delivered, channel] properties: delivered: { type: boolean } to: type: string nullable: true channel: type: string enum: [log, email] RdPartnersAttachAccountResult: type: object required: [ok] properties: ok: { type: boolean } linkedUserId: type: string nullable: true rdSlug: type: string nullable: true provisioned: { type: boolean } AdminRdApplicationStatusCount: type: object required: [status, n] properties: status: type: string enum: [new, contacted, approved, rejected] n: { type: integer, minimum: 0 } AdminRdApplicationsList: type: object required: [rows, counts] properties: rows: type: array items: type: object additionalProperties: true counts: type: array items: $ref: "#/components/schemas/AdminRdApplicationStatusCount" AdminRdApplicationPatch: type: object properties: status: type: string enum: [new, contacted, approved, rejected] adminNotes: type: string maxLength: 4000 provisionRdSlug: type: string maxLength: 64 pattern: "^[a-z0-9-]+$" AdminRdApplicationPatchResult: type: object required: [ok] properties: ok: { type: boolean } row: type: object additionalProperties: true