Only this pageAll pages
Powered by GitBook
1 of 8

Nutrition-AI Hub

Loading...

Mobile Application SDK

Loading...

REST API Guides

Loading...

Loading...

Loading...

Loading...

Food Database (REST API) Guide

Food search, nutrient details, voice or image meal logging, etc.

The documentation for the API guide is linked below.

*Note that you can ignore the authorization section of the linked documentation. Your token from will work.

Nutrition Hub Authorization

AI & Nutrition Advisor REST API

The documentation for using the nutrition advisor ai, and other related tools

The documentation for the advisor API guide is linked below.

Introduction

Nutrition Hub allows access to all nutrition-related services on a credit-usage basis

Welcome to Nutrition Hub!

Nutrition Hub is a comprehensive platform providing access to a wide range of nutritional data and services. With our industry-leading food recognition and nutrition tracking SDK, your team can effortlessly integrate real-time, on-device food recognition and hands-free food tracking functionality into mobile applications.

Below is a quick overview of the key capabilities enabled by our Nutrition-AI technology.

With a single API key, you gain access to multiple powerful APIs, including:

  • Food Database API: Detailed nutritional information for thousands of food items.

  • Nutrition Advisor API: AI-driven personalized nutrition advice.

  • Vision AI API: Image recognition for analyzing food items and extracting nutritional data.

  • Text AI API: text-based ai suggestions, meal log assist tools, recipe builder, similar item suggestions etc, tailored to a users profile

Credit-Based Usage

Nutrition Hub uses a credit-based system, where each API call consumes a specific number of tokens. Your subscription includes a certain number of tokens, allowing you to use the services as needed.

Explore the documentation to learn more about how to integrate and make the most out of Nutrition Hub's features.

*Note that you can ignore the authorization section of the linked documentation. Your token from will work.

Nutrition Hub Authorization

API Authorization & Setup

How to obtain your access token to authenticate your api calls

Authorization Guide

To use the Nutrition Hub APIs, you need to obtain a Bearer Token using your API key. Follow the steps below to authorize your API requests.

Obtain Bearer Token

Endpoint: POST

https://api.passiolife.com/v2/token-cache/unified/oauth/token/<YourKeyHere>

Path Parameters:

  • key: Your API or license key provided in your product dashboard.

Response Schema:

  • access_token (string): The Bearer Token you will use to authorize your API requests.

  • expires_in (number): Token expiration time in seconds.

  • scope (string): The scope of the token.

  • token_type (string): The type of the token, typically "Bearer".

Example Request:

POST
https://api.passiolife.com/v2/token-cache/unified/oauth/token/<YourKeyHere>

Example Response:

jsonCopy code{
  "access_token": "your_access_token_here",
  "expires_in": 3600,
  "scope": "read write",
  "token_type": "Bearer"
}

Using the Bearer Token

Include the access_token in the Authorization header for all your API requests. The only required header is the Authorization header with the Bearer token.

Example Authorization Header:

Authorization: Bearer your_access_token_here

Nutrition AI SDK Guide

Links to the documentation for using the nutrition ai sdk

Included in your Nutrition Hub products is the mobile application SDK. Simply follow the setup guide for the target operating system, and use your Nutrition Hub api key as its configuration.

Food Database Guide
Nutrition SDK Guide
Nutrition Advisor Guide

Token Usage & Response Headers

How tokens are used in API calls, and how to track their usage

Usage & Pricing

The API operates on a credit usage basis. Your subscription includes X million tokens. Each API call consumes tokens.

  • API Request:

  • Vision AI Request:

  • Text AI Request:

  • Chat Message Request:

Example Usage Tracking Headers Returned with Each API Response:

  • X-Budget-Cap: 12,000,000 (total tokens available in the current period)

  • X-Period-Usage: 494,188 (tokens used in the current period)

  • X-Request-Usage: 634 (tokens used by the current request)

Monitor these headers to track your API usage and avoid exceeding your token limit.

Dashboard

You can also see your total usage in your accounts portal dashboard for this product. This will display usage, % used and free, etc.

The dashboard also contains a section to show your usage in a few different breakdowns. It allows you to see number (total) and token usage (total) for requests of certain types (ai chat, api call, vision ai tools, etc) or by the API path that made the request (grouped after a certain level of path-specificity).