Endpoint
/functions/v1/designCreate recipes or meal plans from text, voice or structured requirements, tailored to dietary needs and preferences.
2026-09-29 is the newest public version. Send it in mymolecules-api-version when submitting and polling. Without the header, Design uses a legacy response format. An unsupported version returns HTTP 400 (unsupported_api_version).
For API-key setup and secure storage, see Authentication.
Choose an input mode
Both modes produce the same kind of result. Choose based on whether your application already has structured requirements or receives them as text or voice. Your API key must allow the selected mode; otherwise, Design returns HTTP 403 (design_input_mode_not_allowed).
| Mode | When to use it | What to send |
|---|---|---|
| Structured | Your application already has explicit recipe or plan requirements. | Send input_mode: structured, type and the supported fields below. Do not include request_text or request_voice. |
| Unstructured | The person describes the desired recipe or plan in natural language. | Send input_mode: unstructured and type with request_text, request_voice, or both. Describe your recipe or meal-plan requirements in the text or recording. You can send technical options separately, such as image delivery, nutrient analysis, whether to use existing recipes and completion callbacks. |
Request fields
Common fields
| Field | Type | Description |
|---|---|---|
input_mode | string | Required for new jobs. structured or unstructured. Your API key must allow the selected mode; otherwise, HTTP 403 (design_input_mode_not_allowed). A missing, unknown or conflicting mode returns HTTP 400 (invalid_request) before a job is created. Polling does not require this field. |
type | string | Required. recipe or meal_plan. |
image_delivery | string | Optional: none (default), signed_url. Image generation is part of job completion when requested. |
image_target_size | string | Optional image dimensions as WIDTHxHEIGHT; each dimension must be 50–2048 pixels. |
image_fit | string | Optional image fit: cover, contain or stretch. |
include_nutrient_analysis | boolean | Optional. Default false; when true, include energy, carbohydrates, fat and protein for each recipe. |
callback_url | string | Optional. HTTPS endpoint configured for this API key. Its URL must match the key’s callback configuration; public DNS is required. A registered callback is acknowledged in the accepted response. |
skip_stored_recipes | boolean | Optional. Default false. Set true to generate new recipes instead of using matching existing recipes. |
Text and voice input
| Field | Type | Description |
|---|---|---|
request_text | string | Required unless request_voice is supplied; both can be combined. Must contain non-whitespace text, at most 16,000 characters. For a meal plan, describe the number of days and meals per day. |
request_voice | string | Required unless request_text is supplied; both can be combined. Inline base64 audio data URL, at most 25 MiB decoded. Supported MIME types: audio/mpeg, audio/mp3, audio/mp4, audio/x-m4a, audio/m4a, audio/wav, audio/x-wav, audio/webm, video/mp4. Remote URLs are not accepted. |
Structured recipe
| Field | Type | Description |
|---|---|---|
recipe_count | integer | Optional. Number of distinct recipes, 1–10; default 1. |
meal_type | string | Optional: breakfast, lunch, dinner or snack. |
diet | string | Optional: vegan, vegetarian, fish, seafood or meat. |
Structured meal plan
| Field | Type | Description |
|---|---|---|
plan_days | integer | Required. Number of days, 1–7. |
meals_per_day | object | Required. breakfast, lunch, dinner and snack each accept 0–2; omitted categories count as zero. At least one meal per day and no more than 56 meals total. |
diet_pattern | string | Optional: vegan, vegetarian, pescatarian, omnivore or flexitarian. Guides the mix of lunch and dinner diets across the plan. |
excluded_diets | string[] | Optional. Exclude any of vegan, vegetarian, fish, seafood or meat. At least one diet must remain available. |
Structured preferences and constraints
| Field | Type | Description |
|---|---|---|
language | string | Optional. German is the only supported value and the current output language, even when omitted. |
gender | string | Optional: male or female. Supply when condition-specific nutrition rules require it. |
difficulty | string | Optional: easy, medium or hard. |
max_total_time_min | integer | Optional. Positive maximum preparation plus cooking time in minutes. |
price | string | Optional recipe price category in euros: <5€, 5-10€ or >10€. This is a selection preference, not a guaranteed shopping price. |
clean | boolean | Optional. Set true to prefer high-fiber, predominantly plant-based recipes with unprocessed or minimally processed ingredients, without emulsifiers or additives. Meat is not automatically excluded. |
excluded_allergens | string[] | "all" | Optional. Use all or an array of: gluten_containing_cereals, crustaceans, eggs, fish, peanuts, soybeans, milk, nuts, celery, mustard, sesame, sulphur_dioxide_and_sulphites, lupin, molluscs. |
taste | string[] | Optional: sweet, salty, bitter, sour, umami. |
aroma | string[] | Optional: Fruity, Citrus, Floral, Herbaceous, Spicy, Vanilla, Nutty, Roasted, Smoky, Cooling, Meaty, Fermented, Earthy, Fishy, Oily. |
texture | string[] | Optional: hard, adhesive, viscose, cohesive, crispy, crunchy, elastic, grainy. |
sensory_profile | string[] | Optional: fresh-vibrant, sweet-gentle, savory-hearty, toasted-crunchy, exotic-aromatic. Do not combine with taste, aroma or texture. |
condition | string | string[] | Optional. Use exact names from Supported conditions below, not free-text diagnoses. Unknown names are rejected. Some condition-specific rules require gender or daily energy bounds; a matching result is not guaranteed. |
preferred_foods | string | Optional. Non-empty food preference, at most 1,000 characters. |
avoided_foods | string | Optional. Non-empty foods to avoid, at most 1,000 characters. |
exclusive_ingredients | string | string[] | Optional. Restrict ingredients to the supplied non-empty list; joined length at most 1,000 characters. |
compound_filters | object[] | Optional. Each entry requires compound (case-insensitive name) or positive integer compound_id, operator (<= or >=), finite numeric threshold and unit. When both identifiers are supplied, they must name the same compound. Use kcal for Energy (7744), g or mg for other compounds. Recipes require scope: portion; plans accept portion or day, with portion as the default. |
daily_energy_kcal_min | number | Optional positive daily minimum in kcal. Requires daily_energy_kcal_max and must not exceed it. For a recipe, meal_type and meal_energy_distribution are also required. |
daily_energy_kcal_max | number | Optional positive daily maximum in kcal. Requires daily_energy_kcal_min and must not be below it. For a recipe, meal_type and meal_energy_distribution are also required. |
meal_energy_distribution | object[] | Optional only with the daily energy pair. Entries use meal_type and a positive share: up to 1 is a fraction (0.3 = 30%, 1 = 100%); above 1 is a percentage (30 = 30%), at most 100. Zero is invalid. A recipe needs exactly one entry matching meal_type. A plan allows up to four distinct active meal types; normalized shares must total at most 1, or exactly 1 when every active type is specified. |
Supported conditions 14
calorie_restriction_level_1calorie_restriction_level_2calorie_restriction_level_3calorie_restriction_level_4fructose_restriction_lowfructose_restriction_moderatefructose_restriction_strictgluten_restrictionhistamine_restriction_moderatehistamine_restriction_strictlactose_restriction_moderatelactose_restriction_strictsodium_restriction_moderatesodium_restriction_strict
Use only one calorie restriction level at a time and supply both daily energy bounds for it. Condition names select nutrition constraints; they are not diagnoses or a guarantee of suitability.
Request examples
Text request
{
"input_mode": "unstructured",
"type": "recipe",
"request_text": "Create two vegetarian high-protein dinners with no peanuts."
}Structured recipe
{
"input_mode": "structured",
"type": "recipe",
"recipe_count": 2,
"meal_type": "dinner",
"diet": "vegetarian",
"excluded_allergens": [
"peanuts"
],
"max_total_time_min": 30,
"include_nutrient_analysis": true
}Structured meal plan
{
"input_mode": "structured",
"type": "meal_plan",
"plan_days": 3,
"meals_per_day": {
"breakfast": 1,
"lunch": 1,
"dinner": 1
},
"diet_pattern": "pescatarian",
"excluded_allergens": [
"peanuts"
]
}Submit and poll a job
POST returns HTTP 202 with job_id and status_url. GET that URL with the same key and version header until completed or failed. A found failed job still returns HTTP 200.
Accepted POST · HTTP 202
{
"data": {
"job_id": "d72f91f9-06a4-472f-b718-87c3513e9682",
"status": "queued",
"status_url": "<STATUS_URL_FROM_RESPONSE>"
},
"meta": {
"request_id": "req_...",
"api_version": "2026-09-29"
}
}Completed poll · HTTP 200
{
"data": {
"job_id": "d72f91f9-06a4-472f-b718-87c3513e9682",
"status": "completed",
"result": {
"recipes": [
{
"title": "Chickpea and spinach skillet",
"prep_time_min": 10,
"cook_time_min": 15,
"total_time_min": 25,
"difficulty": "easy",
"ingredients": [
{
"name": "chickpeas",
"quantity": 150,
"unit": "g"
},
{
"name": "spinach",
"quantity": 80,
"unit": "g"
}
],
"steps": [
"Cook the ingredients until tender."
]
}
]
},
"error": null
},
"meta": {
"request_id": "req_...",
"api_version": "2026-09-29"
}
}Poll with cURL
Save the returned status_url as STATUS_URL.
curl "$STATUS_URL" \
-H "x-api-key: $MYMOLECULES_API_KEY" \
-H "mymolecules-api-version: 2026-09-29"- Wait a few seconds between polls and set your own maximum waiting time. queued and processing are not final states; data.error stays null while the job is running.
- If you reach your waiting limit, save job_id and check the same job later rather than submitting it again. No fixed processing time is guaranteed.
- Save results you need in your own system. Completed and failed jobs are currently removed more than 30 days after completion; this is not a guaranteed retention period. Image links can expire sooner: check image.expires_at and poll again for a fresh link while the job is available.
Job response fields
| Field | Type | Description |
|---|---|---|
data.job_id | string | UUID identifying the job. Save it or the status_url returned by POST. |
data.status | string | queued, processing, completed or failed. A found job returns HTTP 200 even when status is failed. |
data.status_url | string | POST only. URL to GET with the same API key and version header. |
data.result | object | null | GET only. Present when completed; otherwise null. |
data.error | object | null | GET only. Job failure code and message when failed; otherwise null. |
meta.request_id | string | Request identifier for logs and support. |
meta.api_version | string | 2026-09-29 for this contract. |
meta.callback_registered | boolean | POST only when a callback_url was accepted; true means completion delivery was registered. |
Result fields
Fields inside data.result.
| Field | Type | Description |
|---|---|---|
recipes | object[] | Recipe jobs only. Contains exactly recipe_count recipes on success. |
meal_plan | object | Meal-plan jobs only. Contains the complete plan. |
meal_plan.days | object[] | One entry for each requested day, in order. |
meal_plan.days[].day | integer | Day number, starting at 1. |
meal_plan.days[].meals | object[] | The requested meals for this day. |
meal_plan.days[].meals[].meal_type | string | breakfast, lunch, dinner or snack. |
meal_plan.days[].meals[].recipe | object | One-portion recipe with the fields below. |
Recipe fields
Fields inside each entry of data.result.recipes[] or data.result.meal_plan.days[].meals[].recipe.
- Design currently returns recipe titles, ingredients and instructions in German. Each recipe is one portion, including recipes within a meal plan.
- Nutrient values for newly generated recipes are estimates, not measured food composition. Values are per recipe portion: energy in kcal, carbohydrates, fat and protein in mg.
| Field | Type | Description |
|---|---|---|
title | string | Recipe title. |
prep_time_min | number | Preparation time in minutes. |
cook_time_min | number | Cooking time in minutes. |
total_time_min | number | Total preparation and cooking time in minutes. |
difficulty | string | easy, medium or hard. |
ingredients | object[] | Ingredients and amounts for one recipe portion. |
ingredients[].name | string | Ingredient name. |
ingredients[].quantity | number | Ingredient amount in the supplied unit. |
ingredients[].unit | string | Display unit, such as g or ml. |
steps | string[] | Preparation instructions in order. |
nutrient_analysis | object | Present when include_nutrient_analysis is true. Values describe one recipe portion. |
nutrient_analysis.energy | object | Energy in kcal. |
nutrient_analysis.energy.name | string | Nutrient display name. |
nutrient_analysis.energy.value | number | Amount per recipe portion. |
nutrient_analysis.energy.unit | string | kcal. |
nutrient_analysis.carbohydrates | object | Carbohydrates in mg. |
nutrient_analysis.carbohydrates.name | string | Nutrient display name. |
nutrient_analysis.carbohydrates.value | number | Amount per recipe portion. |
nutrient_analysis.carbohydrates.unit | string | mg (not g). |
nutrient_analysis.fat | object | Fat in mg. |
nutrient_analysis.fat.name | string | Nutrient display name. |
nutrient_analysis.fat.value | number | Amount per recipe portion. |
nutrient_analysis.fat.unit | string | mg (not g). |
nutrient_analysis.protein | object | Protein in mg. |
nutrient_analysis.protein.name | string | Nutrient display name. |
nutrient_analysis.protein.value | number | Amount per recipe portion. |
nutrient_analysis.protein.unit | string | mg (not g). |
image | object | Present when image_delivery is signed_url. |
image.delivery | string | signed_url. |
image.mime_type | string | Image MIME type. |
image.width | integer | Image width in pixels. |
image.height | integer | Image height in pixels. |
image.url | string | signed_url only. Temporary URL for downloading the image. |
image.expires_at | string | signed_url only. URL expiry as an ISO 8601 timestamp; this is not the job expiry. |
Completion callbacks
Contact us to enable callbacks for your API key, register your HTTPS endpoint and obtain a separate callback signing secret. This secret is not your API key; keep both server-side.
If callbacks are enabled for your API key, send its configured HTTPS callback_url. The accepted POST then contains meta.callback_registered: true. Design POSTs an event when the job completes or fails. Return any 2xx response to acknowledge it; delivery is attempted up to eight times total. Deduplicate by delivery_id, then GET status_url with the same API key for the result.
Callback body
{
"event": "job_done",
"job_id": "d72f91f9-06a4-472f-b718-87c3513e9682",
"status": "completed",
"status_url": "https://api.mymolecules.de/functions/v1/design?job_id=d72f91f9-06a4-472f-b718-87c3513e9682",
"occurred_at": "2026-10-01T10:00:00Z",
"delivery_id": "<DELIVERY_ID>"
}X-Design-Event is job_done; X-Design-Delivery-Id matches delivery_id. X-Design-Signature has the form t=<Unix seconds>,v1=<hex HMAC-SHA256>. Verify the HMAC-SHA256 signature over the exact UTF-8 bytes of the timestamp, a dot and the raw request body. Verify before parsing or processing the event and reject stale timestamps.
Verify the signature (Node.js)
import { createHmac, timingSafeEqual } from 'node:crypto'
// rawBody is the exact request body received by your HTTPS handler.
const signatureHeader = request.headers['x-design-signature']
const match = /^t=(\d+),v1=([a-f0-9]{64})$/.exec(signatureHeader ?? '')
if (!match) throw new Error('Invalid signature header')
const [, timestamp, suppliedHex] = match
const expected = createHmac('sha256', process.env.DESIGN_CALLBACK_SECRET)
.update(timestamp + '.' + rawBody).digest()
const supplied = Buffer.from(suppliedHex, 'hex')
if (!timingSafeEqual(expected, supplied)) throw new Error('Invalid signature')
// Also reject timestamps outside your permitted clock-skew window.
// Deduplicate on delivery_id, then GET status_url with your Design API key.Handle errors
If a request fails, check error.code. Polling a found failed job still returns HTTP 200: check data.status and read data.error when it is failed.
Request errors
| Code | HTTP status | Description |
|---|---|---|
invalid_request | 400 or 405 | Correct missing, unsupported or conflicting fields, invalid JSON or an invalid callback URL; then submit again. |
unsupported_api_version | 400 | Use a version listed in the version selector. |
idempotency_conflict | 409 | This Idempotency-Key was already used for a different request. Retry the original request unchanged, or use a new key for a new job. |
unauthorized | 401 or 403 | Supply an active x-api-key with Design access. Use the same key when polling. For callback requests, confirm callbacks are enabled for the key. |
design_input_mode_not_allowed | 403 | Your API key does not allow the selected input mode. Use an allowed mode or contact us to change the key’s permissions. No job is created. Existing jobs can still be polled with the same key. |
quota_exceeded | 429 | Your key’s quota does not allow this request. Wait for the quota to reset or contact us; repeated retries will not help. |
service_busy | 429 | Temporary capacity limit. Retry after the indicated delay, if supplied. |
job_creation_failed | 503 | The job could not be started. Follow the safe POST retry guidance below; contact support with the request ID if it persists. |
job_not_found | 404 | Check the ID and use the same API key. The job may have expired; see the result availability note above. |
technical_generation_error | 500/503 | Generation, result retrieval or callback configuration failed. Retry a job only if the cause is transient; contact support with the request ID for persistent failures. |
Job errors
| Code | HTTP status | Description |
|---|---|---|
invalid_request | 200 (failed job) | Correct missing, unsupported or conflicting fields, invalid JSON or an invalid callback URL; then submit again. |
quota_exceeded | 200 (failed job) | Your key’s quota does not allow this request. Wait for the quota to reset or contact us; repeated retries will not help. |
no_recipe_found | 200 (failed job) | Job failure: a complete set of matching recipes could not be produced. Relax constraints or reduce recipe_count. |
no_meal_plan_found | 200 (failed job) | Job failure: a complete plan could not be produced. Relax constraints or request fewer meals. |
job_deadline_exceeded | 200 (failed job) | Job failure: the plan did not finish in time. Submit a smaller or less restrictive request. |
conflicting_requirements | 200 (failed job) | Job failure: text and voice specified conflicting requirements. Resolve them and resubmit. |
voice_transcription_empty | 200 (failed job) | Job failure: the recording did not contain understandable speech. Re-record or send text. |
invalid_normalized_request | 200 (failed job) | Job failure: interpreted requirements were incomplete or invalid. State the missing details explicitly. |
technical_generation_error | 200 (failed job) | Generation, result retrieval or callback configuration failed. Retry a job only if the cause is transient; contact support with the request ID for persistent failures. |
Retry safely
- GET: retry polling after a network error or temporary server failure, with increasing delays. Follow Retry-After when supplied.
- POST: send an optional Idempotency-Key to avoid duplicate jobs if the response is lost. Generate a unique key for each new request, save it with the request and reuse it only with the same API key, body and version when retrying. Use 1–128 printable ASCII characters without spaces.
- Repeating that request returns HTTP 202 with the existing job_id and status_url; it does not restart the job. Poll for its current status. Reusing the key for a different request returns HTTP 409 (idempotency_conflict). Use a new key when you intentionally create a new job, including after a failed job.
- Without Idempotency-Key, another POST can create another job. x-request-id does not prevent duplicates. Do not retry blindly when it is unclear whether your request was accepted.
See the Errors & rate limits guide for the shared error envelope.
Code examples
curl -X POST 'https://api.mymolecules.de/functions/v1/design' \
-H "x-api-key: $MYMOLECULES_API_KEY" \
-H 'mymolecules-api-version: 2026-09-29' \
-H 'Content-Type: application/json' \
--data '{
"input_mode": "unstructured",
"type": "recipe",
"request_text": "Create a high-protein vegetarian dinner without peanuts"
}'Use the examples on your server and set MYMOLECULES_API_KEY in its environment. Python requires the requests package (pip install requests). Set network timeouts in your application.
For generated types and every response schema, use the OpenAPI specification.



