Restaurant Operations Intelligence API Documentation

Read supplied recipes, supplier prices, sales, and allergen flags to calculate food cost and menu profitability without inventing nutrition or compliance claims. Payment is the exact USDC price on Base with x402.

POSThttps://brainiac.software/api/v1/restaurant-operations/recipe-cost-calculate$0.04 USDC

Calculate recipe cost

Calculate recipe and per-portion cost from supplied ingredient quantities and prices after unit conversion. Missing prices are not invented.

Body

FieldRequiredNotes
textNostring
jsonNostring
csvNostring
fileNoobject; Object
ingredientsNoarray; Array
pricesNoarray; Array
recipesNoarray; Array
recipeLinesNoarray; Array
salesNoarray; Array
wasteNoarray; Array
allergensNoarray; Array
matrixNoarray; Array
asOfNostring

Request exampleJSON

{
  "ingredients": [
    {
      "id": "flour",
      "name": "Flour",
      "unit": "g",
      "unitPrice": 0.002
    },
    {
      "id": "butter",
      "name": "Butter",
      "unit": "g",
      "packSize": 250,
      "packPrice": 3
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie",
      "portions": 10,
      "sellPrice": 3
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 500,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 100,
      "unit": "g"
    }
  ]
}

Response exampleJSON

{
  "checkedAt": "2026-11-04T21:00:00.000Z",
  "status": "calculated",
  "items": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "lineCount": 2,
      "totalCost": 2.2,
      "totalCostSupplied": true,
      "portions": 10,
      "portionsSupplied": true,
      "costPerPortion": 0.22,
      "costPerPortionSupplied": true,
      "sellPrice": 3,
      "sellPriceSupplied": true,
      "lines": [
        {
          "ingredientId": "flour",
          "quantity": 500,
          "unit": "g",
          "lineCost": 1,
          "lineCostSupplied": true,
          "unitPrice": 0.002,
          "unitPriceSupplied": true,
          "converted": false,
          "priceSource": "ingredient.unitPrice"
        },
        {
          "ingredientId": "butter",
          "quantity": 100,
          "unit": "g",
          "lineCost": 1.2,
          "lineCostSupplied": true,
          "unitPrice": 0.012,
          "unitPriceSupplied": true,
          "converted": false,
          "priceSource": "ingredient.packPrice/packSize"
        }
      ],
      "priceInvented": false,
      "nutritionInvented": false
    }
  ],
  "nutritionInvented": false,
  "allergenInvented": false,
  "priceInvented": false,
  "foodSafetyComplianceClaimed": false,
  "findings": [],
  "limitations": [
    "Recipes, supplier prices, sales, waste, and allergen rows are copied only from labeled fields supplied by the caller.",
    "Recipe cost uses supplied quantities and prices after unit conversion. Missing prices are not invented.",
    "Unit conversion covers common mass and volume units. Count units convert only to the same count family.",
    "Allergen validation uses only explicitly supplied ingredient allergen flags and menu claims.",
    "Nutritional values are never invented. No legal food-safety compliance is claimed."
  ]
}

cURL

curl -i -X POST "https://brainiac.software/api/v1/restaurant-operations/recipe-cost-calculate" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "ingredients": [
    {
      "id": "flour",
      "name": "Flour",
      "unit": "g",
      "unitPrice": 0.002
    },
    {
      "id": "butter",
      "name": "Butter",
      "unit": "g",
      "packSize": 250,
      "packPrice": 3
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie",
      "portions": 10,
      "sellPrice": 3
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 500,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 100,
      "unit": "g"
    }
  ]
}
JSON
POSThttps://brainiac.software/api/v1/restaurant-operations/menu-item-margin-analyze$0.05 USDC

Analyze menu item margins

Calculate gross margin and food-cost percentage from supplied sell prices and calculated recipe costs. Nutritional values are not invented.

Body

FieldRequiredNotes
textNostring
jsonNostring
csvNostring
fileNoobject; Object
ingredientsNoarray; Array
pricesNoarray; Array
recipesNoarray; Array
recipeLinesNoarray; Array
salesNoarray; Array
wasteNoarray; Array
allergensNoarray; Array
matrixNoarray; Array
asOfNostring

Request exampleJSON

