> ## Documentation Index
> Fetch the complete documentation index at: https://docs.locusmedical.fr/llms.txt
> Use this file to discover all available pages before exploring further.

# Structured clinical search

> Search the clinical knowledge base and return structured, citable document units — never a free-form answer. Foundation for `answer` and `context`.



## OpenAPI

````yaml /openapi.json post /v1/search
openapi: 3.1.0
info:
  title: Locus API
  description: >-
    Locus knowledge layer — REST + MCP for clinical knowledge.


    Two categories of surface:

    - **query** (read) — `/v1/search`, `/v1/answer`, `/v1/context` (legacy Meili
    contract serving AlmaPro) and `/v2/retrieve` (knowledge-graph retrieval, MKF
    0.1.3).

    - **ops** — `/health`.


    The write plane (PDF → Neo4j graph: ingest, summarize, MKU extraction) is
    NOT exposed over HTTP — it is a batch pipeline driven by the `locus` CLI,
    which runs where the source PDFs are.
  version: 0.2.0
servers:
  - url: https://core.locusmedical.fr
    description: Production
security: []
paths:
  /v1/search:
    post:
      tags:
        - query
      summary: Structured clinical search
      description: >-
        Search the clinical knowledge base and return structured, citable
        document units — never a free-form answer. Foundation for `answer` and
        `context`.
      operationId: search_endpoint_v1_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - lsk: []
components:
  schemas:
    SearchRequest:
      properties:
        query:
          type: string
          minLength: 1
          title: Query
          description: >-
            Free-text clinical query in French, matched against the clinical
            knowledge base.
          examples:
            - antibioprophylaxie chirurgie colorectale
            - prise en charge HTA gravidique
        source_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Source Ids
          description: >-
            Optional allow-list of source ids to restrict retrieval to specific
            sources. Omit (the default) to search all sources.
          examples:
            - []
        limit:
          type: integer
          maximum: 50
          minimum: 1
          title: Limit
          description: Maximum number of structured document units to return.
          default: 10
        max_chunks_per_unit:
          type: integer
          maximum: 20
          minimum: 1
          title: Max Chunks Per Unit
          description: >-
            Maximum number of best-matching chunks to keep per document unit.
            Lower keeps the payload tight; raise to expose more excerpts.
          default: 3
      type: object
      required:
        - query
      title: SearchRequest
    SearchResponse:
      properties:
        query:
          type: string
          title: Query
          description: Echo of the submitted query.
        units:
          items:
            $ref: '#/components/schemas/SearchUnit'
          type: array
          title: Units
          description: >-
            Structured document units, ordered by relevance. Each is a citable
            source — never a free-form answer blob.
        retrieved_pool:
          type: integer
          title: Retrieved Pool
          description: >-
            Diagnostic: number of raw chunks swept from the knowledge base
            before grouping into units. This is the retrieval pool size, NOT
            bounded by `limit` (which caps returned units).
      type: object
      required:
        - query
        - units
        - retrieved_pool
      title: SearchResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SearchUnit:
      properties:
        document_id:
          type: integer
          title: Document Id
          description: Stable id of the source document.
        document_title:
          type: string
          title: Document Title
          description: Title of the source document.
        reco_id:
          type: integer
          title: Reco Id
          description: Id of the parent recommendation.
        reco_title:
          type: string
          title: Reco Title
          description: Title of the parent recommendation.
        source_id:
          type: integer
          title: Source Id
          description: Id of the issuing source (société savante, etc.).
        source_name:
          type: string
          title: Source Name
          description: Short name of the issuing source, e.g. 'HAS'.
        year:
          anyOf:
            - type: string
            - type: 'null'
          title: Year
          description: Publication year, if known.
        deep_link:
          anyOf:
            - type: string
            - type: 'null'
          title: Deep Link
          description: Direct link to the source document (PDF/page).
        score:
          type: number
          title: Score
          description: Best chunk score for this document — units are ordered by it.
        chunks:
          items:
            $ref: '#/components/schemas/SearchChunk'
          type: array
          title: Chunks
          description: >-
            Best-matching chunks from this document, most relevant first (capped
            by `max_chunks_per_unit`).
      type: object
      required:
        - document_id
        - document_title
        - reco_id
        - reco_title
        - source_id
        - source_name
        - score
        - chunks
      title: SearchUnit
      description: One source document with its best-matching chunks — a citable unit.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SearchChunk:
      properties:
        chunk_index:
          type: integer
          title: Chunk Index
          description: Position of the chunk within its document.
        content:
          type: string
          title: Content
          description: Raw chunk text matched by the query.
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
          description: Relevance score for this chunk.
      type: object
      required:
        - chunk_index
        - content
      title: SearchChunk
  securitySchemes:
    lsk:
      type: http
      description: Locus API key — paste the raw `lsk_…` value (no 'Bearer ' prefix).
      scheme: bearer

````