Whisk Docs
Whisk HomeHelp CenterDeveloper Tools
v2.0.0
v2.0.0
  • The Whisk Platform
  • Whisk API Overview
    • Introduction
    • Integration
    • Authentication
      • Server Token
      • User Access Token
        • Auth Flow Example
      • Client Token
      • Anonymous Access from Client Apps
    • Whisk Sandbox
    • Getting Started
  • Whisk API Reference 2.0
    • Provisioning
      • Get provisioning
    • Autocomplete
    • Community
      • Get your Communities
      • Get Communities from a Topic
      • Discover Recommended Communities
      • Search Communities
      • Get a Community
      • Get Recipes from a Community
      • Add Recipes to a Community
      • Remove a Recipe from a Community
      • Join a Community
      • Leave a Community
    • Posts and Reviews
      • Get reviews for a recipe
      • Create or edit review
      • Create a Post
      • Get Post by id
      • Delete a Post
      • Edit a Post
      • Report a Post
      • Create a Post Reply
      • Get Post Replies
      • Delete a Post reply
      • Report a Post reply
      • Like a Post or Reply
      • Users who liked a Post or Reply
    • Public profiles
      • Hide recipe in Public profile
      • Get Recipes for Public Profile
      • Get User's public profile by user_id
      • Get User's public profile by username
    • Custom Label
    • Feed
      • Obtain a Recipe Feed
    • Food DB
      • Autocomplete
      • Search
      • Get Food
    • Food List
    • Food Log
    • Foodpairing
    • Healthy meal recommendations
      • Healthy recipe only recommendations for DA
      • Recipe recommendations for SH
      • Tailored Plan API request for Samsung TV
    • Meal Plan
      • Generate a Meal Plan
      • Meal Object
        • Get Meals
        • Delete Meal
        • Add a Meal
      • Meal Plan Settings Object
        • Get Meal Plan Settings
        • Update Meal Plan Settings
      • Meal Plan Batch
    • Recipe
      • Get a Recipe
      • Search a Recipe
      • User Recipes & Collections
        • Add User Recipe
        • Create A Recipe
        • Update External Recipe
        • Get All User Recipes
        • Update User Recipe
        • Remove Recipe from Favorites
        • Create Collection
        • Get All User Collections
        • Get Collection
        • Get Recipes from a Collection
        • Remove Collection
        • Get Smart Collection
        • Get Recipes from a Smart Collection
    • Shopping List
      • Get your Shopping Lists
      • Get a Shopping List
      • Create a Shopping List
      • Delete a Shopping List
      • Update basic details of a Shopping List
      • Move Items between Shopping Lists
      • Add Items to a Shopping List
      • Delete an Item from a Shopping List
      • Update an Item in a Shopping List
      • Clear Items from a Shopping List
    • Media
    • Store Item
    • Unit Conversion
    • Users
      • Get a User
      • Update User Settings using Patch
      • Update User Settings using Post
    • Try it out!
  • Shopping List SDK
    • Overview
    • Examples
      • Shoppable Recipes
      • Shoppable Products
      • Shoppable Media
    • Basic Setup
      • Basic Setup
      • Methods
      • Event Listeners
      • Widget
      • Subscriptions
      • Global Configuration
      • UTM Parameters
      • Using With SPA
  • Shopping List Mobile API
    • Overview
    • Examples
    • Reference
  • API Resources
    • Authentication Scopes
    • Errors and Troubleshooting
    • Cursor Pagination
    • Limits
    • Nutrients
    • Recipe Labels
    • Filtering Recipes using Custom Labels
    • Health Score, Glycemic Index, Glycemic Load
    • Whisk User Data
    • Integrated Retailers
    • Optimizing Image Load
    • Meal Plan
Powered by GitBook
On this page
  • Generate a meal plan
  • Generate a specific meal plan

Was this helpful?

  1. Whisk API Reference 2.0
  2. Meal Plan

Generate a Meal Plan

PreviousMeal PlanNextMeal Object

Last updated 4 years ago

Was this helpful?

At any point in time, you can make adjustments to the meal plan settings and schedule, and replace your existing meal plan with a new one.

Note: To use the Whisk Meal Plan API, you must acquire a User Token. For more information, see .

The Meal Plan API provides you two endpoints that allow you to generate a meal plan. The only difference between the two is that one of them requires a {meal_plan_id} and the other doesn't. This arrangement has been made for a future planned feature of supporting multiple meal plans for every user.

While at the moment, since Whisk only supports a single meal plan per user, the {meal_plan_id} has been kept optional for both endpoints. You can leave it blank and it would be directly derived from the user token being used for API authentication.

Generate a meal plan

PUT https://api.whisk.com/mealplan/v2/generate

This endpoint allows you to regenerate a meal plan using the Body parameter.

Request Body

Name
Type
Description

body

object