{
  "ingredients": [
    {
      "id": "flour",
      "unit": "g",
      "unitPrice": 0.002
    },
    {
      "id": "butter",
      "unit": "g",
      "unitPrice": 0.012
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie",
      "portions": 10,
      "sellPrice": 3
    },
    {
      "id": "R-2",
      "name": "Toast",
      "portions": 1,
      "sellPrice": 4
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 500,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 100,
      "unit": "g"
    },
    {
      "recipeId": "R-2",
      "ingredientId": "flour",
      "quantity": 50,
      "unit": "g"
    },
    {
      "recipeId": "R-2",
      "ingredientId": "butter",
      "quantity": 20,
      "unit": "g"
    }
  ]
}

Response exampleJSON

{
  "checkedAt": "2026-11-04T21:00:00.000Z",
  "status": "analyzed",
  "items": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "sellPrice": 3,
      "sellPriceSupplied": true,
      "costPerPortion": 0.22,
      "costPerPortionSupplied": true,
      "grossProfit": 2.78,
      "grossProfitSupplied": true,
      "grossMargin": 0.9267,
      "grossMarginSupplied": true,
      "foodCostPct": 0.0733,
      "foodCostPctSupplied": true,
      "priceInvented": false,
      "foodSafetyComplianceClaimed": false
    },
    {
      "recipeId": "R-2",
      "name": "Toast",
      "sellPrice": 4,
      "sellPriceSupplied": true,
      "costPerPortion": 0.34,
      "costPerPortionSupplied": true,
      "grossProfit": 3.66,
      "grossProfitSupplied": true,
      "grossMargin": 0.915,
      "grossMarginSupplied": true,
      "foodCostPct": 0.085,
      "foodCostPctSupplied": true,
      "priceInvented": false,
      "foodSafetyComplianceClaimed": false
    }
  ],
  "nutritionInvented": false,
  "allergenInvented": false,
  "priceInvented": false,
  "foodSafetyComplianceClaimed": false,
  "findings": [],
  "limitations": [
    "Recipes, supplier prices, sales, waste, and allergen rows are copied only from labeled fields supplied by the caller.",
    "Recipe cost uses supplied quantities and prices after unit conversion. Missing prices are not invented.",
    "Unit conversion covers common mass and volume units. Count units convert only to the same count family.",
    "Allergen validation uses only explicitly supplied ingredient allergen flags and menu claims.",
    "Nutritional values are never invented. No legal food-safety compliance is claimed."
  ]
}

cURL

curl -i -X POST "https://brainiac.software/api/v1/restaurant-operations/menu-item-margin-analyze" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "ingredients": [
    {
      "id": "flour",
      "unit": "g",
      "unitPrice": 0.002
    },
    {
      "id": "butter",
      "unit": "g",
      "unitPrice": 0.012
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie",
      "portions": 10,
      "sellPrice": 3
    },
    {
      "id": "R-2",
      "name": "Toast",
      "portions": 1,
      "sellPrice": 4
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 500,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 100,
      "unit": "g"
    },
    {
      "recipeId": "R-2",
      "ingredientId": "flour",
      "quantity": 50,
      "unit": "g"
    },
    {
      "recipeId": "R-2",
      "ingredientId": "butter",
      "quantity": 20,
      "unit": "g"
    }
  ]
}
JSON
POSThttps://brainiac.software/api/v1/restaurant-operations/ingredient-price-variance$0.04 USDC

Detect ingredient price variance

Compare supplied supplier prices for the same ingredient after unit conversion and report spreads and dated changes. Prices are never invented.

Body

FieldRequiredNotes
textNostring
jsonNostring
csvNostring
fileNoobject; Object
ingredientsNoarray; Array
pricesNoarray; Array
recipesNoarray; Array
recipeLinesNoarray; Array
salesNoarray; Array
wasteNoarray; Array
allergensNoarray; Array
matrixNoarray; Array
asOfNostring

Request exampleJSON

{
  "prices": [
    {
      "ingredientId": "flour",
      "supplierId": "A",
      "unit": "kg",
      "unitPrice": 1.8,
      "asOf": "2026-10-01"
    },
    {
      "ingredientId": "flour",
      "supplierId": "B",
      "unit": "g",
      "unitPrice": 0.0025,
      "asOf": "2026-11-01"
    },
    {
      "ingredientId": "flour",
      "supplierId": "A",
      "unit": "kg",
      "unitPrice": 2.2,
      "asOf": "2026-11-01"
    }
  ]
}

Response exampleJSON

