> ## 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.

# Ingest a source PDF into the knowledge graph

> Parse a source PDF (sections → chunks → embeddings) and write the vector-store sub-graph (Source←Doc→Section→Chunk). Idempotent by content-derived ids. PDF resolved from the server's PDF dir by doc_id, or provided as base64.



## OpenAPI

````yaml /openapi.json post /v1/ingest
openapi: 3.1.0
info:
  title: Locus API
  description: Locus knowledge layer — REST + MCP for clinical knowledge.
  version: 0.1.0
servers:
  - url: https://core.locusmedical.fr
    description: Production
  - url: http://localhost:8000
    description: Local
security: []
paths:
  /v1/ingest:
    post:
      tags:
        - ingest
      summary: Ingest a source PDF into the knowledge graph
      description: >-
        Parse a source PDF (sections → chunks → embeddings) and write the
        vector-store sub-graph (Source←Doc→Section→Chunk). Idempotent by
        content-derived ids. PDF resolved from the server's PDF dir by doc_id,
        or provided as base64.
      operationId: ingest_endpoint_v1_ingest_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IngestRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IngestResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - lsk: []
components:
  schemas:
    IngestRequest:
      properties:
        doc_id:
          type: string
          title: Doc Id
          description: >-
            Identifiant du document (clé Supabase). PDF attendu :
            {dir}/{doc_id}.pdf
        source_id:
          type: string
          title: Source Id
          description: Identifiant de la source/éditeur (ex. HAS, ebmfrance)
        source_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Name
          description: Nom lisible de la source
        reco_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Reco Id
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
        year:
          anyOf:
            - type: integer
            - type: 'null'
          title: Year
        version:
          type: string
          title: Version
          description: Version du document (fige les ancres de chunk)
          default: ''
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        status:
          type: string
          enum:
            - current
            - superseded
          title: Status
          default: current
        pdf_base64:
          anyOf:
            - type: string
            - type: 'null'
          title: Pdf Base64
          description: PDF encodé base64 ; sinon lu depuis {ingest_pdf_dir}/{doc_id}.pdf
        embed:
          type: boolean
          title: Embed
          description: Calculer les embeddings des chunks à l'ingestion
          default: true
      type: object
      required:
        - doc_id
        - source_id
      title: IngestRequest
    IngestResponse:
      properties:
        doc_id:
          type: string
          title: Doc Id
        source_id:
          type: string
          title: Source Id
        sections:
          type: integer
          title: Sections
        chunks:
          type: integer
          title: Chunks
        embedded:
          type: boolean
          title: Embedded
        section_method:
          type: string
          title: Section Method
      type: object
      required:
        - doc_id
        - source_id
        - sections
        - chunks
        - embedded
        - section_method
      title: IngestResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    lsk:
      type: http
      description: Locus API key — paste the raw `lsk_…` value (no 'Bearer ' prefix).
      scheme: bearer

````