This parameter allows you to specify the settings, schedule, and preferences for the new meal plan. For more information, see the Request Body Object Example below.

{
  "meal_plan_id": "5f27a59a9a8641078c7057eeec0a1b90",
  "start_date": 
    ...
  "end_date":
    ...
  "meals": [
    {
      "id": "894f285cd9d543d3b78b374f59b56311",
      "meal_type": "MEAL_TYPE_BREAKFAST",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 3,
      "date":
        ...
    },
    {
      "id": "aab8f93131724117836f8cab365518c6",
      "meal_type": "MEAL_TYPE_LUNCH",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 4,
      "date":
        ...
    },
    {
      "id": "4b50cf3d2bf24ebe9c4630d2816fea99",
      "meal_type": "MEAL_TYPE_DINNER",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 5,
      "date":
        ...
    },
    ...
  ],
  "result_code": "GENERATION_RESULT_CODE_SUCCESS"
}
{
  "error_code": "REAL_CODES_ARE_IN_ENDPOINT_DESCRIPTION",
  "message": "Additional details about error are not static and can be changed"
}
{
  "code": "auth.tokenNotFound"
}
This is unexpected response, something is wrong on our side, please contact: [email protected]

Generate a specific meal plan

PUT https://api.whisk.com/mealplan/v2/{meal_plan_id}/generate

This endpoint allows you to regenerate a meal plan using the meal_plan_id path parameter (currently optional) and the body parameter.

Path Parameters

Name
Type
Description

meal_plan_id

string

The meal plan identifier.

Request Body

Name
Type
Description

body

object

This parameter allows you to specify the settings, schedule, and preferences for the new meal plan. For more information, see the Request Body Object Example below.

{
  "meal_plan_id": "5f27a59a9a8641078c7057eeec0a1b90",
  "start_date": 
    ...
  "end_date":
    ...
  "meals": [
    {
      "id": "894f285cd9d543d3b78b374f59b56311",
      "meal_type": "MEAL_TYPE_BREAKFAST",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 3,
      "date":
        ...
    },
    {
      "id": "aab8f93131724117836f8cab365518c6",
      "meal_type": "MEAL_TYPE_LUNCH",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 4,
      "date":
        ...
    },
    {
      "id": "4b50cf3d2bf24ebe9c4630d2816fea99",
      "meal_type": "MEAL_TYPE_DINNER",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 5,
      "date":
        ...
    },
    ...
  ],
  "result_code": "GENERATION_RESULT_CODE_SUCCESS"
}
{
  "error_code": "REAL_CODES_ARE_IN_ENDPOINT_DESCRIPTION",
  "message": "Additional details about error are not static and can be changed"
}
{
  "code": "auth.tokenNotFound"
}
This is unexpected response, something is wrong on our side, please contact: [email protected]
{
  "meal_plan_id": "string",
  "settings": {
    ...
  },
  "period": {
    ...
  },
  "fields": [
    ...
  ]
}

The body object contains the following attributes and arrays that can be set to generate a meal plan for you:

Attribute

Type

Description

Example Value

meal_plan_id

string

The meal-plan identifier. You can skip it when using an Access Token for API authentication.

5f27a59a9a8641078c7057eeec0a1b90

settings

array

This includes all the core settings based on which you want to create your meal plan like - the number of servings, caloric goals, effective days, generation algorithm, food preferences, labels, etc.

period

array

The time period that the meal plan needs to cover.

"period": {

"from": {

"year": 2020,

"month": 10,

"day": 1

},

"to": {

"year": 2020,

"month": 10,

"day": 10

}

},

fields

string

Any additional recipe information you may want to include in your plan.

  • RECIPE_FIELD_NORMALIZED_INGREDIENTS

  • RECIPE_FIELD_INSTRUCTIONS

  • RECIPE_FIELD_NUTRITION

  • RECIPE_FIELD_INGREDIENTS_LINKED_PRODUCTS

curl -X POST "https://api.whisk.com/mealplan/v2/generate" 
     -H  "accept: application/json" 
     -H "Authorization: Token <Access-Token>" 
     -H  "Content-Type: application/json" 
     -d "{  \"settings\": {    \"servings\": 1,    \"calorie_per_day\": 2000,    \"enabled_auto_generation\": true,    \"replace_only_generated\": true  },  \"period\": {    \"from\": {      \"year\": 2020,      \"month\": 10,      \"day\": 1    },    \"to\": {      \"year\": 2020,      \"month\": 10,      \"day\": 10    }  },  \"fields\": [    \"RECIPE_FIELD_INVALID\"  ]}"

Note: Whisk provides its APIs on the Swagger interface for you to try it out. You can call this endpoint .

Note: Whisk provides its APIs on the Swagger interface to try and test. You can call this endpoint .

See .

User Access Tokens
here
here
Meal Plan Settings