{
  "checkedAt": "2026-11-04T21:00:00.000Z",
  "status": "detected",
  "items": [
    {
      "ingredientId": "flour",
      "name": "flour",
      "unit": "kg",
      "observationCount": 3,
      "minPrice": 1.8,
      "maxPrice": 2.5,
      "spread": 0.7,
      "spreadPct": 0.3889,
      "latestPrice": 2.5,
      "latestAsOf": "2026-11-01",
      "previousPrice": 2.2,
      "previousAsOf": "2026-11-01",
      "changePct": 0.1364,
      "changePctSupplied": true,
      "inconsistent": true,
      "priceInvented": false
    }
  ],
  "nutritionInvented": false,
  "allergenInvented": false,
  "priceInvented": false,
  "foodSafetyComplianceClaimed": false,
  "findings": [],
  "limitations": [
    "Recipes, supplier prices, sales, waste, and allergen rows are copied only from labeled fields supplied by the caller.",
    "Recipe cost uses supplied quantities and prices after unit conversion. Missing prices are not invented.",
    "Unit conversion covers common mass and volume units. Count units convert only to the same count family.",
    "Allergen validation uses only explicitly supplied ingredient allergen flags and menu claims.",
    "Nutritional values are never invented. No legal food-safety compliance is claimed."
  ]
}

cURL

curl -i -X POST "https://brainiac.software/api/v1/restaurant-operations/ingredient-price-variance" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "prices": [
    {
      "ingredientId": "flour",
      "supplierId": "A",
      "unit": "kg",
      "unitPrice": 1.8,
      "asOf": "2026-10-01"
    },
    {
      "ingredientId": "flour",
      "supplierId": "B",
      "unit": "g",
      "unitPrice": 0.0025,
      "asOf": "2026-11-01"
    },
    {
      "ingredientId": "flour",
      "supplierId": "A",
      "unit": "kg",
      "unitPrice": 2.2,
      "asOf": "2026-11-01"
    }
  ]
}
JSON
POSThttps://brainiac.software/api/v1/restaurant-operations/food-waste-estimate$0.04 USDC

Estimate food waste cost

Estimate waste cost from supplied waste quantities and ingredient prices after unit conversion. Missing prices are not invented.

Body

FieldRequiredNotes
textNostring
jsonNostring
csvNostring
fileNoobject; Object
ingredientsNoarray; Array
pricesNoarray; Array
recipesNoarray; Array
recipeLinesNoarray; Array
salesNoarray; Array
wasteNoarray; Array
allergensNoarray; Array
matrixNoarray; Array
asOfNostring

Request exampleJSON

{
  "ingredients": [
    {
      "id": "lettuce",
      "unit": "g",
      "unitPrice": 0.004
    }
  ],
  "waste": [
    {
      "ingredientId": "lettuce",
      "quantity": 500,
      "unit": "g",
      "reason": "spoilage"
    },
    {
      "ingredientId": "lettuce",
      "quantity": 0.2,
      "unit": "kg",
      "reason": "trim"
    }
  ]
}

Response exampleJSON

{
  "checkedAt": "2026-11-04T21:00:00.000Z",
  "status": "estimated",
  "totalEstimatedCost": 2.8,
  "totalEstimatedCostSupplied": true,
  "items": [
    {
      "ingredientId": "lettuce",
      "quantity": 500,
      "unit": "g",
      "reason": "spoilage",
      "estimatedCost": 2,
      "estimatedCostSupplied": true,
      "unitPrice": 0.004,
      "priceSource": "ingredient.unitPrice",
      "priceInvented": false
    },
    {
      "ingredientId": "lettuce",
      "quantity": 0.2,
      "unit": "kg",
      "reason": "trim",
      "estimatedCost": 0.8,
      "estimatedCostSupplied": true,
      "unitPrice": 4,
      "priceSource": "ingredient.unitPrice",
      "priceInvented": false
    }
  ],
  "nutritionInvented": false,
  "allergenInvented": false,
  "priceInvented": false,
  "foodSafetyComplianceClaimed": false,
  "findings": [],
  "limitations": [
    "Recipes, supplier prices, sales, waste, and allergen rows are copied only from labeled fields supplied by the caller.",
    "Recipe cost uses supplied quantities and prices after unit conversion. Missing prices are not invented.",
    "Unit conversion covers common mass and volume units. Count units convert only to the same count family.",
    "Allergen validation uses only explicitly supplied ingredient allergen flags and menu claims.",
    "Nutritional values are never invented. No legal food-safety compliance is claimed."
  ]
}

cURL

curl -i -X POST "https://brainiac.software/api/v1/restaurant-operations/food-waste-estimate" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "ingredients": [
    {
      "id": "lettuce",
      "unit": "g",
      "unitPrice": 0.004
    }
  ],
  "waste": [
    {
      "ingredientId": "lettuce",
      "quantity": 500,
      "unit": "g",
      "reason": "spoilage"
    },
    {
      "ingredientId": "lettuce",
      "quantity": 0.2,
      "unit": "kg",
      "reason": "trim"
    }
  ]
}
JSON
POSThttps://brainiac.software/api/v1/restaurant-operations/recipe-yield-normalize$0.04 USDC

Normalize recipe yields

Normalize recipe line quantities into ingredient units and per-portion amounts using accurate mass and volume conversions.

Body

FieldRequiredNotes
textNostring
jsonNostring
csvNostring
fileNoobject; Object
ingredientsNoarray; Array
pricesNoarray; Array
recipesNoarray; Array
recipeLinesNoarray; Array
salesNoarray; Array
wasteNoarray; Array
allergensNoarray; Array
matrixNoarray; Array
asOfNostring

Request exampleJSON

{
  "ingredients": [
    {
      "id": "milk",
      "name": "Milk",
      "unit": "ml"
    },
    {
      "id": "sugar",
      "name": "Sugar",
      "unit": "g"
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Latte syrup base",
      "portions": 4,
      "yieldQty": 1,
      "yieldUnit": "batch"
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "milk",
      "quantity": 1,
      "unit": "l"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "sugar",
      "quantity": 0.2,
      "unit": "kg"
    }
  ]
}

Response exampleJSON

{
  "checkedAt": "2026-11-04T21:00:00.000Z",
  "status": "normalized",
  "items": [
    {
      "recipeId": "R-1",
      "name": "Latte syrup base",
      "yieldQty": 1,
      "yieldQtySupplied": true,
      "yieldUnit": "batch",
      "portions": 4,
      "portionsSupplied": true,
      "lines": [
        {
          "ingredientId": "milk",
          "quantity": 1,
          "unit": "l",
          "normalizedQuantity": 1000,
          "normalizedUnit": "ml",
          "converted": true,
          "convertible": true
        },
        {
          "ingredientId": "sugar",
          "quantity": 0.2,
          "unit": "kg",
          "normalizedQuantity": 200,
          "normalizedUnit": "g",
          "converted": true,
          "convertible": true
        }
      ],
      "perPortion": [
        {
          "ingredientId": "milk",
          "quantityPerPortion": 250,
          "quantityPerPortionSupplied": true,
          "unit": "ml"
        },
        {
          "ingredientId": "sugar",
          "quantityPerPortion": 50,
          "quantityPerPortionSupplied": true,
          "unit": "g"
        }
      ],
      "nutritionInvented": false
    }
  ],
  "nutritionInvented": false,
  "allergenInvented": false,
  "priceInvented": false,
  "foodSafetyComplianceClaimed": false,
  "findings": [],
  "limitations": [
    "Recipes, supplier prices, sales, waste, and allergen rows are copied only from labeled fields supplied by the caller.",
    "Recipe cost uses supplied quantities and prices after unit conversion. Missing prices are not invented.",
    "Unit conversion covers common mass and volume units. Count units convert only to the same count family.",
    "Allergen validation uses only explicitly supplied ingredient allergen flags and menu claims.",
    "Nutritional values are never invented. No legal food-safety compliance is claimed."
  ]
}

cURL

curl -i -X POST "https://brainiac.software/api/v1/restaurant-operations/recipe-yield-normalize" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "ingredients": [
    {
      "id": "milk",
      "name": "Milk",
      "unit": "ml"
    },
    {
      "id": "sugar",
      "name": "Sugar",
      "unit": "g"
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Latte syrup base",
      "portions": 4,
      "yieldQty": 1,
      "yieldUnit": "batch"
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "milk",
      "quantity": 1,
      "unit": "l"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "sugar",
      "quantity": 0.2,
      "unit": "kg"
    }
  ]
}
JSON
POSThttps://brainiac.software/api/v1/restaurant-operations/menu-profitability-rank$0.05 USDC

Rank menu profitability

Rank menu items by contribution using calculated portion profit and supplied sales units. Ties fall back to gross margin.

Body

FieldRequiredNotes
textNostring
jsonNostring
csvNostring
fileNoobject; Object
ingredientsNoarray; Array
pricesNoarray; Array
recipesNoarray; Array
recipeLinesNoarray; Array
salesNoarray; Array
wasteNoarray; Array
allergensNoarray; Array
matrixNoarray; Array
asOfNostring

Request exampleJSON

