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

# Infer



## OpenAPI

````yaml https://api.medlistiq.com/openapi.json post /v1/medications/infer
openapi: 3.1.0
info:
  title: MedListIQ
  description: Infer a deduplicated medication list from FHIR medication resources.
  version: 0.1.0
servers:
  - url: https://api.medlistiq.com
    description: Production
security: []
paths:
  /v1/medications/infer:
    post:
      summary: Infer
      operationId: infer_v1_medications_infer_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InferRequest'
        required: true
      responses:
        '200':
          description: >-
            Inferred medication list. Default shape (`format=inferred_list`) is
            shown below — pick from the union by request `verbosity`:
            `InferResponseMinimal` (verbosity=minimal), `InferResponseStandard`
            (verbosity=standard), or `InferResponseFull` (verbosity=full, adds
            provenance dict). When `format=fhir_bundle` the body is a FHIR R4
            Bundle of MedicationRequest (+ Provenance at full verbosity). When
            `format=fhir_array` it's a flat array of FHIR resources. See
            https://docs.medlistiq.com/guides/output-formats for examples and
            the response-header reference.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/InferResponseFull'
                  - $ref: '#/components/schemas/InferResponseStandard'
                  - $ref: '#/components/schemas/InferResponseMinimal'
                title: Response 200 Infer V1 Medications Infer Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    InferRequest:
      properties:
        resources:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Resources
        bundle:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Bundle
        as_of:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: As Of
        format:
          $ref: '#/components/schemas/OutputFormat'
          default: inferred_list
        verbosity:
          $ref: '#/components/schemas/Verbosity'
          default: minimal
        statuses:
          anyOf:
            - items:
                type: string
                enum:
                  - active
                  - completed
                  - stopped
                  - cancelled
                  - unknown
              type: array
            - type: 'null'
          title: Statuses
          description: >-
            Optional status filter. When present, only medications with an
            inferred status in this list are returned. When omitted, all
            statuses are returned.
      type: object
      title: InferRequest
    InferResponseFull:
      properties:
        medications:
          items:
            $ref: '#/components/schemas/InferredMedicationStandard'
          type: array
          title: Medications
        provenance:
          additionalProperties:
            $ref: '#/components/schemas/MedicationProvenance'
          type: object
          title: Provenance
        meta:
          $ref: '#/components/schemas/InferMeta'
      type: object
      required:
        - medications
        - provenance
        - meta
      title: InferResponseFull
    InferResponseStandard:
      properties:
        medications:
          items:
            $ref: '#/components/schemas/InferredMedicationStandard'
          type: array
          title: Medications
        meta:
          $ref: '#/components/schemas/InferMeta'
      type: object
      required:
        - medications
        - meta
      title: InferResponseStandard
    InferResponseMinimal:
      properties:
        medications:
          items:
            $ref: '#/components/schemas/InferredMedicationMinimal'
          type: array
          title: Medications
        meta:
          $ref: '#/components/schemas/InferMeta'
      type: object
      required:
        - medications
        - meta
      title: InferResponseMinimal
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OutputFormat:
      type: string
      enum:
        - inferred_list
        - fhir_bundle
        - fhir_array
      title: OutputFormat
      description: >-
        Response envelope shape.


        - `inferred_list` (default): our proprietary JSON with `medications`,
          optional `provenance` dict, and `meta` in the body. Ergonomic for
          dashboards and CDS engines.
        - `fhir_bundle`: a FHIR R4 Bundle (type: searchset) of MedicationRequest
          resources, plus Provenance resources at verbosity=full. Meta moves to
          response headers.
        - `fhir_array`: a flat array of FHIR resources. MedicationRequest only
        at
          minimal/standard; mixed MedicationRequest + Provenance at full.
          Pipeline-friendly. Meta in response headers.
    Verbosity:
      type: string
      enum:
        - minimal
        - standard
        - full
      title: Verbosity
    InferredMedicationStandard:
      properties:
        id:
          type: string
          title: Id
        display_name:
          type: string
          title: Display Name
        rxnorm_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Rxnorm Code
        rxnorm_system:
          anyOf:
            - type: string
            - type: 'null'
          title: Rxnorm System
        status:
          type: string
          enum:
            - active
            - completed
            - stopped
            - cancelled
            - unknown
          title: Status
        confidence:
          type: number
          title: Confidence
        sig:
          anyOf:
            - type: string
            - type: 'null'
          title: Sig
        dosage:
          anyOf:
            - $ref: '#/components/schemas/DosageStandard'
            - type: 'null'
        indication:
          anyOf:
            - $ref: '#/components/schemas/Indication'
            - type: 'null'
        last_activity_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Activity Date
      type: object
      required:
        - id
        - display_name
        - status
        - confidence
      title: InferredMedicationStandard
      description: Our opinionated med list with semantic codes. No provenance.
    MedicationProvenance:
      properties:
        sources:
          items:
            type: string
          type: array
          title: Sources
        evidence:
          items:
            type: string
          type: array
          title: Evidence
        enrichments:
          items:
            $ref: '#/components/schemas/Enrichment'
          type: array
          title: Enrichments
      type: object
      title: MedicationProvenance
      description: Audit trail for a single inferred medication.
    InferMeta:
      properties:
        request_id:
          type: string
          title: Request Id
        ruleset_version:
          type: string
          title: Ruleset Version
        as_of:
          type: string
          format: date-time
          title: As Of
        processing_time_ms:
          type: integer
          title: Processing Time Ms
        input_resource_count:
          type: integer
          title: Input Resource Count
        output_medication_count:
          type: integer
          title: Output Medication Count
      type: object
      required:
        - request_id
        - ruleset_version
        - as_of
        - processing_time_ms
        - input_resource_count
        - output_medication_count
      title: InferMeta
    InferredMedicationMinimal:
      properties:
        display_name:
          type: string
          title: Display Name
        status:
          type: string
          enum:
            - active
            - completed
            - stopped
            - cancelled
            - unknown
          title: Status
        confidence:
          type: number
          title: Confidence
        sig:
          anyOf:
            - type: string
            - type: 'null'
          title: Sig
        indication:
          anyOf:
            - type: string
            - type: 'null'
          title: Indication
      type: object
      required:
        - display_name
        - status
        - confidence
      title: InferredMedicationMinimal
      description: 'Leanest shape: just the essentials for clients who want a quick answer.'
    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
    DosageStandard:
      properties:
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        patient_instruction:
          anyOf:
            - type: string
            - type: 'null'
          title: Patient Instruction
        timing:
          anyOf:
            - $ref: '#/components/schemas/FrequencyCodingStandard'
            - type: 'null'
        when:
          anyOf:
            - items:
                $ref: '#/components/schemas/TimingWhenStandard'
              type: array
            - type: 'null'
          title: When
        duration:
          anyOf:
            - $ref: '#/components/schemas/Duration'
            - type: 'null'
        as_needed:
          anyOf:
            - type: boolean
            - type: 'null'
          title: As Needed
        site:
          anyOf:
            - type: string
            - type: 'null'
          title: Site
        route:
          anyOf:
            - $ref: '#/components/schemas/RouteCodingStandard'
            - type: 'null'
        method:
          anyOf:
            - $ref: '#/components/schemas/MethodCodingStandard'
            - type: 'null'
        dose_quantity:
          anyOf:
            - $ref: '#/components/schemas/DoseQuantity'
            - type: 'null'
        dose_range:
          anyOf:
            - $ref: '#/components/schemas/DoseRange'
            - type: 'null'
        dose_form:
          anyOf:
            - type: string
            - type: 'null'
          title: Dose Form
      type: object
      title: DosageStandard
      description: Dosage for standard verbosity.
    Indication:
      properties:
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        snomed_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Snomed Code
        snomed_display:
          anyOf:
            - type: string
            - type: 'null'
          title: Snomed Display
        icd10_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Icd10 Code
        icd10_display:
          anyOf:
            - type: string
            - type: 'null'
          title: Icd10 Display
      type: object
      title: Indication
    Enrichment:
      properties:
        field:
          type: string
          title: Field
        value:
          type: string
          title: Value
        reason:
          type: string
          title: Reason
      type: object
      required:
        - field
        - value
        - reason
      title: Enrichment
    FrequencyCodingStandard:
      properties:
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        code_system:
          anyOf:
            - type: string
            - type: 'null'
          title: Code System
        ncit_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Ncit Code
        ncit_display:
          anyOf:
            - type: string
            - type: 'null'
          title: Ncit Display
      type: object
      title: FrequencyCodingStandard
      description: Frequency coding for standard verbosity.
    TimingWhenStandard:
      properties:
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        code_system:
          anyOf:
            - type: string
            - type: 'null'
          title: Code System
        ncit_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Ncit Code
        ncit_display:
          anyOf:
            - type: string
            - type: 'null'
          title: Ncit Display
      type: object
      title: TimingWhenStandard
      description: Timing when event for standard verbosity.
    Duration:
      properties:
        value:
          anyOf:
            - type: number
            - type: 'null'
          title: Value
        unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Unit
        display:
          anyOf:
            - type: string
            - type: 'null'
          title: Display
      type: object
      title: Duration
    RouteCodingStandard:
      properties:
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        snomed_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Snomed Code
        snomed_display:
          anyOf:
            - type: string
            - type: 'null'
          title: Snomed Display
        ncit_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Ncit Code
        ncit_display:
          anyOf:
            - type: string
            - type: 'null'
          title: Ncit Display
      type: object
      title: RouteCodingStandard
      description: Route coding without source_codings (those live in provenance).
    MethodCodingStandard:
      properties:
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        snomed_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Snomed Code
        snomed_display:
          anyOf:
            - type: string
            - type: 'null'
          title: Snomed Display
        ncit_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Ncit Code
        ncit_display:
          anyOf:
            - type: string
            - type: 'null'
          title: Ncit Display
      type: object
      title: MethodCodingStandard
      description: Method coding for standard verbosity.
    DoseQuantity:
      properties:
        value:
          anyOf:
            - type: number
            - type: 'null'
          title: Value
        unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Unit
        system:
          anyOf:
            - type: string
            - type: 'null'
          title: System
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
      type: object
      title: DoseQuantity
    DoseRange:
      properties:
        low_value:
          anyOf:
            - type: number
            - type: 'null'
          title: Low Value
        high_value:
          anyOf:
            - type: number
            - type: 'null'
          title: High Value
        unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Unit
      type: object
      title: DoseRange
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        MedListIQ API key (format: `ml_...`). Create one at [Dashboard → API
        Keys](https://medlistiq.com/dashboard/keys).

````