Trustwell's NutriLive | Realtime Nutrition & Label Intelligence

Trustwell's NutriLive | Realtime Nutrition & Label Intelligence

Overview

Trustwell's Realtime Nutritional API is a white-label, real-time nutrition calculation engine intended to power consumer-facing applications. It supports live recalculation as end users add, remove, or adjust ingredient quantities, and it can produce label data outputs for finalized recipes/products. The API is optimized for high-volume consumer traffic with sub-second response times.

Environments & Interactive Tools

Explorer UI

Preview: https://nutritional-api-preview.trustwell.com/

Production: https://nutritional-api.trustwell.com/

API Documentation (Swagger)

Preview: https://nutritional-api-preview.trustwell.com/docs

Production: https://nutritional-api.trustwell.com/docs

Authentication

All requests require an API Key provided in the header:

X-API-Key: <your_api_key>

API Keys authenticate requests and are used for usage aggregation and billing.

Obtaining Your API Key (via Genesis Foods)

Only Administrators with API Access can generate API Keys.

  1. Log into the Genesis Foods application.

  2. In the lower left, click the vertical ellipsis next to your Organization Name / Username.

  3. Select Profile.

  4. Select API Tokens along the top.

  5. Click Create API Token.

  6. Enter a Label (a friendly name to identify the token’s intended use).

  7. Click Create Token.

  8. Copy and securely store the token.

Important

  • This is the only time the full token will be shown. If it is lost or compromised you will need to delete it and create a new one.

  • Preserve this token as you would other secrets/passwords.

Performance Expectations

Latency

The API is designed for sub-second response times under normal operating conditions. In consumer-facing ingredient adjustment workflows, clients should plan for frequent calls and rely on the response to drive immediate UI updates.

Rate Limits (Unless Otherwise Contracted)

Default limits are:

  • 10 requests per second per customer tenant

  • Enforced on a rolling per-minute window

  • Bursting is permitted for short periods, and a grace period is applied to accommodate brief spikes

If you anticipate sustained higher throughput (e.g., high concurrency or elevated consumer traffic), contact Trustwell to discuss contracted limits.

Security Best Practices

Do not expose API Keys in client applications

API Keys must not be embedded in mobile apps, web apps, or other distributed client code where they can be extracted. Instead, route requests through your own middleware/service layer that holds the API Key securely.

Recommended pattern

  • Client app sends ingredient adjustments / recipe selections to your middleware.

  • Middleware calls the Nutritional API using the API Key.

  • Middleware returns results to the client.

This reduces the risk of credential leakage and enables additional controls (rate limiting, caching, auditing, anomaly detection).

Endpoint Summary

Realtime Nutrition Calculator

POST /api/v1/calculator | Calculate Nutrition

This endpoint performs real-time nutritional recalculation for a set of food items with quantities. It is intended for interactive consumer experiences where a user adjusts ingredient amounts and expects immediate nutritional updates. The response returns a normalized nutrient list and includes ingredient and allergen statements suitable for display.

Request Body: CalculatorRequest

{ "foodItems": [ { "foodId": "string", "amount": { "unitId": "string", "quantity": "string" } } ] }

Request Fields:

  • foodItems (array, required): Array of food items

    • foodId (string, required): Unique identifier for the food item

    • amount (object, required): Amount information

      • unitId (string, required): Unit identifier (e.g., "a7df0af5-0005-0000-7484-751e8eaf05c6" for "Each")

      • quantity (string, required): Quantity value (e.g., "1", "0.5", "1.5")

Response: CalculatorResponse

Status Code: 200 OK

{ "nutrients": [ { "nutrientId": "string", "nutrientName": "string", "unitId": "string", "unitName": "string", "value": 0 } ], "ingredientStatement": { "english": "string", "spanish": "string" }, "allergenStatement": { "english": { "statement": "string", "voluntaryStatement": "string" }, "spanish": { "statement": "string", "voluntaryStatement": "string" } } }

Response Fields:

  • nutrients (array): Array of normalized nutrient information

    • nutrientId (string): Nutrient UUID

    • nutrientName (string): Human-readable nutrient name

    • unitId (string): Unit UUID

    • unitName (string): Human-readable unit name

    • value (number): Nutrient value

  • ingredientStatement (object): Ingredient statements in multiple languages

    • english (string): English ingredient statement

    • spanish (string): Spanish ingredient statement

  • allergenStatement (object): Allergen statements in multiple languages

    • english (object): English allergen statements

      • statement (string): Main allergen statement

      • voluntaryStatement (string): Voluntary allergen statement

    • spanish (object): Spanish allergen statements

      • statement (string): Main allergen statement

      • voluntaryStatement (string): Voluntary allergen statement