{
  "ingredients": [
    {
      "id": "flour",
      "unit": "g",
      "unitPrice": 0.002
    },
    {
      "id": "butter",
      "unit": "g",
      "unitPrice": 0.012
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie",
      "portions": 10,
      "sellPrice": 3
    },
    {
      "id": "R-2",
      "name": "Toast",
      "portions": 1,
      "sellPrice": 4
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 500,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 100,
      "unit": "g"
    },
    {
      "recipeId": "R-2",
      "ingredientId": "flour",
      "quantity": 50,
      "unit": "g"
    },
    {
      "recipeId": "R-2",
      "ingredientId": "butter",
      "quantity": 20,
      "unit": "g"
    }
  ],
  "sales": [
    {
      "recipeId": "R-1",
      "units": 40
    },
    {
      "recipeId": "R-2",
      "units": 10
    }
  ]
}

Response exampleJSON

{
  "checkedAt": "2026-11-04T21:00:00.000Z",
  "status": "ranked",
  "items": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "sellPrice": 3,
      "sellPriceSupplied": true,
      "costPerPortion": 0.22,
      "costPerPortionSupplied": true,
      "grossProfit": 2.78,
      "grossProfitSupplied": true,
      "grossMargin": 0.9267,
      "grossMarginSupplied": true,
      "foodCostPct": 0.0733,
      "foodCostPctSupplied": true,
      "priceInvented": false,
      "foodSafetyComplianceClaimed": false,
      "unitsSold": 40,
      "unitsSoldSupplied": true,
      "revenue": 0,
      "revenueSupplied": false,
      "contribution": 111.2,
      "contributionSupplied": true,
      "rank": 1
    },
    {
      "recipeId": "R-2",
      "name": "Toast",
      "sellPrice": 4,
      "sellPriceSupplied": true,
      "costPerPortion": 0.34,
      "costPerPortionSupplied": true,
      "grossProfit": 3.66,
      "grossProfitSupplied": true,
      "grossMargin": 0.915,
      "grossMarginSupplied": true,
      "foodCostPct": 0.085,
      "foodCostPctSupplied": true,
      "priceInvented": false,
      "foodSafetyComplianceClaimed": false,
      "unitsSold": 10,
      "unitsSoldSupplied": true,
      "revenue": 0,
      "revenueSupplied": false,
      "contribution": 36.6,
      "contributionSupplied": true,
      "rank": 2
    }
  ],
  "nutritionInvented": false,
  "allergenInvented": false,
  "priceInvented": false,
  "foodSafetyComplianceClaimed": false,
  "findings": [],
  "limitations": [
    "Recipes, supplier prices, sales, waste, and allergen rows are copied only from labeled fields supplied by the caller.",
    "Recipe cost uses supplied quantities and prices after unit conversion. Missing prices are not invented.",
    "Unit conversion covers common mass and volume units. Count units convert only to the same count family.",
    "Allergen validation uses only explicitly supplied ingredient allergen flags and menu claims.",
    "Nutritional values are never invented. No legal food-safety compliance is claimed."
  ]
}

cURL

curl -i -X POST "https://brainiac.software/api/v1/restaurant-operations/menu-profitability-rank" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "ingredients": [
    {
      "id": "flour",
      "unit": "g",
      "unitPrice": 0.002
    },
    {
      "id": "butter",
      "unit": "g",
      "unitPrice": 0.012
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie",
      "portions": 10,
      "sellPrice": 3
    },
    {
      "id": "R-2",
      "name": "Toast",
      "portions": 1,
      "sellPrice": 4
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 500,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 100,
      "unit": "g"
    },
    {
      "recipeId": "R-2",
      "ingredientId": "flour",
      "quantity": 50,
      "unit": "g"
    },
    {
      "recipeId": "R-2",
      "ingredientId": "butter",
      "quantity": 20,
      "unit": "g"
    }
  ],
  "sales": [
    {
      "recipeId": "R-1",
      "units": 40
    },
    {
      "recipeId": "R-2",
      "units": 10
    }
  ]
}
JSON
POSThttps://brainiac.software/api/v1/restaurant-operations/allergen-matrix-validate$0.05 USDC

Validate allergen matrix

Compare menu allergen claims with explicitly supplied ingredient allergen flags. Allergen status is never invented and food-safety compliance is not claimed.

Body

FieldRequiredNotes
textNostring
jsonNostring
csvNostring
fileNoobject; Object
ingredientsNoarray; Array
pricesNoarray; Array
recipesNoarray; Array
recipeLinesNoarray; Array
salesNoarray; Array
wasteNoarray; Array
allergensNoarray; Array
matrixNoarray; Array
asOfNostring

Request exampleJSON

{
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie"
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 100,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 50,
      "unit": "g"
    }
  ],
  "allergens": [
    {
      "ingredientId": "flour",
      "allergen": "gluten",
      "present": true
    },
    {
      "ingredientId": "butter",
      "allergen": "milk",
      "present": true
    },
    {
      "ingredientId": "butter",
      "allergen": "gluten",
      "present": false
    }
  ],
  "matrix": [
    {
      "recipeId": "R-1",
      "allergen": "gluten",
      "claimed": true
    },
    {
      "recipeId": "R-1",
      "allergen": "milk",
      "claimed": false
    },
    {
      "recipeId": "R-1",
      "allergen": "peanut",
      "claimed": false
    }
  ]
}

Response exampleJSON

{
  "checkedAt": "2026-11-04T21:00:00.000Z",
  "status": "validated",
  "mismatchCount": 1,
  "items": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "ingredientCount": 2,
      "allergens": [
        {
          "allergen": "gluten",
          "derivedPresent": true,
          "derivedPresentSupplied": true,
          "claimed": true,
          "claimedSupplied": true,
          "status": "match",
          "sources": [
            "flour",
            "butter"
          ],
          "allergenInvented": false,
          "foodSafetyComplianceClaimed": false
        },
        {
          "allergen": "milk",
          "derivedPresent": true,
          "derivedPresentSupplied": true,
          "claimed": false,
          "claimedSupplied": true,
          "status": "mismatch",
          "sources": [
            "butter"
          ],
          "allergenInvented": false,
          "foodSafetyComplianceClaimed": false
        },
        {
          "allergen": "peanut",
          "derivedPresent": false,
          "derivedPresentSupplied": false,
          "claimed": false,
          "claimedSupplied": true,
          "status": "claim_without_ingredient_data",
          "sources": [],
          "allergenInvented": false,
          "foodSafetyComplianceClaimed": false
        }
      ],
      "mismatchCount": 1,
      "foodSafetyComplianceClaimed": false,
      "allergenInvented": false
    }
  ],
  "nutritionInvented": false,
  "allergenInvented": false,
  "priceInvented": false,
  "foodSafetyComplianceClaimed": false,
  "findings": [
    {
      "kind": "conflict",
      "code": "allergen_mismatch",
      "subject": "R-1:milk",
      "detail": "Menu allergen claim does not match derived ingredient allergen flags."
    },
    {
      "kind": "missing",
      "code": "allergen_basis",
      "subject": "R-1:peanut",
      "detail": "A menu allergen claim has no supporting ingredient allergen rows."
    }
  ],
  "limitations": [
    "Recipes, supplier prices, sales, waste, and allergen rows are copied only from labeled fields supplied by the caller.",
    "Recipe cost uses supplied quantities and prices after unit conversion. Missing prices are not invented.",
    "Unit conversion covers common mass and volume units. Count units convert only to the same count family.",
    "Allergen validation uses only explicitly supplied ingredient allergen flags and menu claims.",
    "Nutritional values are never invented. No legal food-safety compliance is claimed."
  ]
}

cURL

curl -i -X POST "https://brainiac.software/api/v1/restaurant-operations/allergen-matrix-validate" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie"
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 100,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 50,
      "unit": "g"
    }
  ],
  "allergens": [
    {
      "ingredientId": "flour",
      "allergen": "gluten",
      "present": true
    },
    {
      "ingredientId": "butter",
      "allergen": "milk",
      "present": true
    },
    {
      "ingredientId": "butter",
      "allergen": "gluten",
      "present": false
    }
  ],
  "matrix": [
    {
      "recipeId": "R-1",
      "allergen": "gluten",
      "claimed": true
    },
    {
      "recipeId": "R-1",
      "allergen": "milk",
      "claimed": false
    },
    {
      "recipeId": "R-1",
      "allergen": "peanut",
      "claimed": false
    }
  ]
}
JSON
POSThttps://brainiac.software/api/v1/restaurant-operations/food-cost-report$0.12 USDC

Report restaurant food cost

Combine recipe costs, margins, price variance, waste estimates, yield normalization, profitability ranking, and allergen validation from supplied data.

Body

FieldRequiredNotes
textNostring
jsonNostring
csvNostring
fileNoobject; Object
ingredientsNoarray; Array
pricesNoarray; Array
recipesNoarray; Array
recipeLinesNoarray; Array
salesNoarray; Array
wasteNoarray; Array
allergensNoarray; Array
matrixNoarray; Array
asOfNostring

Request exampleJSON

{
  "ingredients": [
    {
      "id": "flour",
      "name": "Flour",
      "unit": "g",
      "unitPrice": 0.002
    },
    {
      "id": "butter",
      "name": "Butter",
      "unit": "g",
      "unitPrice": 0.012
    }
  ],
  "prices": [
    {
      "ingredientId": "flour",
      "supplierId": "A",
      "unit": "kg",
      "unitPrice": 1.8,
      "asOf": "2026-10-01"
    },
    {
      "ingredientId": "flour",
      "supplierId": "A",
      "unit": "kg",
      "unitPrice": 2.2,
      "asOf": "2026-11-01"
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie",
      "portions": 10,
      "sellPrice": 3
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 500,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 100,
      "unit": "g"
    }
  ],
  "sales": [
    {
      "recipeId": "R-1",
      "units": 40
    }
  ],
  "waste": [
    {
      "ingredientId": "flour",
      "quantity": 100,
      "unit": "g",
      "reason": "spill"
    }
  ],
  "allergens": [
    {
      "ingredientId": "flour",
      "allergen": "gluten",
      "present": true
    },
    {
      "ingredientId": "butter",
      "allergen": "milk",
      "present": true
    }
  ],
  "matrix": [
    {
      "recipeId": "R-1",
      "allergen": "gluten",
      "claimed": true
    },
    {
      "recipeId": "R-1",
      "allergen": "milk",
      "claimed": true
    }
  ]
}

Response exampleJSON

{
  "checkedAt": "2026-11-04T21:00:00.000Z",
  "status": "reported",
  "recipeCount": 1,
  "pricedRecipeCount": 1,
  "wasteCost": 0.22,
  "wasteCostSupplied": true,
  "allergenMismatchCount": 0,
  "recipes": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "lineCount": 2,
      "totalCost": 2.3,
      "totalCostSupplied": true,
      "portions": 10,
      "portionsSupplied": true,
      "costPerPortion": 0.23,
      "costPerPortionSupplied": true,
      "sellPrice": 3,
      "sellPriceSupplied": true,
      "lines": [
        {
          "ingredientId": "flour",
          "quantity": 500,
          "unit": "g",
          "lineCost": 1.1,
          "lineCostSupplied": true,
          "unitPrice": 0.0022,
          "unitPriceSupplied": true,
          "converted": true,
          "priceSource": "price.unitPrice"
        },
        {
          "ingredientId": "butter",
          "quantity": 100,
          "unit": "g",
          "lineCost": 1.2,
          "lineCostSupplied": true,
          "unitPrice": 0.012,
          "unitPriceSupplied": true,
          "converted": false,
          "priceSource": "ingredient.unitPrice"
        }
      ],
      "priceInvented": false,
      "nutritionInvented": false
    }
  ],
  "margins": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "sellPrice": 3,
      "sellPriceSupplied": true,
      "costPerPortion": 0.23,
      "costPerPortionSupplied": true,
      "grossProfit": 2.77,
      "grossProfitSupplied": true,
      "grossMargin": 0.9233,
      "grossMarginSupplied": true,
      "foodCostPct": 0.0767,
      "foodCostPctSupplied": true,
      "priceInvented": false,
      "foodSafetyComplianceClaimed": false
    }
  ],
  "priceVariance": [
    {
      "ingredientId": "flour",
      "name": "Flour",
      "unit": "kg",
      "observationCount": 3,
      "minPrice": 1.8,
      "maxPrice": 2.2,
      "spread": 0.4,
      "spreadPct": 0.2222,
      "latestPrice": 2.2,
      "latestAsOf": "2026-11-01",
      "previousPrice": 1.8,
      "previousAsOf": "2026-10-01",
      "changePct": 0.2222,
      "changePctSupplied": true,
      "inconsistent": true,
      "priceInvented": false
    }
  ],
  "waste": [
    {
      "ingredientId": "flour",
      "quantity": 100,
      "unit": "g",
      "reason": "spill",
      "estimatedCost": 0.22,
      "estimatedCostSupplied": true,
      "unitPrice": 0.0022,
      "priceSource": "price.unitPrice",
      "priceInvented": false
    }
  ],
  "yields": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "yieldQty": 10,
      "yieldQtySupplied": true,
      "yieldUnit": "portions",
      "portions": 10,
      "portionsSupplied": true,
      "lines": [
        {
          "ingredientId": "flour",
          "quantity": 500,
          "unit": "g",
          "normalizedQuantity": 500,
          "normalizedUnit": "g",
          "converted": false,
          "convertible": true
        },
        {
          "ingredientId": "butter",
          "quantity": 100,
          "unit": "g",
          "normalizedQuantity": 100,
          "normalizedUnit": "g",
          "converted": false,
          "convertible": true
        }
      ],
      "perPortion": [
        {
          "ingredientId": "flour",
          "quantityPerPortion": 50,
          "quantityPerPortionSupplied": true,
          "unit": "g"
        },
        {
          "ingredientId": "butter",
          "quantityPerPortion": 10,
          "quantityPerPortionSupplied": true,
          "unit": "g"
        }
      ],
      "nutritionInvented": false
    }
  ],
  "ranking": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "sellPrice": 3,
      "sellPriceSupplied": true,
      "costPerPortion": 0.23,
      "costPerPortionSupplied": true,
      "grossProfit": 2.77,
      "grossProfitSupplied": true,
      "grossMargin": 0.9233,
      "grossMarginSupplied": true,
      "foodCostPct": 0.0767,
      "foodCostPctSupplied": true,
      "priceInvented": false,
      "foodSafetyComplianceClaimed": false,
      "unitsSold": 40,
      "unitsSoldSupplied": true,
      "revenue": 0,
      "revenueSupplied": false,
      "contribution": 110.8,
      "contributionSupplied": true,
      "rank": 1
    }
  ],
  "allergens": [
    {
      "recipeId": "R-1",
      "name": "Cookie",
      "ingredientCount": 2,
      "allergens": [
        {
          "allergen": "gluten",
          "derivedPresent": true,
          "derivedPresentSupplied": true,
          "claimed": true,
          "claimedSupplied": true,
          "status": "match",
          "sources": [
            "flour"
          ],
          "allergenInvented": false,
          "foodSafetyComplianceClaimed": false
        },
        {
          "allergen": "milk",
          "derivedPresent": true,
          "derivedPresentSupplied": true,
          "claimed": true,
          "claimedSupplied": true,
          "status": "match",
          "sources": [
            "butter"
          ],
          "allergenInvented": false,
          "foodSafetyComplianceClaimed": false
        }
      ],
      "mismatchCount": 0,
      "foodSafetyComplianceClaimed": false,
      "allergenInvented": false
    }
  ],
  "nutritionInvented": false,
  "allergenInvented": false,
  "priceInvented": false,
  "foodSafetyComplianceClaimed": false,
  "findings": [],
  "limitations": [
    "Recipes, supplier prices, sales, waste, and allergen rows are copied only from labeled fields supplied by the caller.",
    "Recipe cost uses supplied quantities and prices after unit conversion. Missing prices are not invented.",
    "Unit conversion covers common mass and volume units. Count units convert only to the same count family.",
    "Allergen validation uses only explicitly supplied ingredient allergen flags and menu claims.",
    "Nutritional values are never invented. No legal food-safety compliance is claimed."
  ]
}

