openapi: 3.1.0
info:
  title: Evipedia API
  version: "1.0.0"
  summary: Read-only access to evipedia.ai evidence reviews.
  description: >
    Public, key-less, read-only endpoints for evipedia.ai - a continuously
    updated encyclopedia of evidence reviews on health & longevity
    interventions. Every endpoint is a plain HTTP GET with no authentication.
    Content is licensed CC BY 4.0 (c) Forever Healthy Foundation; credit
    "evipedia.ai" and, where practical, link the review's permalink.
  license:
    name: CC BY 4.0
    url: https://creativecommons.org/licenses/by/4.0/
  contact:
    name: Evipedia - Made for Integration
    url: https://evipedia.ai/integration
servers:
  - url: https://evipedia.ai
    description: Production
tags:
  - name: catalog
    description: Whole-catalog indexes and feeds.
  - name: review
    description: Per-review resources, addressed by the review's slug.
  - name: search
    description: >
      Live relevance-ranked search, served by the hosted MCP server at
      mcp.evipedia.ai rather than the static site.
paths:
  /reviews.json:
    get:
      operationId: listReviews
      tags: [catalog]
      summary: Full review catalog
      description: >
        Every live review with its canonical name, alternate names, category,
        permalinks (HTML / Markdown / metadata), dates, and plain-text conclusion.
      responses:
        "200":
          description: Array of review index entries.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ReviewIndexEntry"
  /search.json:
    get:
      operationId: searchIndex
      tags: [catalog]
      summary: Search index
      description: >
        One lightweight entry per review (name, synonyms, keywords, category,
        url). Synonym- and drug-class-aware; the same index that powers the
        search box on the site.
      responses:
        "200":
          description: Array of search entries.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/SearchEntry"
  /categories.json:
    get:
      operationId: listCategories
      tags: [catalog]
      summary: Category index
      description: >
        The catalogue's sections: label, page url, the review `category` values
        each one covers, review count, and common wording for it. Turns a
        review's `category` into a browsable page.
      responses:
        "200":
          description: Array of category entries.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CategoryEntry"
  /search:
    get:
      operationId: searchReviews
      tags: [search]
      summary: Ranked review search
      servers:
        - url: https://mcp.evipedia.ai
          description: Hosted MCP server
      description: >
        Live relevance-ranked search over the review catalog, served by the
        hosted MCP server (mcp.evipedia.ai), not the static site. A discovery
        endpoint - it answers "does an evidence review exist for this?" and
        returns a compact list of matches (topic, permalink) ranked by
        Lunr relevance and capped at 20, so a search never balloons into 20 full
        conclusions. To read a match, fetch its full content via /{slug}.md or
        structured metadata via /{slug}.meta.json. Same query logic as the MCP
        `search_reviews` tool and the site's search box. Open CORS; rate-limited
        to 60 requests/minute per IP.
      parameters:
        - name: q
          in: query
          required: true
          description: Search query - intervention name, synonym, drug class, or category.
          schema:
            type: string
          example: rapamycin
      responses:
        "200":
          description: Ranked matches for the query.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SearchResults"
        "400":
          description: Missing the required `q` query parameter.
        "429":
          description: Rate limit exceeded (more than 60 requests/minute from one IP).
  /evipedia-corpus.jsonl:
    get:
      operationId: getCorpus
      tags: [catalog]
      summary: Full corpus (JSONL)
      description: >
        The entire catalogue in one file - one JSON object per line per review,
        each with metadata (slug, topic, url, category, dates, alternate_names,
        conclusion, citation) and the full public Markdown. Newline-delimited
        JSON (`application/x-ndjson`), ~25 MB.
      responses:
        "200":
          description: Newline-delimited JSON - one CorpusRecord per line.
          content:
            application/x-ndjson:
              schema:
                $ref: "#/components/schemas/CorpusRecord"
  /{slug}.md:
    get:
      operationId: getReviewMarkdown
      tags: [review]
      summary: Raw Markdown of a review
      description: >
        The complete evidence review as raw Markdown (frontmatter + full body),
        byte-for-byte, with no HTML to parse.
      parameters:
        - $ref: "#/components/parameters/Slug"
      responses:
        "200":
          description: The review as Markdown.
          content:
            text/markdown:
              schema:
                type: string
        "404":
          description: No review exists for that slug.
  /{slug}_er_qa.md:
    get:
      operationId: getReviewAuditMarkdown
      tags: [review]
      summary: Raw Markdown of a review's quality-assurance audit
      description: >
        The review's QA audit as raw Markdown - every checked item with its
        result, the pass counts, and the audit iterations.
      parameters:
        - $ref: "#/components/parameters/Slug"
      responses:
        "200":
          description: The audit as Markdown.
          content:
            text/markdown:
              schema:
                type: string
        "404":
          description: No review (or no audit) exists for that slug.
  /{slug}.meta.json:
    get:
      operationId: getReviewMetadata
      tags: [review]
      summary: Structured medical metadata of a review
      description: >
        Flattened medical metadata - publication/modified/last-reviewed dates,
        the typed `about` entity with alternate names, and an ordered
        primary-source citation list (PMIDs for PubMed sources). Derived from the
        same source as the review page's schema.org MedicalWebPage JSON-LD, so
        the two never drift.
      parameters:
        - $ref: "#/components/parameters/Slug"
      responses:
        "200":
          description: The review's medical metadata.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReviewMetadata"
        "404":
          description: No review exists for that slug.
  /updates.json:
    get:
      operationId: listUpdates
      tags: [catalog]
      summary: New and updated reviews
      description: >
        Same catalogue as the /updates page, as JSON: every live evidence
        review newest first (including QRS-less reviews such as X vs Y), with
        its short title, permalink, whether it is new or a refresh, and the
        publish/refresh date. Production omits ep_visible:false reviews.
      responses:
        "200":
          description: Array of update entries, newest first.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/UpdateEntry"
  /feed.xml:
    get:
      operationId: getUpdatesFeed
      tags: [catalog]
      summary: RSS feed of new and refreshed reviews
      responses:
        "200":
          description: RSS 2.0 feed.
          content:
            application/rss+xml:
              schema:
                type: string
  /llms.txt:
    get:
      operationId: getLlmsSignpost
      tags: [catalog]
      summary: Agent signpost (llmstxt.org)
      description: Plain-text signpost to every machine-readable surface, plus the stable review section anchors.
      responses:
        "200":
          description: Plain-text signpost.
          content:
            text/plain:
              schema:
                type: string
  /persona.md:
    get:
      operationId: getPersona
      tags: [catalog]
      summary: AI4L personality guidelines
      description: >
        Verbatim Markdown of the AI4L persona used for Evipedia's interactive
        conversations. Synced from AI4L-Dev (`prompts/PERSONA.md`).
      responses:
        "200":
          description: Markdown personality guidelines.
          content:
            text/markdown:
              schema:
                type: string
  /grokbot.md:
    get:
      operationId: getGrokBot
      tags: [catalog]
      summary: Grok Bot first-run instructions
      description: >
        Raw Markdown. Adopt /persona.md, connect the hosted MCP, look up
        reviews before answering.
      responses:
        "200":
          description: Markdown first-run instructions.
          content:
            text/markdown:
              schema:
                type: string
