Endpoint
POST
/functions/v1/decideContract
Send mymolecules-api-version with 2026-07-10 to use the documented response contract.
{
"data": {},
"meta": {
"request_id": "req_...",
"api_version": "2026-07-10"
}
}Headers
Request
x-api-keyrequired - Server-side API key for your integration.mymolecules-api-versionrequired2026-07-10- Use the latest stable API version: 2026-07-10.Content-Typerequiredapplication/json- Required for JSON request bodies.
Response
x-request-idrequired - Request identifier. Log this value when contacting support.mymolecules-api-versionrequired2026-07-10- The API contract version used for the response.x-ratelimit-limitoptional - Quota limit for the current key and window when quota data is available.x-ratelimit-remainingoptional - Remaining requests in the current quota window when quota data is available.x-ratelimit-resetoptional - ISO timestamp for the current quota window reset when quota data is available.retry-afteroptional - Seconds to wait before retrying when the request is rate-limited or temporarily unavailable.
Inputs
- Required request_text with the complete decision question
- Optional options[] with 2 to 10 entries; each requires type and data
- Optional images[] with 1 to 5 image URLs or data URLs in free-text mode only
Returns
- Synchronous 200 response with status completed
- result.outcome, options, selected_option and reasoning
- Structured failed response for validation or upstream errors
Error codes
missing_api_keyinvalid_api_keyscope_not_allowedquota_exceededrate_limitedinvalid_jsoninvalid_requestinvalid_request_shapetoo_many_optionsinput_too_largeuser_context_not_alloweddetect_signals_not_allowedvalidation_errormethod_not_allowedunsupported_api_versionjob_not_foundbacklog_highservice_unavailableupstream_timeoutupstream_errorinternal_error
Request details
- Omit options for free-text mode. You may attach up to five images with images[] in this mode. When options are provided, only those options are compared in their original order; images[] cannot be combined with options; null and empty arrays are invalid.
- Text data must be non-empty; image data should be an image URL or supported image data URL; audio data should include mime_type when ambiguous.
- Put current preferences, conditions and decision context in request_text. Internal user_context is not accepted from public callers.
Response details
- No polling is required for Decide.
- Both modes use the same result schema. options contains consecutive 1-based IDs and readable labels. selected_option references one of these IDs for outcome selected; otherwise it is null.
- Failed responses contain status: failed, result: null and an error object.
Operational notes
- Requires x-api-key with the edge:decide scope.
- Usage is counted and rate-limit headers are returned when quota data is available.
- The API is scoped to nutrition decisions. Missing information is described in reasoning with outcome needs_information; incompatible choices use no_valid_option.
Examples
Request JSON
{
"request_text": "Oatmeal with berries or croissant and jam: which is better for steady energy?"
}Response JSON
{
"data": {
"status": "completed",
"result": {
"outcome": "selected",
"options": [{"id": 1, "label": "Oatmeal with berries"}, {"id": 2, "label": "Croissant and jam"}],
"selected_option": 1,
"reasoning": "Oatmeal is more likely to provide steady energy."
},
"error": null
},
"meta": {
"request_id": "req_...",
"api_version": "2026-07-10"
}
}Code examples
curl -X POST 'https://api.mymolecules.de/functions/v1/decide' \
-H "x-api-key: $MYMOLECULES_API_KEY" \
-H 'mymolecules-api-version: 2026-07-10' \
-H 'Content-Type: application/json' \
--data '{ "request_text": "Oatmeal with berries or croissant and jam: which is better for steady energy?"}'