cURL Example

curl -X POST https://[HOST]/api/v1/calculator \ -H "Content-Type: application/json" \ -d '{ "foodItems": [ { "foodId": "c1af9f46-9335-4657-978f-7d2241aea888", "amount": { "unitId": "a7df0af5-0005-0000-7484-751e8eaf05c6", "quantity": "1" } }, { "foodId": "7201450b-875a-4a67-b3bd-caa7757ffb54", "amount": { "unitId": "a7df0af5-0005-0000-7484-751e8eaf05c6", "quantity": "1" } } ] }'

Error Responses

400 BAD REQUEST: Invalid request format or missing required fields

{ "detail": "Validation error message" }

500 INTERNAL SERVER ERROR: Server error during processing

{ "detail": "Internal server error: error message" }

Notes

  • The API normalizes nutrient quantities into a consistent catalog (IDs, names, units) to support stable downstream rendering and analytics - negating the need to make constant calls into the metadata endpoint.

  • Clients should treat this endpoint as the primary “live update” engine and call it as users change configuration (within rate limits).

Nutritional Label

POST /api/v1/calculator/label | Get Label

This endpoint returns nutritional label data for a single recipe. It is intended for “finalized” or “summary” experiences where the consumer wants a complete nutritional profile, or where downstream systems need a label-ready nutrient set aligned to a specific regulation.

Request Body: LabelRequest

{ "foodId": "string", "regulation": "UnitedStates2016" }

Request Fields:

  • foodId (string, required): Unique identifier for the food item

  • regulation (string, optional): Regulation type for label formatting. Defaults to "UnitedStates2016" if not provided.

Supported Regulation Types:

  • "UnitedStates2016" (default)

  • "Canada2016"

  • "Mexico2020"

  • "EuropeanUnion2011"

  • "AustraliaNewZealand2016"

Response: LabelResponse

Status Code: 200 OK

{ "regulation": "UnitedStates2016", "servingSize": "string", "nutrients": [ { "nutrientId": "string", "nutrientName": "string", "unitId": "string", "unitName": "string", "name": "string", "quantity": "string", "amount": 0, "percentDv": 0, "isSignificant": false } ], "caloriesPerContainer": null }

Response Fields:

  • regulation (string): The regulation type used for label formatting

  • servingSize (string, nullable): Serving size description (e.g., "1 cup (240ml)")

  • nutrients (array): Array of normalized label nutrients

    • nutrientId (string): Nutrient UUID

    • nutrientName (string): Human-readable nutrient name from constants

    • unitId (string, nullable): Unit UUID

    • unitName (string, nullable): Human-readable unit name

    • name (string): Nutrient name as it appears on the label

    • quantity (string, nullable): Formatted quantity string (e.g., "231", "2.8g")

    • amount (number, nullable): Numeric amount value

    • percentDv (number, nullable): Percent daily value

    • isSignificant (boolean): Whether the nutrient is significant for labeling

  • caloriesPerContainer (object, nullable): Calories per container information (for Mexico2020 regulation). Has the same structure as a nutrient object.

cURL Examples

United States 2016 (default):

curl -X POST https://nutritional-api.trustwell.com/v1/api/calculator/label \ -H "Content-Type: application/json" \ -d '{ "foodId": "c1af9f46-9335-4657-978f-7d2241aea888", "regulation": "UnitedStates2016" }'

Canada 2016:

curl -X POST https://nutritional-api.trustwell.com/api/v1/calculator/label \ -H "Content-Type: application/json" \ -d '{ "foodId": "c1af9f46-9335-4657-978f-7d2241aea888", "regulation": "Canada2016" }'

Mexico 2020:

curl -X POST https://nutritional-api.trustwell.com/api/v1/calculator/label \ -H "Content-Type: application/json" \ -d '{ "foodId": "c1af9f46-9335-4657-978f-7d2241aea888", "regulation": "Mexico2020" }'

European Union 2011:

curl -X POST https://nutritional-api.trustwell.com/api/v1/calculator/label \ -H "Content-Type: application/json" \ -d '{ "foodId": "c1af9f46-9335-4657-978f-7d2241aea888", "regulation": "EuropeanUnion2011" }'

Australia/New Zealand 2016:

