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

# Calculate payment for a code

> Compose payment for a code at a CCN.

Returns up to four blocks — ``physician`` (MPFS), ``outpatient_facility``
(OPPS with wage index), ``lab`` (CLFS), and ``dme`` (DMEPOS) — populated
based on which fee schedules carry the code.

Logic for each block:

* **physician** — ``allowed = ((work*pw_gpci) + (pe*pe_gpci) + (mp*mp_gpci)) * CF``
  where ``CF`` is QPP (33.5675) or non-QPP (33.4009) for 2026 and ``pe`` is
  the facility or non-facility PE-RVU based on the CCN's facility_type.
* **outpatient_facility** — ``allowed = (rate*0.6*wage_index) + (rate*0.4)``
  using the FY26 wage index for the facility's CBSA.
* **lab** — flat CLFS rate (national, no geographic adjustment).
* **dme** — rural or non-rural rate based on the facility's ``is_rural`` flag.



## OpenAPI

````yaml /docs/openapi.client.json get /v1/codes/{code}/payment
openapi: 3.1.0
info:
  description: >-
    Client API for RCIntel. Admin ingest, catalog sync, and internal audit
    routes are omitted. See Guides → Which API to use.
  summary: Multi-tenant knowledge API for healthcare revenue cycle management.
  title: Healthcare Knowledge Layer
  version: 0.1.0
servers: []
security: []
tags:
  - description: >-
      Geographic payer policy lookup (national NCD vs MAC LCD vs state). Query
      payer, code, state, plan_type. Each row includes geo_scope and
      document_version.
    name: policies
  - description: >-
      Payer network directory — search payers, check prior auth requirements,
      view filing rules, denial patterns, and appeal levels.
    name: payers
  - description: >-
      Resolve healthcare billing knowledge across the L1-L6 layer stack.
      Includes payment calculation, billing guidance, and per-layer queries.
    name: knowledge
  - description: >-
      CMS Fee Schedule lookups — OPPS (Addendum B / APC), DMEPOS (state-level
      pricing), and Clinical Lab Fee Schedule (CLFS).
    name: fee-schedules
  - description: >-
      NCCI (National Correct Coding Initiative) — dedicated MUE limits, PTP
      bundling edits, add-on code edits, and code pair validation.
    name: ncci
  - description: >-
      Service code intelligence — CPT/HCPCS lookup, RVU data, NCCI edits,
      payment calculation, implant/GUDID search, and service group
      classification.
    name: codes
  - description: >-
      Submit asynchronous AI agent jobs for code research, medical necessity,
      and denial resolution. Poll for results and retrieve reasoning traces.
    name: agents
  - description: >-
      Register and manage healthcare facilities by CCN (Medicare Provider
      Number). Each facility is the root entity for knowledge resolution.
    name: facilities
  - description: >-
      NPI Registry — live search against CMS NPPES API for provider and
      organization National Provider Identifiers.
    name: npi
  - description: >-
      OpenFDA drug product lookup by NDC. Includes product-level fields with
      normalized ingredient and package detail.
    name: drugs
  - description: Health checks, service metadata, and Prometheus metrics.
    name: system
