Endpoint
POST
/functions/v1/decodeInputs
- input_mode: unstructured, structured or decode_id
- Unstructured input with foodText, foodImage, foodImageUrl, foodVoice, foodVoiceUrl or attachments
- Structured input with a non-empty items array
- decode_id input with decode_food_id
Returns
- 202 queued response with job_id and status_url
- Status response with queued, processing, completed or failed
- Completed result with recognized foods, reusable decode_food_id values and molecular measurements
Request details
- Use exactly one input mode. Do not mix decode_food_id with food text, images, voice or structured items.
- Optional compound_identifier_names or compound_identifier_ids can narrow molecular output to selected compounds.
- Set include_compound_identifier_value or include_measurement_min_max only when those additional fields are needed.
Response details
- Poll GET /functions/v1/decode?job_id=... until status is completed or failed.
- Status polling returns result when available and error when a job fails.
- Use include_result=false or result=none on status requests when you only need the job state.
Operational notes
- Requires x-api-key with the edge:decode scope.
- POST usage is counted and quota headers are returned when available.
- Large media payloads should be sent only when needed; URLs or attachments are preferable for repeated workflows.
Examples
Request JSON
{
"input_mode": "unstructured",
"foodText": "Greek yogurt with blueberries, walnuts and honey"
}Response JSON
{
"job_id": "8a93f4...",
"status": "queued",
"status_url": "https://tirqjzahcinadeulfylj.supabase.co/functions/v1/decode?job_id=8a93f4..."
}Code examples
curl -X POST 'https://tirqjzahcinadeulfylj.supabase.co/functions/v1/decode' \
-H 'x-api-key: $MYMOLECULES_API_KEY' \
-H 'Content-Type: application/json' \
--data '{ "input_mode": "unstructured", "foodText": "Greek yogurt with blueberries, walnuts and honey"}'