NAV
json

Introduction

The Strongr Fastr for Professionals API allows enterprise users to programmatically create and deactivate clients in Strongr Fastr as well as get JSON formatted meal plans to display in your own frontend. If your business needs something more please contact philip@strongrfastr.com. The API is a work in progress and we're happy to help.

Authentication

Authenticate each request by setting the Authorization header of the request to your API key as follows:

Authorization: YOUR_API_KEY

If you are the primary owner of the account and your account has been activated for API access your API Key should be visible within the app under Menu > Account. To get activated for API access contact philip@strongrfastr.com.

Content Type

Requests to the API should have a JSON body and content-type (‘application/json’). All responses from the API will also have a JSON body and content-type.

Content-Type: application/json

Clients

Create a Client

Minimal create client request if delivering via PDF:

{  
    "user": {  
        "first_name": "John",  
        "last_name": "Smith"
    }  
}

Minimal create & invite a client if delivering via app/web:

{  
    "type": "invite",
    "user": {  
        "first_name": "John",  
        "last_name": "Smith",
        "email": "johnsmith@example.com"
  }  
}

If delivering via PDF: create & invite client and have them set up their own profile, meal plan preferences, and pick some initial recipes. Then generate and deliver them a meal plan:

{  
    "type": "invite",
    "user": {  
        "first_name": "John",  
        "last_name": "Smith",
        "email": "johnsmith@example.com",
        "setup_own_profile": true,
        "setup_own_mp_prefs": true,
        "can_pick_initial_recipes": true,
        "auto_deliver_mp_pdf": true
  }  
}

If deliver by app/web: create & invite client and have them set up their own profile, meal plan, and workouts:

{  
    "type": "invite",
    "user": {  
        "first_name": "John",  
        "last_name": "Smith",
        "email": "johnsmith@example.com",
        "setup_own_profile": true,
        "setup_own_mp_prefs": true,
        "pick_own_routine": true
  }  
}

Create client with basic profile:

{
   "type": "invite",
   "user": {
       "first_name": "Jane",
       "last_name": "Smith",
       "email": "johnsmith@example.com",
       "gender": 1,
       "age": 32,
       "foot_height": 5,
       "inch_height": 6,
       "current_weight": 149,
       "weight_goal": -1,
       "activity_level": 2
   }
}

Create client with basic profile & meal plan profile & generate first meal plan immediately (and email the client a PDF if delivering via PDF):

{
   "type": "create",
   "generate_meal_plan": true,
   "user": {
       "first_name": "Jane",
       "last_name": "Smith",
       "email": "jane@example.com", 
       "auto_deliver_mp_pdf": true,
       "gender": 1,
       "age": 32,
       "foot_height": 5,
       "inch_height": 6,
       "current_weight": 149,
       "weight_goal": -1,
       "activity_level": 2,
       "meal_plan_weekday": 2,
       "diet_type": 1,
       "budget": 3,
       "weekly_variety": 3,
       "complexity_preference": 3,
       "selected_meal_types": ["breakfast","lunch","dinner"]
   }
}

Create client with specific macro goals & food allergies:

{
   "user": {
       "first_name": "Aaardvark",
       "last_name": "Tom",
       "gender": 1,
       "age": 32,
       "foot_height": 5,
       "inch_height": 6,
       "current_weight": 149,
       "weight_goal": -1,
       "activity_level": 2,
       "meal_plan_weekday": 2,
       "diet_type": 1,
       "budget": 3,
       "weekly_variety": 3,
       "complexity_preference": 3,
       "selected_meal_types": ["breakfast","lunch","dinner"],
       "excluded_keywords": "dairy1,soy1,gluten1",
       "extra_keywords": "brussel sprouts,lima beans",
       "override_calories": true,
       "calorie_override": 2200,
       "fiber_goal": 25,
       "macro_parameters": [
           { "macro": "protein", "amount": 180, "unit_type": 0, "compare_type": "at_least" },
           { "macro": "carbs", "amount": 20, "unit_type": 1, "compare_type": "at_most" }
       ]
   }
}

This will create a lactose intolerant client (dairy1) who is also allergic to soy and gluten (soy1,gluten1) and does not want brussel sprouts or lima beans in their meal plan. They have a daily calorie goal of 2200 calories, a daily fiber goal of 25 grams, a daily protein goal of at least 180g, and a daily carbs goal of 20% or less.

This endpoint creates a new client.

HTTP Request

POST https://www.strongrfastr.com/en/api/v1/trainers/create_client

Request Body

Response

If the request succeeds the response will be an object with the following key/value pairs:

If the request fails, the response will be an object with an error message:

User Object

Basic Fields