curl -X POST https://nutritional-api.trustwell.com/api/v1/calculator/label \ -H "Content-Type: application/json" \ -d '{ "foodId": "c1af9f46-9335-4657-978f-7d2241aea888", "regulation": "AustraliaNewZealand2016" }'

Using default regulation (UnitedStates2016):

curl -X POST https://nutritional-api.trustwell.com/api/v1/calculator/label \ -H "Content-Type: application/json" \ -d '{ "foodId": "c1af9f46-9335-4657-978f-7d2241aea888" }'

Error Responses

400 BAD REQUEST: Invalid request format or missing required fields

{ "detail": "Validation error message" }

500 INTERNAL SERVER ERROR: Server error during processing

{ "detail": "Internal server error: error message" }

Notes

  • The response includes label-specific fields (e.g., percent DV, significance flags) to support rendering compliant label detail .

  • For certain regulations (e.g., Mexico2020), caloriesPerContainer may be populated where required by the regulation format.

Domain Catalog

These endpoints provide lookup catalogs used for reference and mapping (e.g., building UI selectors, validating IDs, or aligning internal data models). They are not intended for high-frequency consumer calls and should typically be cached on the client’s middleware layer. These are the values that exist in Genesis Foods to ensure alignment of IDs and values.

GET /api/v1/nutrients | Get Nutrients

Returns a nutrient catalog mapping (commonly “name → id”), representing the authoritative nutrient identifiers used by the API. This is useful for validating nutrient IDs and building consistent storage/mapping in downstream systems.

GET /api/v1/units | Get Units

Returns a unit catalog mapping (commonly “name → id”) for the measurement units used in requests and responses. This allows clients to align quantity inputs and to display nutrient values with consistent unit labeling.

GET /api/v1/allergens | Get Allergens

Returns allergen catalogs by region (e.g., Mexico, Canada, Australia). This can be used to align allergen display logic, voluntary statements, or region-specific allergen expectations.

GET /api/v1/languages | Get Languages

Returns the supported language catalog. This is primarily useful for understanding what language outputs are available and for building UI expectations around multi-language responses.

4) Usage & Billing Support

GET /api/v1/usage | Get Usage

Returns aggregated request counts for the authenticated API key. This is intended to support tiered billing and operational monitoring of consumer traffic driven by the calling application. Only usage (both successful and failed) associated with the provided API key is returned.

Query parameters (optional)

  • start_date: start of aggregation window (ISO 8601 or YYYY-MM-DD)

  • end_date: end of aggregation window (ISO 8601 or YYYY-MM-DD)

Notes

  • If dates are omitted, the response defaults to a recent window (the last 30 days).

  • The response is designed to be easily imported into downstream reporting/billing systems.

5) Platform Information & Health

GET /api/ | Root (System Info)

Returns API and system information for the current environment. This endpoint is intended for operational visibility and integration validation (e.g., confirming environment, version, and service-reported status). It also includes information surfaced by /api/health.

GET /api/health | Health Check

Returns a health status based on backing-system connectivity checks. The service is considered healthy only if required dependencies are healthy. This endpoint is typically used by external uptime monitors, and deployment validation checks.

Data Models (Quick Reference)

CalculatorRequest

  • foodItems (array of FoodItem, required)

FoodItem

  • foodId (string, required)

  • amount (Amount, required)

Amount

  • unitId (string, required)

  • quantity (string, required)

CalculatorResponse

  • nutrients (array of Nutrient, required)

  • ingredientStatement (IngredientStatement, required)

  • allergenStatement (AllergenStatement, required)

Nutrient

  • nutrientId (string, required)

  • nutrientName (string, required)

  • unitId (string, required)

  • unitName (string, required)

  • value (number, required)

IngredientStatement

  • english (string, required)

  • spanish (string, required)

AllergenStatement

  • english (AllergenStatements, required)

  • spanish (AllergenStatements, required)

AllergenStatements

  • statement (string, required)

  • voluntaryStatement (string, required)

LabelRequest

  • foodId (string, required)

  • regulation (string, optional; default UnitedStates2016)

LabelResponse

  • regulation (string, required)

  • servingSize (string/null)

  • nutrients (array of LabelNutrient, required)

  • caloriesPerContainer (LabelNutrient/null)

LabelNutrient

  • nutrientId (string, required)

  • nutrientName (string, required)

  • unitId (string/null)

  • unitName (string/null)

  • name (string, required)

  • quantity (string/null)

  • amount (number/null)

  • percentDv (number/null)

  • isSignificant (boolean; default false)

 

Clicking links may navigate you away from the Trustwell site.