paths:
  /v1/codes/{code}/payment:
    get:
      tags:
        - codes
      summary: Calculate payment for a code
      description: >-
        Compose payment for a code at a CCN.


        Returns up to four blocks — ``physician`` (MPFS),
        ``outpatient_facility``

        (OPPS with wage index), ``lab`` (CLFS), and ``dme`` (DMEPOS) — populated

        based on which fee schedules carry the code.


        Logic for each block:


        * **physician** — ``allowed = ((work*pw_gpci) + (pe*pe_gpci) +
        (mp*mp_gpci)) * CF``
          where ``CF`` is QPP (33.5675) or non-QPP (33.4009) for 2026 and ``pe`` is
          the facility or non-facility PE-RVU based on the CCN's facility_type.
        * **outpatient_facility** — ``allowed = (rate*0.6*wage_index) +
        (rate*0.4)``
          using the FY26 wage index for the facility's CBSA.
        * **lab** — flat CLFS rate (national, no geographic adjustment).

        * **dme** — rural or non-rural rate based on the facility's ``is_rural``
        flag.
      operationId: calculate_code_payment_v1_codes__code__payment_get
      parameters:
        - description: >-
            Billing or terminology code value (CPT/HCPCS/NDC/etc depending on
            endpoint context).
          in: path
          name: code
          required: true
          schema:
            title: Code
            type: string
        - description: CCN — drives facility-aware composition
          in: query
          name: ccn
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: CCN — drives facility-aware composition
            title: Ccn
        - description: Optional HCPCS modifier (e.g. 26, TC, LT)
          in: query
          name: modifier
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Optional HCPCS modifier (e.g. 26, TC, LT)
            title: Modifier
        - description: ISO date — reserved for future fee-schedule versioning
          in: query
          name: date_of_service
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: ISO date — reserved for future fee-schedule versioning
            title: Date Of Service
        - description: Use QPP conversion factor (True) or non-QPP (False)
          in: query
          name: qpp
          required: false
          schema:
            default: true
            description: Use QPP conversion factor (True) or non-QPP (False)
            title: Qpp
            type: boolean
        - description: 0=non-QPP, 1=QPP — overrides qpp when supplied
          in: query
          name: qpp_ind
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: 0=non-QPP, 1=QPP — overrides qpp when supplied
            title: Qpp Ind
        - description: GPCI locality override (legacy; ignored when ccn is set)
          in: query
          name: locality
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: GPCI locality override (legacy; ignored when ccn is set)
            title: Locality
        - description: >-
            POS code (e.g. 11 office, 22 on-campus outpatient). Pins the
            facility vs non-facility PE-RVU choice; overrides facility_type/CCN
            defaults.
          in: query
          name: place_of_service
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              POS code (e.g. 11 office, 22 on-campus outpatient). Pins the
              facility vs non-facility PE-RVU choice; overrides
              facility_type/CCN defaults.
            title: Place Of Service
        - description: 'Legacy: use facility PE rate when no CCN is supplied'
          in: query
          name: facility
          required: false
          schema:
            default: true
            description: 'Legacy: use facility PE rate when no CCN is supplied'
            title: Facility
            type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodePaymentResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - APIKeyHeader: []
