API Reference

Stable, public endpoints under /api/v1. Hosted at https://www.allnutrition.info. A free API key is required (Authorization: Bearer ank_…, created under Settings → API keys); every account gets the same daily allowance — see Rate limits.

Endpoints at a glance

MethodPathDescription
POST /api/v1/ask Answer a nutrition question with citations.
POST /api/v1/ask/prompt Evidence pack for your own model to answer from (no LLM).
POST /api/v1/references/search Semantic search of the curated reference library (no LLM).
GET /api/v1/health Liveness probe.
GET /openapi.json Machine-readable OpenAPI 3.1 specification.

POST /api/v1/ask

Answer a nutrition question with peer-reviewed citations.

Request body

FieldTypeDescription
questionstring (1–1000)Required. The question, in plain English.
published_afterISO-8601 datetimeOptional. Only consider sources published on or after this date.
deep_researchboolean (default false)Optional. Run the deep-research pipeline: the question is expanded into multiple targeted sub-queries and the answer is a comprehensive, sectioned research report. Slower (typically 30–90 s).
shareboolean (default false)Optional. Persist the question and answer as a public, read-only Ask session and return its URL in share_url.
save_sessionboolean (default true)Optional. Save the question and answer to your Ask history in the app (badged as an API/MCP session). Set false to skip.

Response (200)

FieldTypeDescription
questionstringEcho of the original question.
answerstring (Markdown)Evidence-grounded answer.
evidence_strengthstrong | moderate | limited | insufficientStrength of the underlying evidence.
consensus_levelhigh | moderate | mixed | lowHow well the cited sources agree.
last_updatedISO-8601 / nullMost recent publication among cited sources.
deep_researchbooleanWhether the answer was produced by the deep-research pipeline.
share_urlstring / nullPublic URL of the shared Ask session. Only present when the request set share: true.
session_idstring / nullID of the Ask session saved to your in-app history. Absent when the request set save_session: false.
sources[]arrayCitations (see Source object).

Example

curl -X POST https://www.allnutrition.info/api/v1/ask \
  -H "Content-Type: application/json" \
  -d '{"question": "Is creatine safe for adolescents who lift weights?"}'

Deep research

Set "deep_research": true to trade latency for depth. Instead of a single retrieval pass, the pipeline expands your question into 3–8 targeted sub-queries (e.g. safety, efficacy, mechanisms), retrieves and merges sources for each, and synthesizes a comprehensive Markdown report with inline citations and a summary section. Expect responses in 30–90 seconds and a much longer answer. A deep-research call counts as one request against the rate limit.

Shareable Ask sessions

Set "share": true to persist the question and answer as a public, read-only Ask session. The response's share_url points to a web page (https://www.allnutrition.info/shared/<slug>) showing the question, the answer, and its citations — useful for handing users a permanent, human-readable link from a chatbot or agent. Notes:

curl -X POST https://www.allnutrition.info/api/v1/ask \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What does the evidence say about intermittent fasting?",
    "deep_research": true,
    "share": true
  }'
# → { ..., "deep_research": true,
#     "share_url": "https://www.allnutrition.info/shared/Ab3dEf9hIj2kLm5n" }

POST /api/v1/ask/prompt

Retrieve the evidence for a question and return it as an evidence pack for your own model: no answer is generated on our side, so the call is fast (a few seconds). Retrieval is the same as /api/v1/ask; because the excerpts are returned word for word, the pack holds only abstracts and openly licensed (CC BY) full text. This is what the MCP ask_nutrition tool returns to ChatGPT and Claude.

Request body

FieldTypeDescription
questionstring (1–1000)Required. The question, in plain English.
published_afterISO-8601 datetimeOptional. Only consider sources published on or after this date.
deep_researchboolean (default false)Optional. A larger pack (up to 30 references) with report-writing guidelines.
search_queriesstring[] (≤ 10)Optional, deep research only. Extra targeted searches (2–5 work best), one per sub-topic; each is searched and the results merged with the question's.
save_sessionboolean (default true)Optional. Save the question and its sources to your Ask history in the app. Set false to skip.

Response (200)

FieldTypeDescription
questionstringEcho of the original question.
promptstringThe evidence pack: source-quality labels, answer guidelines (citation format, audience, how to weigh the evidence) and the numbered sources with citation details and excerpts. Pass it to your model.
evidence_strengthstrong | moderate | limited | insufficientQuality of the sources in the pack.
consensus_levelhigh | moderate | mixed | lowHow well the sources in the pack agree.
last_updatedISO-8601 / nullMost recent publication among the sources.
deep_researchbooleanWhether this is a deep-research pack.
session_idstring / nullID of the Ask session saved to your in-app history.
sources[]arrayThe pack's sources, in the order they are numbered in prompt (see Source object).
curl -X POST https://www.allnutrition.info/api/v1/ask/prompt \
  -H "Authorization: Bearer ank_your_key" \
  -H "Content-Type: application/json" \
  -d '{"question": "Is creatine safe for healthy adults to take daily?"}'

POST /api/v1/references/search

Return ranked sources for a query without generating an answer.

Request body

FieldTypeDescription
querystring (1–1000)Required. Free-text query.
max_resultsinteger (1–20, default 10)Maximum sources to return.
published_afterISO-8601 / nullOptional cutoff.

Response (200)

FieldTypeDescription
querystringEcho of the query.
countintegerNumber of results returned.
results[]arraySources (see Source object), ranked by relevance × trust.

Source object

Both endpoints return sources with the same shape.

FieldTypeDescription
idstring (UUID)Stable AllNutrition reference ID.
titlestringTitle of the paper, guideline, or article.
urlstring / nullCanonical URL (DOI, journal page, guideline URL).
publisherstringIssuing journal, organisation, or guideline body.
publisher_short_namestring / nullShort identifier (e.g. WHO, AHA, NICE).
evidence_levelenumguideline | systematic_review | rct | observational | expert_opinion | review
trust_scorefloat [0, 1]Composite trust: authority × recency × evidence × consensus.
published_atISO-8601 / nullPublication date.
excerptstringVerbatim chunk used as RAG context.
passagestring / nullShort human-readable preview where available.

Errors

StatusMeaning
400Invalid payload (e.g. empty question, query too long).
429Rate limit exceeded — see Rate limits & errors.
500Unexpected server error. Safe to retry with backoff.
503Upstream model temporarily unavailable.

Interactive explorer

Try requests live against the API in the interactive Scalar explorer →

The interactive explorer is rendered from the same OpenAPI spec served at /openapi.json. You can download the spec and use it with Postman, Insomnia, Stoplight, or any OpenAPI-compatible tool.