When creating a client, if you provide a first_name, last_name, gender, age, height (foot_height/inch_height or metric_height), weight (current_weight or metric_weight), weight_goal, and activity_level, then the manual “Set Up Client” step can be skipped within the app.

Meal Plan Fields

If you provide meal_plan_weekday, diet_type, budget, weekly_variety, complexity_preference, and selected_meal_types then the manual meal plan settings setup step for the client can be skipped within the app.

Workout Plan Fields

Deactivate a Client

Minimal deactivate client request:

{  
    "client_id": 123456
}

This endpoint deactivates an existing client.

HTTP Request

POST https://www.strongrfastr.com/en/api/v1/trainers/deactivate_client

Request Body

Response

If the request succeeds the response will be an object with the following key/value pairs:

If the request fails, the response will be an object with an error message:

Reactivate a Client

Minimal reactivate client request:

{  
    "client_id": 123456
}

This endpoint reactivates an existing client.

HTTP Request

POST https://www.strongrfastr.com/en/api/v1/trainers/reactivate_client

Request Body

Response

If the request succeeds the response will be an object with the following key/value pairs:

If the request fails, the response will be an object with an error message:

Meal Plans

List meal plans

Example Response

{
    "user_id": 795326,
    "meal_plan_list": [
        {
            "id": 82,
            "week_start_date": "2567-07-26",
            "resolved_name": "Week 1",
            "published": true,
            "hidden": null
        },
        {
            "id": 83,
            "week_start_date": "2567-08-02",
            "resolved_name": "Week 2 - contest prep",
            "published": false,
            "hidden": null
        }
    ]
}

This endpoint will return metadata for all meal plans for a given client. The metadata includes the id of each meal plan which can be used to retrieve the full plan and its grocery list. The list will be sorted in ascending order of the "start date" of each meal plan.

HTTP Request

GET https://www.strongrfastr.com/en/api/v1/meal_plans/list

Request Body

Response

If the request succeeds the response will be a JSON object with the following key/value pairs:

Meal Plan Metadata Object

Each meal plan metadata object will have the following keys:

Get meal plan

Example get meal plan response:

{
  "meal_types": {
    "1": {
      "id": 1,
      "user_id": 10,
      "name": "Breakfast",
      "category": "breakfast"
    },
    "2": {
      "id": 2,
      "user_id": 10,
      "name": "Lunch",
      "category": "lunch"
    }
    // Additional meal types...
  },
  "user_meals": {
    "100": {
      "id": 100,
      "meal_type_id": 1,
      "date": "2024-05-01",
      "shared_meal_parent_id": null,
      "mini_profile_id": null,
      "uniq_key": "abc123"
    }
    // Additional user meals...
  },
  "recipe_meals": {
    "1000": {
      "id": 1000,
      "user_meal_id": 100,
      "recipe_id": 500,
      "servings": 2,
      "main_dish": true
    }
    // Additional recipe meals...
  },
  "recipes": {
    "500": {
      "name": "Oatmeal Pancakes",
      "instructions": "Mix ingredients. \nCook on a skillet.",
      "servings": 4,
      "calories": 350,
      "protein": 10,
      "carbs": 50,
      "fat": 12,
      "fiber": 5,
      "alcohol": 0,
      "active_time": 15,
      "cook_time": 20,
      "serving_name": "pancake",
      "count_per_serving": 2,
      "image": { 
        "url": "https://www.strongrfastr.com/images/oatmeal_pancakes.jpg", 
        "thumb": { "url": "https://www.strongrfastr.com/images/oatmeal_pancakes_thumb.jpg" },
        "medium_thumb": { "url": "https://www.strongrfastr.com/images/oatmeal_pancakes_medium_thumb.jpg" }
      }
    }
    // Additional recipes...
  },
  "ingredients": {
    "2000": {
      "id": 2000,
      "recipe_id": 500,
      "food_weight_id": 300,
      "amount": 1.5,
      "modifier": "chopped",
      "optional": false
    }
    // Additional ingredients...
  },
  "food_weights": {
    "300": {
      "id": 300,
      "food_id": 400,
      "measurement": "cups",
      "grams": 150,
      "hidden": false
    }
    // Additional food weights...
  },
  "foods": {
    "400": {
      "id": 400,
      "long_description": "Whole grain rolled oats",
      "short_description": "WHL GRN RLD OATS",
      "common_name": "rolled oats",
      "is_liquid": false
    }
    // Additional foods...
  },
  "mini_profiles": {
    "5": {
      "id": 5,
      "user_id": 10,
      "name": "John"
    }
    // Additional mini profiles...
  }
}

This endpoint retrieves all data for a specific meal plan identified by its id for a given client. The response is a normalized JSON object that includes comprehensive information about all meals, recipes, foods in the meal plan.