components:
  parameters:
    Slug:
      name: slug
      in: path
      required: true
      description: >
        The review's short slug - its `short_topic_lc`, i.e. the last path
        segment of its permalink (e.g. `rapamycin`). Available as the last
        segment of each `permalink` in /reviews.json.
      schema:
        type: string
      example: rapamycin
  schemas:
    UpdateEntry:
      type: object
      description: One entry in /updates.json (same data as the /updates page).
      required: [title, permalink, status, date]
      properties:
        title:
          type: string
          description: Short title shown on /updates (`short_topic`).
          example: Rapamycin
        permalink:
          type: string
          format: uri
          example: https://evipedia.ai/rapamycin
        status:
          type: string
          enum: [new, updated]
          description: >
            `new` when the review was first published (`ep_new`); `updated`
            when it is a refresh of an existing entry.
          example: new
        date:
          type: string
          format: date
          description: Publish or refresh date (ISO YYYY-MM-DD), newest first.
          example: "2026-08-19"
    CategoryEntry:
      type: object
      description: One entry in /categories.json.
      properties:
        canonical_name:
          type: string
          description: Long-form name of the section.
          example: Peptides
        description:
          type: string
          description: >
            One sentence describing the section, sized for a hover card
            (<=200 characters).
          example: Short chains of amino acids acting as signaling molecules, studied for repair, metabolism and body composition.
        permalink:
          type: string
          format: uri
          description: The section's own page.
          example: https://evipedia.ai/peptides
        ep_categories:
          type: array
          description: The `category` values in /reviews.json this section covers.
          items:
            type: string
          example: [peptide]
        alternate_names:
          type: array
          description: >
            Lowercase wording for the section, canonical_name excluded.
          items:
            type: string
          example: [peptide, peptide therapy, peptide therapies]
        review_count:
          type: integer
          example: 25
    ReviewIndexEntry:
      type: object
      description: One entry in /reviews.json.
      properties:
        canonical_name:
          type: string
          example: Rapamycin
        canonical_topic:
          type: string
          example: Rapamycin for Health & Longevity
        alternate_names:
          type: array
          description: Synonyms, plus curated common-usage aliases (e.g. "glp1", "turmeric").
          items:
            type: string
          example: [Sirolimus, Rapamune, AY-22989, WY-090217]
        permalink:
          type: string
          format: uri
          example: https://evipedia.ai/rapamycin
        permalink_md:
          type: string
          format: uri
          example: https://evipedia.ai/rapamycin.md
        permalink_meta:
          type: string
          format: uri
          example: https://evipedia.ai/rapamycin.meta.json
        category:
          type: string
          example: medication
        creation_date:
          type: string
          format: date
          example: "2026-07-10"
        dateModified:
          type: string
          format: date
          example: "2026-07-10"
        lastReviewed:
          type: string
          format: date
          example: "2026-07-10"
        er_conclusion:
          type: string
          description: Plain-text conclusion of the evidence review.
    CorpusRecord:
      type: object
      description: One line of /evipedia-corpus.jsonl (a single review).
      properties:
        slug:
          type: string
          example: rapamycin
        topic:
          type: string
          example: Rapamycin for Health & Longevity
        url:
          type: string
          format: uri
          example: https://evipedia.ai/rapamycin
        canonical_name:
          type: string
          example: Rapamycin
        category:
          type: string
          example: medication
        alternate_names:
          type: array
          items:
            type: string
        datePublished:
          type: string
          format: date
        dateModified:
          type: string
          format: date
        lastReviewed:
          type: string
          format: date
        conclusion:
          type: string
        citation:
          type: array
          items:
            $ref: "#/components/schemas/Citation"
        markdown:
          type: string
          description: Full public Markdown of the review, identical to /{slug}.md.
    SearchEntry:
      type: object
      description: One entry in /search.json.
      properties:
        short_topic:
          type: string
          description: Display name; goal-specific reviews carry a qualifier ("Botox (Skin)").
          example: Rapamycin
        canonical_name:
          type: string
          description: The bare name, as in /reviews.json ("Botox").
          example: Rapamycin
        alternate_names:
          type: string
          description: Comma-separated synonyms plus curated common-usage aliases (raw string, not an array).
          example: "Sirolimus, Rapamune, AY-22989, WY-090217"
        ep_keywords:
          type: string
          description: Comma-separated keywords / drug-class terms.
        url:
          type: string
          example: /rapamycin
    SearchResults:
      type: object
      description: The response body of GET /search (served by mcp.evipedia.ai).
      properties:
        query:
          type: string
          example: rapamycin
        count:
          type: integer
          description: Number of results returned (0-20).
          example: 1
        results:
          type: array
          items:
            $ref: "#/components/schemas/SearchResult"
    SearchResult:
      type: object
      description: >
        One ranked review match from GET /search. A discovery result - to read
        the review, fetch /{slug}.md or /{slug}.meta.json using the last path
        segment of `url` as the slug.
      required: [topic, url]
      properties:
        topic:
          type: string
          description: >
            The review's full canonical topic - the intervention with its
            explicit goal (e.g. "Rapamycin for Health & Longevity" or
            "Low-Level Light Therapy for Skin Rejuvenation"), as published in
            /reviews.json.
          example: Rapamycin for Health & Longevity
        url:
          type: string
          format: uri
          example: https://evipedia.ai/rapamycin
    ReviewMetadata:
      type: object
      description: The response body of /{slug}.meta.json.
      properties:
        slug:
          type: string
          example: rapamycin
        topic:
          type: string
          example: Rapamycin for Health & Longevity
        url:
          type: string
          format: uri
          example: https://evipedia.ai/rapamycin
        datePublished:
          type: string
          format: date
          example: "2026-07-10"
        dateModified:
          type: string
          format: date
          example: "2026-07-10"
        lastReviewed:
          type: string
          format: date
          example: "2026-07-10"
        about:
          type: object
          description: The intervention as a flattened schema.org entity.
          properties:
            type:
              type: string
              description: schema.org MedicalEntity subtype (e.g. Drug, Substance, DietarySupplement, MedicalTherapy).
              example: Drug
            name:
              type: string
              example: Rapamycin
            alternateName:
              type: array
              items:
                type: string
              example: [Sirolimus, Rapamune, AY-22989, WY-090217]
        citation:
          type: array
          description: Ordered primary-source citations, in page order.
          items:
            $ref: "#/components/schemas/Citation"
    Citation:
      type: object
      required: [name, url]
      properties:
        name:
          type: string
          example: "Targeting ageing with rapamycin and its derivatives in humans: a systematic review"
        url:
          type: string
          format: uri
          example: https://pubmed.ncbi.nlm.nih.gov/38310895/
        pmid:
          type: string
          description: PubMed ID; present only when the source is PubMed.
          example: "38310895"
