Endpoint
POST
/functions/v1/get_decode_food_idInputs
- Structured items[] with food names and optional quantities
- Or unstructured foodText, foodImage or foodVoice
Returns
- 202 queued response with job_id, status_url and meta
- Final decode_food_id after polling
- Structured items used to build the ID
Request details
- Use items for already-structured food input.
- Use foodText, foodImage or foodVoice when the API should structure the food input first.
- Legacy foods and canonicalFoods fields are rejected.
Response details
- Poll GET /functions/v1/get_decode_food_id?job_id=... until status is completed or failed.
- Completed status responses include result.decode_food_id and result.structured_items.
- The meta object includes retry_count and timestamps when available.
Operational notes
- Requires x-api-key with the edge:get_decode_food_id scope for job creation.
- This utility is asynchronous because unstructured input may require food parsing and matching.
- Store the returned decode_food_id when later Decode or lookup calls need the same food set.
Examples
Request JSON
{
"foodText": "Greek yogurt with blueberries, walnuts and honey"
}Response JSON
{
"job_id": "9a2f41...",
"status": "queued",
"status_url": "https://tirqjzahcinadeulfylj.supabase.co/functions/v1/get_decode_food_id?job_id=9a2f41...",
"meta": {
"retry_count": 0,
"completed_at": null
}
}Code examples
curl -X POST 'https://tirqjzahcinadeulfylj.supabase.co/functions/v1/get_decode_food_id' \
-H 'x-api-key: $MYMOLECULES_API_KEY' \
-H 'Content-Type: application/json' \
--data '{ "foodText": "Greek yogurt with blueberries, walnuts and honey"}'