Technical Docs
Search…
⌃K

Getting Started

This guide will help you to start using the Suggestic API

Introduction

Suggestic application uses Graphql query language and the GraphQL Playground, as a graphical, interactive, in-browser GraphQL IDE, to allow users to execute queries and mutations according to their needs. It can be also accessed through PHP and Python code as well as curl scripts.
To use Suggestic API, please follow the steps on the sections below:

Before you start

  1. 1.
    Get your API access key and user ID to prepare your workspace
    a. If you don't have your API keys yet, get a 30-day free trial on our website.
After completing the registration, the following information will display, in which you have 3 options to start using the Suggestic API
An email, with the Token and User Id information, will be sent:

​

b. Depending on your case, review if the authentication you are using fits your requirements.
2. Check the Quickstart tutorial section to start using the Graphql playground to execute queries and mutations

Environment

Suggestic provides an environment where you can run and test the API.
Name
URL
Production
https://production.suggestic.com/graphql

Quickstart tutorial

Prepared GraphQL Playground examples

Use these prepared examples to start executing queries and mutations. The examples are separated into tabs as in the image below::
Copy the Token and User ID received in the email and paste them into the HTTP headers.
The order of implementation should be:
Finally,
Note: Use the User List mutation to get the user ID, it will be used later to execute queries and mutations.
Please note that every time you make a call to the API you will be doing it "on behalf" of a user.

Additional Examples.

1. Assign a program to the user recently created a. Before getting the list of available programs, it is required to get the user id as was mentioned before. Therefore, introduce the databaseID field in the mutation as it is displayed below:
Mutation
Response
{
users {
edges {
node {
name
phone
email
databaseId
}
}
}
}
{
"data": {
"users": {
"edges": [
{
"node": {
"name": "Sara",
"phone": "",
"email": "[email protected]",
"databaseId": "a1c5c9f7-acfb-451d-83f9-6226f174504b"
}
}
]
}
}
}
b. Obtain a list of all available diets and programs by using the following code:
Query
Response
{
programs {
edges {
node {
id
databaseId
name
author
}
}
}
}
{
"data": {
"programs": {
"edges": [
{
"node": {
"id": "UHJvZ3JhbTo0OTYxMTg1Ny1hZjk3LTRmZjktOWY1OS04ZTc2Mzk2MGUwODE=",
"databaseId": "49611857-af97-4ff9-9f59-8e763960e081",
"name": "Immunity Boost Program",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTowMWJiZDU0MS05MzliLTRiODUtOGQ5MC00OGZmMGIwMmQwZWU=",
"databaseId": "01bbd541-939b-4b85-8d90-48ff0b02d0ee",
"name": "Wheat Belly 10-Day Grain Detox",
"author": "Dr. William Davis"
}
},
{
"node": {
"id": "UHJvZ3JhbTo4ZDE0NTFjNC0xNGRkLTRkNzItODYxOS0zM2ZhYjI0ODkyNWQ=",
"databaseId": "8d1451c4-14dd-4d72-8619-33fab248925d",
"name": "Low Carb Mediterranean Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTo4NTE1MjE2Zi01YmRkLTQzYzUtOGUyNi04Yzg0N2I5MTBjMGY=",
"databaseId": "8515216f-5bdd-43c5-8e26-8c847b910c0f",
"name": "21-Day Inflammation Solution",
"author": "Dr. Mark Menolascino"
}
},
{
"node": {
"id": "UHJvZ3JhbTowNzRjN2I4Ni0wNTdjLTRkNDctOGY0Yi03ZjQzMzljOGQxZjQ=",
"databaseId": "074c7b86-057c-4d47-8f4b-7f4339c8d1f4",
"name": "Healing Foods 28-Day Reset",
"author": "Dr. Michael Murray"
}
},
{
"node": {
"id": "UHJvZ3JhbToxMDFhOTI4MS1lZGQ3LTQwOTgtYjQ0ZS01NzkyMzRmZDI2ZDE=",
"databaseId": "101a9281-edd7-4098-b44e-579234fd26d1",
"name": "Keto Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTpiZWE5ZjM0MS0yYTI1LTQwZmMtOWNlNC01MTViMzNmMjQ1OTI=",
"databaseId": "bea9f341-2a25-40fc-9ce4-515b33f24592",
"name": "Dr. Jockers' Keto Challenge",
"author": "Dr. David Jockers"
}
},
{
"node": {
"id": "UHJvZ3JhbTo0NjQ3NzQxNy1kYzRlLTQyNWMtYjNhOS1mMmJjOWIxMjkxMDI=",
"databaseId": "46477417-dc4e-425c-b3a9-f2bc9b129102",
"name": "Anti-Inflammatory Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTozYjdlNDIwYy0zMTBhLTRiZjctYjVmMS0xNDkwM2MwOTE4NTA=",
"databaseId": "3b7e420c-310a-4bf7-b5f1-14903c091850",
"name": "21-Day Vegan Reset",
"author": "Dr. Joel Kahn"
}
},
{
"node": {
"id": "UHJvZ3JhbTowYWQ0ZTc3YS04ZWRhLTRlOWItYWM4ZS0xYzg0YTJlOGJiNDI=",
"databaseId": "0ad4e77a-8eda-4e9b-ac8e-1c84a2e8bb42",
"name": "Balanced Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTphOWRlOGQyMy1kMzM3LTQwOWQtYjllZC1jZTQ0OTIwNzcwNWI=",
"databaseId": "a9de8d23-d337-409d-b9ed-ce449207705b",
"name": "No Grain, No Pain 30-Day Diet",
"author": "Dr. Peter Osborne"
}
},
{
"node": {
"id": "UHJvZ3JhbTpiMzBjZjAyYS03MjE1LTRjMjUtOTZiZS02YjA0N2MyNTMzOGU=",
"databaseId": "b30cf02a-7215-4c25-96be-6b047c25338e",
"name": "Low FODMAP Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTo5OWNjODk5Ny1lYzUyLTQ1NDgtYTc1My0zZWI0MWZkN2QxNzk=",
"databaseId": "99cc8997-ec52-4548-a753-3eb41fd7d179",
"name": "28-Day Metabolic Reset",
"author": "Dr. Brian Mowll"
}
},
{
"node": {
"id": "UHJvZ3JhbToyOGY2YmNiMi1lMmJmLTQ2YjEtYTViZS02N2ViYzg0NTFmZTA=",
"databaseId": "28f6bcb2-e2bf-46b1-a5be-67ebc8451fe0",
"name": "DASH Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTpiNjU3MGUwMC02MTgwLTQxNTgtYTZjZC02NDU0YTA3NTg1MTU=",
"databaseId": "b6570e00-6180-4158-a6cd-6454a0758515",
"name": "SIBO Soothe and Manage Program",
"author": "Kristy Regan"
}
},
{
"node": {
"id": "UHJvZ3JhbTo1NzRjYmJjZC0zOTEzLTRjODItODM2ZC0yYWExNDQwYmY4MTA=",
"databaseId": "574cbbcd-3913-4c82-836d-2aa1440bf810",
"name": "Paleo Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbToyMGFkMjAyMS1kNjhkLTQ4MzQtYjhmNC1lNDk3NTI0Yjk5ZDY=",
"databaseId": "20ad2021-d68d-4834-b8f4-e497524b99d6",
"name": "Auto-Immune Paleo Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTo0NjQ5Y2EzNi1jZTFmLTRmNGItYmU0Zi0yYWJmZDM3MWVjOTY=",
"databaseId": "4649ca36-ce1f-4f4b-be4f-2abfd371ec96",
"name": "21-Day Bone Broth Diet",
"author": "Dr. Kellyann Petrucci"
}
},
{
"node": {
"id": "UHJvZ3JhbToyYjk3N2JhYy1kMTE5LTRiNmMtYjMxMC1lNTEyMjk4ODExNWU=",
"databaseId": "2b977bac-d119-4b6c-b310-e5122988115e",
"name": "Vegan Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTpiMGU3ZGRlNy0zZDMzLTRiMDctOGE2Yi0wZjcyN2JiMDUzMzU=",
"databaseId": "b0e7dde7-3d33-4b07-8a6b-0f727bb05335",
"name": "21-Day Healthy Gut Jumpstart",
"author": "Dr. John Dempster"
}
},
{
"node": {
"id": "UHJvZ3JhbTo2NmVmYTkyMi02ZWJjLTRmNTUtYTk3ZS01NWEzYTUwZDIxMDY=",
"databaseId": "66efa922-6ebc-4f55-a97e-55a3a50d2106",
"name": "Mediterranean Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTpmNmE3NmEwMC1kMGVmLTQ4MzgtYTcwNy03ZjkwYmM3MDQ3Zjc=",
"databaseId": "f6a76a00-d0ef-4838-a707-7f90bc7047f7",
"name": "3 Weeks to Clearer Skin",
"author": "Kylene Terhune"
}
},
{
"node": {
"id": "UHJvZ3JhbTpmNDlmM2Y0YS0yNTM0LTRkNDItYjA4NS01NDNkMGQ5MDNmYjA=",
"databaseId": "f49f3f4a-2534-4d42-b085-543d0d903fb0",
"name": "Diabetes Prevention Program",
"author": "Centers for Disease Control"
}
},
{
"node": {
"id": "UHJvZ3JhbTo4ZThiOGMxYy1iNTQ4LTQ2MDItODFlNS03NzZlOTY3MmI1Y2Q=",
"databaseId": "8e8b8c1c-b548-4602-81e5-776e9672b5cd",
"name": "80/20 Plan",
"author": "Dr. Kellyann Petrucci"
}
},
{
"node": {
"id": "UHJvZ3JhbTo3MzlkMWI0MC1lMDdjLTQ1MzktOGRkMS03NGRlMzNjZGYxMjg=",
"databaseId": "739d1b40-e07c-4539-8dd1-74de33cdf128",
"name": "Vegetarian Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTplYTU5MTAyYS01YzRlLTQyNTYtOTIzZC1iYmI2YTFkYjQwNWI=",
"databaseId": "ea59102a-5c4e-4256-923d-bbb6a1db405b",
"name": "Dr. Hyman's Pegan Diet",
"author": "Dr. Mark Hyman"
}
},
{
"node": {
"id": "UHJvZ3JhbTpiZmE2NGYyNC02YmU4LTRmNTctYjFmMC02NmRjMGRlY2ZmY2E=",
"databaseId": "bfa64f24-6be8-4f57-b1f0-66dc0decffca",
"name": "Pescetarian Diet",
"author": "Suggestic"
}
},
{
"node": {
"id": "UHJvZ3JhbTplY2VjNjg3Ni1iZmVjLTQyYjEtYTYwZS04NmY3Zjc1Nzc1YzM=",
"databaseId": "ecec6876-bfec-42b1-a60e-86f7f75775c3",
"name": "Cardiometabolic Food Plan",
"author": "The Institute for Functional Medicine"
}
},
{
"node": {
"id": "UHJvZ3JhbTplZmI3MTExYS0xNTgxLTQ1YjEtODA1OC1jNGIyOGUxZTEwMTA=",
"databaseId": "efb7111a-1581-45b1-8058-c4b28e1e1010",
"name": "28-Day Living in Reverse",
"author": "Dr. Ted Schierer"
}
}
]
}
}
}
Add the above code into the GraphQL playground. The list of all available programs is displayed:
c. Assign the user recently created to a program
Note: Since a specific user will be added to a program list, the User Id is required to be added in the HTTP headers as sg-user
From the response obtained in the list of programs, copy the program id to be assigned to the user.
For example, the following id will be used:
UHJvZ3JhbTowMWJiZDU0MS05MzliLTRiODUtOGQ5MC00OGZmMGIwMmQwZWU=
Replace the id in the following code:
Mutation
Second Tab
mutation {
updateUserProgram(
programId: "UHJvZ3JhbTowMWJiZDU0MS05MzliLTRiODUtOGQ5MC00OGZmMGIwMmQwZWU="
) {
success
}
}
​
Then add the user Id in the HTTP Headers:
"sg-user": "a1c5c9f7-acfb-451d-83f9-6226f174504b"
Finally, the response within the GraphQL will be as follows:
c. Read more about programs here​
3. Optional a. Set the user's food preferences and restrictions b. Configure the user's meal plan settings​
4. Get personalized suggestions for that user - Get personalized recipe suggestions - Get a meal plan​

