API Reference

Stable, public, no-auth endpoints under /api/v1. Hosted at https://www.allnutrition.info.

Endpoints at a glance

MethodPathDescription
POST /api/v1/ask Answer a nutrition question with citations.
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.

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.
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?"}'

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.