cURL

curl -i -X POST "https://brainiac.software/api/v1/restaurant-operations/food-cost-report" \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
  --data-binary @- <<'JSON'
{
  "ingredients": [
    {
      "id": "flour",
      "name": "Flour",
      "unit": "g",
      "unitPrice": 0.002
    },
    {
      "id": "butter",
      "name": "Butter",
      "unit": "g",
      "unitPrice": 0.012
    }
  ],
  "prices": [
    {
      "ingredientId": "flour",
      "supplierId": "A",
      "unit": "kg",
      "unitPrice": 1.8,
      "asOf": "2026-10-01"
    },
    {
      "ingredientId": "flour",
      "supplierId": "A",
      "unit": "kg",
      "unitPrice": 2.2,
      "asOf": "2026-11-01"
    }
  ],
  "recipes": [
    {
      "id": "R-1",
      "name": "Cookie",
      "portions": 10,
      "sellPrice": 3
    }
  ],
  "recipeLines": [
    {
      "recipeId": "R-1",
      "ingredientId": "flour",
      "quantity": 500,
      "unit": "g"
    },
    {
      "recipeId": "R-1",
      "ingredientId": "butter",
      "quantity": 100,
      "unit": "g"
    }
  ],
  "sales": [
    {
      "recipeId": "R-1",
      "units": 40
    }
  ],
  "waste": [
    {
      "ingredientId": "flour",
      "quantity": 100,
      "unit": "g",
      "reason": "spill"
    }
  ],
  "allergens": [
    {
      "ingredientId": "flour",
      "allergen": "gluten",
      "present": true
    },
    {
      "ingredientId": "butter",
      "allergen": "milk",
      "present": true
    }
  ],
  "matrix": [
    {
      "recipeId": "R-1",
      "allergen": "gluten",
      "claimed": true
    },
    {
      "recipeId": "R-1",
      "allergen": "milk",
      "claimed": true
    }
  ]
}
JSON