components:
  schemas:
    CodePaymentResponse:
      description: >-
        Multi-block payment composition for a HCPCS / CPT code at a facility.


        When ``ccn`` is provided, the response is composed against the
        facility's

        geography (LOCCO → GPCI, CBSA → wage_index). When omitted, only the

        ``physician`` block is populated using the supplied ``locality`` query

        param (legacy GPCI-only behavior).


        ``applicable_blocks`` lists which sub-blocks have data — drives display

        on the consuming UI.
      properties:
        applicable_blocks:
          items:
            type: string
          title: Applicable Blocks
          type: array
        ccn:
          anyOf:
            - type: string
            - type: 'null'
          title: Ccn
        code:
          title: Code
          type: string
        conversion_factor:
          title: Conversion Factor
          type: number
        date_of_service:
          anyOf:
            - type: string
            - type: 'null'
          title: Date Of Service
        dme:
          anyOf:
            - $ref: '#/components/schemas/DMEPaymentBlock'
            - type: 'null'
        estimated_payment:
          anyOf:
            - type: number
            - type: 'null'
          title: Estimated Payment
        facility:
          anyOf:
            - $ref: '#/components/schemas/FacilityContextBlock'
            - type: 'null'
        facility_rate:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Facility Rate
        lab:
          anyOf:
            - $ref: '#/components/schemas/LabPaymentBlock'
            - type: 'null'
        locality:
          anyOf:
            - type: string
            - type: 'null'
          title: Locality
        mp_gpci:
          anyOf:
            - type: number
            - type: 'null'
          title: Mp Gpci
        mp_rvu_adjusted:
          anyOf:
            - type: number
            - type: 'null'
          title: Mp Rvu Adjusted
        outpatient_facility:
          anyOf:
            - $ref: '#/components/schemas/FacilityPaymentBlock'
            - type: 'null'
        pe_gpci:
          anyOf:
            - type: number
            - type: 'null'
          title: Pe Gpci
        pe_rvu_adjusted:
          anyOf:
            - type: number
            - type: 'null'
          title: Pe Rvu Adjusted
        physician:
          anyOf:
            - $ref: '#/components/schemas/PhysicianPaymentBlock'
            - type: 'null'
        policy_rules:
          items:
            $ref: '#/components/schemas/PolicyRuleResponse'
          title: Policy Rules
          type: array
        pw_gpci:
          anyOf:
            - type: number
            - type: 'null'
          title: Pw Gpci
        qpp:
          default: true
          description: QPP-participating conversion factor used
          title: Qpp
          type: boolean
        reliability:
          $ref: '#/components/schemas/ReliabilityMetadata'
          description: User-visible reliability metadata for this payment composition.
        total_adjusted_rvu:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Adjusted Rvu
        work_rvu_adjusted:
          anyOf:
            - type: number
            - type: 'null'
          title: Work Rvu Adjusted
      required:
        - code
        - conversion_factor
      title: CodePaymentResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    DMEPaymentBlock:
      description: DMEPOS payment — picks rural vs non-rural rate by facility flag.
      properties:
        allowed_dme_payment:
          title: Allowed Dme Payment
          type: number
        dme_payment_rate:
          title: Dme Payment Rate
          type: number
        is_rural:
          default: false
          title: Is Rural
          type: boolean
        rate_used:
          default: non_rural
          description: '''rural'' or ''non_rural'''
          title: Rate Used
          type: string
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
      required:
        - dme_payment_rate
        - allowed_dme_payment
      title: DMEPaymentBlock
      type: object
    FacilityContextBlock:
      description: Facility context used to drive payment composition.
      properties:
        cbsa:
          anyOf:
            - type: string
            - type: 'null'
          title: Cbsa
        ccn:
          title: Ccn
          type: string
        county:
          anyOf:
            - type: string
            - type: 'null'
          title: County
        facility_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Facility Type
        is_rural:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Rural
        locality_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Locality Name
        locality_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Locality Number
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        pos_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Pos Code
        registered:
          default: true
          description: >-
            True when geography came from a facility registered to the tenant
            (county-precise locality + CBSA wage index). False when it was
            derived from the raw CCN (state-level 'Rest of State' locality; no
            CBSA wage index).
          title: Registered
          type: boolean
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
        wage_index:
          anyOf:
            - type: number
            - type: 'null'
          title: Wage Index
      required:
        - ccn
      title: FacilityContextBlock
      type: object
    LabPaymentBlock:
      description: >-
        Clinical Lab Fee Schedule payment (national rate, no geographic
        adjustment).
      properties:
        allowed_lab_payment:
          title: Allowed Lab Payment
          type: number
        indicator:
          anyOf:
            - type: string
            - type: 'null'
          title: Indicator
        lab_payment_rate:
          title: Lab Payment Rate
          type: number
      required:
        - lab_payment_rate
        - allowed_lab_payment
      title: LabPaymentBlock
      type: object
    FacilityPaymentBlock:
      description: |-
        OPPS / outpatient hospital facility payment block.

        payment = (rate * 0.6 * wage_index) + (rate * 0.4)
      properties:
        allowed_fac_payment:
          title: Allowed Fac Payment
          type: number
        apc_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Apc Code
        labor_share:
          default: 0.6
          title: Labor Share
          type: number
        non_labor_share:
          default: 0.4
          title: Non Labor Share
          type: number
        opps_payment_rate:
          title: Opps Payment Rate
          type: number
        relative_weight:
          anyOf:
            - type: number
            - type: 'null'
          title: Relative Weight
        status_indicator:
          anyOf:
            - type: string
            - type: 'null'
          title: Status Indicator
        wage_index:
          default: 1
          title: Wage Index
          type: number
      required:
        - opps_payment_rate
        - allowed_fac_payment
      title: FacilityPaymentBlock
      type: object
    PhysicianPaymentBlock:
      description: >-
        MPFS payment block — work + PE + MP, GPCI-adjusted, then * conversion
        factor.
      properties:
        allowed_phy_payment:
          title: Allowed Phy Payment
          type: number
        conversion_factor:
          title: Conversion Factor
          type: number
        mp_gpci:
          title: Mp Gpci
          type: number
        mp_rvu:
          title: Mp Rvu
          type: number
        mp_rvu_adjusted:
          title: Mp Rvu Adjusted
          type: number
        pe_gpci:
          title: Pe Gpci
          type: number
        pe_rvu:
          description: fac_pe_rvu when facility, otherwise non_fac_pe_rvu
          title: Pe Rvu
          type: number
        pe_rvu_adjusted:
          title: Pe Rvu Adjusted
          type: number
        pe_rvu_source:
          default: facility
          description: 'Which PE RVU was used: ''facility'' or ''non_facility'''
          title: Pe Rvu Source
          type: string
        pw_gpci:
          title: Pw Gpci
          type: number
        rvu_quarter:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            CMS fee-schedule quarter (1-4) of the RVU row used, when the source
            tracks quarters.
          title: Rvu Quarter
        rvu_source:
          default: postgres
          description: >-
            Backend the RVUs were read from: 'postgres' (legacy seed) or
            'clickhouse' (mart_fee_schedule).
          title: Rvu Source
          type: string
        rvu_year:
          anyOf:
            - type: integer
            - type: 'null'
          description: CMS fee-schedule year of the RVU row used for this calculation.
          title: Rvu Year
        total_adjusted_rvu:
          title: Total Adjusted Rvu
          type: number
        work_rvu:
          title: Work Rvu
          type: number
        work_rvu_adjusted:
          title: Work Rvu Adjusted
          type: number
      required:
        - pw_gpci
        - pe_gpci
        - mp_gpci
        - work_rvu
        - pe_rvu
        - mp_rvu
        - work_rvu_adjusted
        - pe_rvu_adjusted
        - mp_rvu_adjusted
        - total_adjusted_rvu
        - conversion_factor
        - allowed_phy_payment
      title: PhysicianPaymentBlock
      type: object
    PolicyRuleResponse:
      description: Policy-rule evidence extracted from CMS transmittals and linked by code.
      properties:
        action:
          anyOf:
            - type: string
            - type: 'null'
          title: Action
        change_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Change Type
        code:
          title: Code
          type: string
        discovery_depth:
          default: 0
          title: Discovery Depth
          type: integer
        doc_id:
          title: Doc Id
          type: string
        effective_from:
          anyOf:
            - type: string
            - type: 'null'
          title: Effective From
        kind:
          title: Kind
          type: string
        license_kind:
          default: public
          title: License Kind
          type: string
        lineage_root_doc_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Lineage Root Doc Id
        parent_doc_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Doc Id
        pdf_uri:
          title: Pdf Uri
          type: string
        rule_text:
          title: Rule Text
          type: string
        source_key:
          title: Source Key
          type: string
        trigger_condition:
          anyOf:
            - type: string
            - type: 'null'
          title: Trigger Condition
      required:
        - code
        - source_key
        - doc_id
        - pdf_uri
        - kind
        - rule_text
      title: PolicyRuleResponse
      type: object
    ReliabilityMetadata:
      description: User-visible reliability metadata attached to API responses.
      properties:
        data_sources:
          additionalProperties:
            type: string
          description: Data-source backends used to build this response.
          title: Data Sources
          type: object
        dataset_versions:
          additionalProperties:
            type: string
          description: >-
            CMS/DHCS/NLM/FDA named versions used to compose this response (e.g.
            mpfs=CY2026, ipps=FY2026). See GET /v1/data/changes.
          title: Dataset Versions
          type: object
        degraded:
          default: false
          description: True when a fallback or non-primary source path was used.
          title: Degraded
          type: boolean
        generated_at:
          description: UTC timestamp when the response payload was composed.
          title: Generated At
          type: string
        warnings:
          description: Human-readable caveats relevant to downstream consumers.
          items:
            type: string
          title: Warnings
          type: array
      required:
        - generated_at
      title: ReliabilityMetadata
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-Key
      type: apiKey

````