Additional information

To execute queries and mutations it is required to include the following headers:
{
"Authorization": "Token replace_user_token",
"sg-user": "replace_user_id"
}
However not all the mutations and queries require the use of both headers. As follows, find the list of the endpoints that does not required the sg-user header:
Mutations
  • Createuser
  • loginUser
  • requestResetPassword
  • resetPassword
  • generateMagicLink
  • createMealPlanTemplate
  • updateMealPlanTemplate
  • duplicateMealPlanTemplate
  • setMealPlanToTemplate
  • purchaseMealRecipe
  • updateSubscription
Queries
  • contentLibrary*
  • users programs*
  • restrictions*
  • mealPlanTemplates
  • foodLogsByUser
  • searchProfile labTestReports*
  • recommendedSwaps*
  • recipesByMealTime*
The ones marked with an asterisk (*) work with or without the sg-user header.

Documentation organization

Suggestic documentation has been divided into sections to help you find what you are looking for easily. Below, you can see how our documents are divided and organized:
  • CHANGELOG: Find the latest changes added in the application and documentation.
  • HELPFUL RESOURCES: Get started with the following useful resources:
    • Glossary: Find and familiarize yourself with the terms used through the API documentation.
    • FAQ: Find the common questions asked by our customers.
    • Integrations: Learn how to integrate our API solution with different applications.
  • GRAPHQL: Find how-to guides from how to Authenticate, get the API key to how to use the GraphQL playground.
  • SUGGESTIC API: Find the Suggestic API endpoints with examples ordered by:
    • Searches
    • Queries
    • Mutations.
  • OBJECTS: Find objects information and examples regarding nutrients, meal times, recipes, calories, meal plan, food logs, etc.
  • SUBSCRIPTION MANAGEMENT: Find information and examples about how to manage users' subscriptions.

Troubleshooting and support

Debugging an error? Have a question? Contact us by sending an email to [email protected]​

How to keep updated?

Check out our changelog to see the recent changes that we've made to the Suggestic API.