---
title: "Run food-processor matcher modules (internal testing)"
method: POST
path: "/internal/matcher/match"
tags: ["internal"]
---

# Run food-processor matcher modules (internal testing)

`POST /internal/matcher/match`

Requires elevated permissions. Exercise matcher components outside the MPQ flow. Minimal body: { "patient_id": 123, "food": "apple" } (defaults to composite_production). Provide either meal_photo_queue_id (full QueueLabelContext) or patient_id. Send modules to override preset (not both). Packaged matcher presets are testable here even though prod packaged MPQs still route through composite MATCH_V2.

## Request body

- MatcherTestMatchRequest
  - `brand` string, nullable
  - `food` string, required
  - `include_debug` boolean — When true, include detailed canonical algorithm debug in results[].debug_info for the canonical module: query_inference (LLM canonical name, ontology, inferred properties), canonical_algorithm_weights, per-candidate score breakdowns (ontology_breakdown, property_breakdown.property_scores), and all ranked candidates.
  - `include_health_context` boolean — When true, include the patient's health/dietary context (diet restrictions, recent meals and meal sizes) in the matcher context, and therefore in the LLM prompt and Langfuse trace. Defaults to false so test runs do not send patient health signals unless explicitly requested. Only applies when patient_id is used.
  - `meal_photo_queue_id` integer, nullable — When set, builds QueueLabelContext from this MPQ (same as pipeline).
  - `modules` string[], nullable — Override preset with explicit module list (send preset or modules, not both).
  - `patient_id` integer, nullable — Required when meal_photo_queue_id is omitted.
  - `patient_note` string, nullable — Optional patient note override when using patient_id.
  - `preparation_method` string, nullable
  - `preset` 'composite_matcher' | 'simple_matcher' | 'packaged_matcher' | 'composite_production' | 'composite_batch_production' | 'simple_production' | 'packaged_production', nullable — Matcher pipeline preset. Defaults to composite_production when omitted and modules unset.

## Response `200`

successful operation

- MatcherTestMatchResponse
  - `langfuse_session_id` string, required
  - `matcher_modules_requested` string[], nullable
  - `matcher_modules_resolved` string[], required
  - `matcher_preset` string, nullable
  - `module_order_applied` 'production' | 'caller', required
  - `modules_executed` string[], required
  - `modules_skipped` MatcherTestModuleSkip[], required
    - `module` string, required
    - `reason` string, required
  - `results` MatcherTestModuleResult[], required
    - `debug_info` object, nullable
    - `food_name` string, nullable
    - `is_custom_item` boolean, nullable
    - `matched` boolean, required
    - `module` string, required
    - `rxfood_id` string, nullable
    - `source` string, nullable
  - `text_decomp` object, nullable

## Other responses

- `400` — invalid request
- `403` — not authorized
- `404` — patient or meal photo queue not found

---

[API](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server.md) · [All operations](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/rxfoodapp/inneranalytics-mnt-server/revisions/0703cbbbefe8/schema)