Meal plans are represented by many types of interrelated objects, below is an entity relationship diagram illustrating the general structure of a meal plan. Find more information about each type of object in the Response Object Definitions section.

Entity Relationship Diagram

HTTP Request

GET https://www.strongrfastr.com/en/api/v1/meal_plans/get

Request Body

Response

If the request succeeds, the response will be a JSON object containing the following key/value pairs:

Response Object Definitions

Meal Type Object

A Meal Type object represents a type of meal, either breakfast, lunch, dinner, or snack for the user that owns the meal type. Meals (i.e. User Meals) are assigned to a meal type and a date which determines their position in a plan.

Mini Profile Object

A Mini Profile represents a family member with whom meals on a meal plan might be shared.

User Meal Object

A User Meal object is the top-level object representing each meal on a plan. It is made up of 1 or more child Recipe Meal objects that define a recipe and number of servings of that recipe to be eaten. Broadly there are two types of User Meals:

Regular user meals - these are directly scheduled on the plan for the client with a date and a Meal Type. They are the meals the client themselves will be eating.

Shared user meals - these represent meals that will be eaten by the user/client's family members. They don't have a date or Meal Type, instead they point to a parent regular User Meal via the shared_meal_parent_id foreign key. They also point to the "family member" (Mini Profile) to whom they belong via the mini_profile_id foreign key.

Recipe Meal Object

Recipe Meal objects are the children of a User Meal object that define a recipe and number of servings of a recipe to be eaten.

Recipe Object

The Recipe object represents an unscaled recipe. A recipe has many Ingredient children that define the foods and quantities of those foods in the recipe. A single recipe can be present in many Recipe Meals throughout the plan and when appropriate (most of the time) ingedient quantities should be scaled by the number of servings being used. Note that many "recipes" are actually just single food items like an Apple, so instructions may not be present for all recipes:

Ingredient Object

An Ingredient object belongs to a recipe and defines the amount of a food to be included in the parent recipe. Ingredients don't point directly to Foods, however. Instead they point to a Food Weight and define an amount of that food measurement to be used. For example, an ingredient might have an "amount" of 3 and point to a food weight that represents a cup of diced chicken breast, which means the parent recipe has 3 cups of diced chicken breast.

Food Weight Object

A Food Weight represents a specific measurement of a food and its weight in grams. For example, the Food almonds might have food weights for a cup, a single almond, an ounce, a gram, etc. A food weight belongs to a single food, but it can be used by many ingredients.

Food Object

A Food object represents a food item like apples, salt, chicken, ground beef, etc. Every food item has 1 or more Food Weights.

Get grocery list

Example Response

{
    "grocery_list": {
        "start_date": "2567-07-26",
        "needed": [
            {
                "name": "Beverages",
                "grocery_items": [
                    {
                        "recipe_meal_ids": [
                            45490308,
                            45490310,
                            45490312,
                            45490314,
                            45490316,
                            45490318
                        ],
                        "food_weight_id": 15975,
                        "food_id": 14066,
                        "amount": 0.24
                    },
                    {
                        "recipe_meal_ids": [
                            45490308,
                            45490310,
                            45490312,
                            45490343,
                            45490346,
                            45490349,
                            45490352
                        ],
                        "food_weight_id": 15537,
                        "food_id": 93634,
                        "amount": 8.33
                    }
                ]
            },
            {
                "name": "Nut and Seed Products",
                "grocery_items": [
                    {
                        "recipe_meal_ids": [
                            45490307,
                            45490309,
                            45490311,
                            45490313,
                            45490315,
                            45490317
                        ],
                        "food_weight_id": 6827,
                        "food_id": 12061,
                        "amount": 3.35
                    },
                    {
                        "recipe_meal_ids": [
                            45490313,
                            45490315,
                            45490317
                        ],
                        "food_weight_id": 6966,
                        "food_id": 12195,
                        "amount": 2.0
                    },
                    {
                        "recipe_meal_ids": [
                            45490356,
                            45490358,
                            45490360,
                            45490362
                        ],
                        "food_weight_id": 16153,
                        "food_id": 12036,
                        "amount": 5.0
                    }
                ]
            }
            // Additional categories...
        ],
        "bought": []
    }
}

This endpoint retrieves the grocery list associated with a specific meal plan for a given client. The response provides detailed information about the required grocery items, categorized by their respective food groups, along with any items that have already been purchased.

HTTP Request

GET https://www.strongrfastr.com/en/api/v1/meal_plans/get_grocery_list

Request Body

Response

If the request succeeds, the response will be a JSON object containing the following key/value pairs:

Response Object Definitions

Grocery List Object

The Grocery List object includes the following attributes:

Category Object

Each Category object includes the following attributes:

Grocery Item Object

Each Grocery Item object includes the following attributes: