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

# List prior authorizations

> Return a paginated list of prior authorizations for your company. Filters narrow by status, decision, type, patient, servicing location, free-text patient name search, created-at date range, and expiration bucket.



## OpenAPI

````yaml https://api.getsolum.com/openapi.json get /v1/prior-authorizations
openapi: 3.1.0
info:
  title: Solum Health API
  description: '## Solum Health Backend API '
  version: 1.0.0
servers: []
security: []
paths:
  /v1/prior-authorizations:
    get:
      tags:
        - Prior Authorizations
      summary: List prior authorizations
      description: >-
        Return a paginated list of prior authorizations for your company.
        Filters narrow by status, decision, type, patient, servicing location,
        free-text patient name search, created-at date range, and expiration
        bucket.
      operationId: list_prior_authorizations_v1_prior_authorizations_get
      parameters:
        - name: expand[]
          in: query
          required: false
          schema:
            anyOf:
              - type: array
                items:
                  $ref: '#/components/schemas/PriorAuthorizationListExpand'
              - type: 'null'
            description: >-
              Relations to inline in each row. Repeatable, e.g.
              ?expand[]=requesting_provider&expand[]=servicing_location. `files`
              is not available here — use GET /{id} with `expand[]=files`.
            title: Expand[]
          description: >-
            Relations to inline in each row. Repeatable, e.g.
            ?expand[]=requesting_provider&expand[]=servicing_location. `files`
            is not available here — use GET /{id} with `expand[]=files`.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            default: 50
            title: Limit
        - name: starting_after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Starting After
        - name: ending_before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Ending Before
        - name: prior_auth_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Prior Auth Id
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/PriorAuthorizationStatusEnum'
              - type: 'null'
            title: Status
        - name: decision
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/PriorAuthorizationDecisionEnum'
              - type: 'null'
            title: Decision
        - name: type
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/PriorAuthorizationTypeEnum'
              - type: 'null'
            title: Type
        - name: patient_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Patient Id
        - name: insurance_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Insurance Id
        - name: servicing_location_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - const: none
                type: string
              - type: 'null'
            title: Servicing Location Id
        - name: organization_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - const: none
                type: string
              - type: 'null'
            title: Organization Id
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Search
        - name: auth_number
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Auth Number
        - name: date_from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            title: Date From
        - name: date_to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            title: Date To
        - name: expiring_within_days
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                maximum: 3650
                minimum: 0
              - type: 'null'
            title: Expiring Within Days
        - name: completion
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/CompletionFilterEnum'
            default: all
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PriorAuthorizationListResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: validation_error
                  code:
                    type: string
                    example: invalid_parameter
                  message:
                    type: string
                    example: Field validation failed
                  param:
                    type: string
                    example: phone_number
                required:
                  - type
                  - code
                  - message
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    PriorAuthorizationListExpand:
      type: string
      enum:
        - requesting_provider
        - servicing_provider
        - servicing_location
      title: PriorAuthorizationListExpand
      description: >-
        Allowed expand values for the PA LIST endpoint.


        Same as `PriorAuthorizationExpand` minus `files`: the list path never
        loads

        or signs per-row files (only `file_count`), so `files` expansion is a

        single-resource-only operation. Excluding it here makes FastAPI reject

        `?expand[]=files` on the list with a 422 rather than silently returning

        `files: null`.
    PriorAuthorizationStatusEnum:
      type: string
      enum:
        - pending
        - submitted
        - information_needed
        - decided
        - cancelled
      title: PriorAuthorizationStatusEnum
      description: Lifecycle state of a prior authorization.
    PriorAuthorizationDecisionEnum:
      type: string
      enum:
        - approved
        - partially_approved
        - denied
        - no_authorization_required
      title: PriorAuthorizationDecisionEnum
      description: Payor outcome on a decided authorization.
    PriorAuthorizationTypeEnum:
      type: string
      enum:
        - assessment
        - treatment
        - reassessment
        - reassessment_and_treatment
      title: PriorAuthorizationTypeEnum
      description: Authorization type.
    CompletionFilterEnum:
      type: string
      enum:
        - outstanding
        - completed
        - all
      title: CompletionFilterEnum
      description: >-
        Filter the listing by the clinic-owned completion flag.


        `outstanding` (default) hides done authorizations; `completed` shows
        only

        done; `all` ignores completion. Request-only — not a DB enum.
    PriorAuthorizationListResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/PriorAuthorizationResponse'
          type: array
          title: Data
        has_more:
          type: boolean
          title: Has More
        limit:
          type: integer
          title: Limit
      additionalProperties: false
      type: object
      required:
        - data
        - has_more
        - limit
      title: PriorAuthorizationListResponse
      description: >-
        Cursor-paginated list of prior authorization records.


        Stripe-style keyset pagination: no `total` or `page`. Use `has_more` to

        determine if another page exists. Fetch the next page by passing the
        `id`

        of the last record as `starting_after`; fetch the previous page by
        passing

        the `id` of the first record as `ending_before`.
    ErrorResponse:
      properties:
        type:
          type: string
          title: Type
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      additionalProperties: false
      type: object
      required:
        - type
        - code
        - message
      title: ErrorResponse
      description: >-
        Clean error response schema following RFC 7807 inspired format.


        Error is returned directly without wrapper, with all fields in
        snake_case.


        Fields:

        - type: Error category (e.g., "validation_error", "resource_error")

        - code: Specific error code (e.g., "resource_missing", "invalid_field")

        - message: Human-readable error message

        - param: The parameter that caused the error (optional)

        - meta: Generic free-form bag for resource-specific context (optional).
          For 409 resource_conflict responses the conflicting resource is nested
          here under the resource-specific key, e.g. ``meta.existing_patient``.
    PriorAuthorizationResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        company_id:
          type: string
          format: uuid
          title: Company Id
        created_by_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By User Id
        type:
          $ref: '#/components/schemas/PriorAuthorizationTypeEnum'
        status:
          $ref: '#/components/schemas/PriorAuthorizationStatusEnum'
        decision:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationDecisionEnum'
            - type: 'null'
        appeal_status:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationAppealStatusEnum'
            - type: 'null'
        appeal_notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Appeal Notes
          description: >-
            Rationale captured when an appeal was requested. Null when no appeal
            has been requested.
        appeal_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Appeal Number
          description: >-
            Appeal case/reference number issued by the payor. Null until the
            payor assigns one.
        appeal_availability:
          anyOf:
            - items:
                $ref: '#/components/schemas/AppealAvailabilitySlot'
              type: array
            - type: 'null'
          title: Appeal Availability
          description: >-
            Requester availability windows captured when an appeal was
            requested. Null when none provided.
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        patient_id:
          type: string
          format: uuid
          title: Patient Id
          description: >-
            Patient this authorization belongs to; use it to open the patient
            record. Demographics submitted on this PA are the frozen `patient_*`
            fields below.
        patient_first_name:
          type: string
          title: Patient First Name
          description: >-
            Patient first name as submitted on this authorization. Frozen at
            create time — not updated when the patient record changes.
        patient_last_name:
          type: string
          title: Patient Last Name
          description: >-
            Patient last name as submitted on this authorization. Frozen at
            create time.
        patient_date_of_birth:
          type: string
          format: date
          title: Patient Date Of Birth
          description: >-
            Patient date of birth (`YYYY-MM-DD`) as submitted on this
            authorization. Frozen at create time.
        payor_member_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Payor Member Id
          description: Member id as submitted on this authorization. Frozen at create time.
        payor_insurance_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Payor Insurance Id
          description: >-
            Insurance partner id (from the `insurances` catalog) as submitted on
            this authorization. Frozen at create time.
        payor_insurance_display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Payor Insurance Display Name
          description: >-
            Plan display name for this PA's payor, frozen at create time. Null ⇒
            display the insurance's canonical name.
        payor_insurance:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationInsurance'
            - type: 'null'
        requesting_provider_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Requesting Provider Id
          description: >-
            Credentialing-record id of the requesting provider. Always present
            unless the provider record was later removed (FK is ON DELETE SET
            NULL).
        servicing_provider_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Servicing Provider Id
          description: >-
            Credentialing-record id of the servicing provider. Null when the
            servicing provider is the same as the requesting provider or unset.
        servicing_location_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Servicing Location Id
          description: Company-location id where services are rendered. Null when unset.
        organization_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Organization Id
          description: >-
            Business entity (organization) this authorization belongs to. Null
            when unset.
        requesting_provider:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationProvider'
            - type: 'null'
          description: >-
            Expanded requesting-provider object. Present ONLY when requested via
            `expand[]=requesting_provider`; `null` otherwise. Use
            `requesting_provider_id` for the reference.
        servicing_provider:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationProvider'
            - type: 'null'
          description: >-
            Expanded servicing-provider object. Present ONLY when requested via
            `expand[]=servicing_provider`; `null` otherwise.
        servicing_location:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationServicingLocation'
            - type: 'null'
          description: >-
            Expanded servicing-location object. Present ONLY when requested via
            `expand[]=servicing_location`; `null` otherwise.
        created_by_user:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationUser'
            - type: 'null'
        service:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationServiceResponse'
            - type: 'null'
        result:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationResultResponse'
            - type: 'null'
        files:
          anyOf:
            - items:
                $ref: '#/components/schemas/PriorAuthorizationFile'
              type: array
            - type: 'null'
          title: Files
          description: >-
            Attached files with signed download URLs. Present ONLY on `GET
            /{id}` with `expand[]=files`; always `null` on the list endpoint
            (use `file_count` there). Signed URLs are minted only when this is
            expanded.
        file_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: File Count
          description: >-
            Number of attached files. Always present (a cheap aggregate);
            independent of `expand`.
        submitted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Submitted At
        decided_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Decided At
        appeal_submitted_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Appeal Submitted At
          description: >-
            When the appeal was submitted to the payor; set when the appeal
            first becomes active. Null when no appeal has been submitted.
        last_followed_up_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Followed Up At
          description: >-
            Last time staff followed up with the payor on this authorization's
            status. Null until the first follow-up.
        scheduled_submission_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Scheduled Submission Date
          description: >-
            Date this authorization should be submitted to the payor. When set
            in the future, the request is held out of the active review queue
            until that date. Null when no scheduled date is set.
        completed:
          type: boolean
          title: Completed
          description: >-
            True when the clinic has marked this authorization done (it leaves
            the default list). Derived from `completed_at`.
          default: false
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
          description: When the authorization was marked done. Null while outstanding.
        completed_by_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Completed By User Id
          description: Id of the user who marked it done. Null while outstanding.
        completed_by_user:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationUser'
            - type: 'null'
          description: >-
            The user who marked it done (Solum staff identity is masked for
            customer viewers). Null while outstanding.
        cancellation_reason:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationCancellationReasonEnum'
            - type: 'null'
          description: >-
            Why the authorization was cancelled. Null unless the authorization
            is cancelled.
        cancellation_note:
          anyOf:
            - type: string
            - type: 'null'
          title: Cancellation Note
          description: >-
            Free-text detail captured with the cancellation reason. Null when
            none was provided.
        cancelled_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Cancelled At
          description: >-
            When the authorization was cancelled. Null unless the authorization
            is cancelled.
        active:
          type: boolean
          title: Active
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - company_id
        - type
        - status
        - patient_id
        - patient_first_name
        - patient_last_name
        - patient_date_of_birth
        - active
        - created_at
        - updated_at
      title: PriorAuthorizationResponse
      description: Response schema for a prior authorization record.
    PriorAuthorizationAppealStatusEnum:
      type: string
      enum:
        - requested
        - appealing
        - appeal_approved
        - appeal_partially_approved
        - appeal_denied
        - not_appealing
      title: PriorAuthorizationAppealStatusEnum
      description: |-
        Appeal lifecycle. An appeal STARTS from a denied or partially_approved
        decision; the terminal states below outlive it, because a won appeal is
        exactly one whose decision is no longer a denial.

        NULL is meaningful: it means no appeal decision has been made yet — the
        caller hasn't yet asked for one. Setting any value below is an explicit
        commitment that someone is (or isn't) pursuing the appeal:

          requested                  — an appeal has been requested; work has not started.
          appealing                  — Solum is actively working the appeal.
          appeal_approved            — terminal, won outright.
          appeal_partially_approved  — terminal, won in part (payor granted less than requested).
          appeal_denied              — terminal, lost.
          not_appealing              — terminal, operator decided not to pursue.

        The won/partial/lost outcomes mirror the granularity of
        `PriorAuthorizationDecisionEnum`: a payor that grants less than was
        requested on appeal has partially granted it.
    AppealAvailabilitySlot:
      properties:
        day:
          type: string
          title: Day
          description: Lowercase weekday, e.g. `monday`.
          examples:
            - monday
        start:
          type: string
          title: Start
          description: Window start time, 24-hour `HH:MM`.
          examples:
            - '15:00'
        end:
          type: string
          title: End
          description: Window end time, 24-hour `HH:MM`.
          examples:
            - '17:00'
      type: object
      required:
        - day
        - start
        - end
      title: AppealAvailabilitySlot
      description: >-
        A single availability window for the appeal (e.g. a peer-to-peer call).


        `day` is a lowercase weekday (`monday`..`sunday`); `start`/`end` are
        24-hour

        `HH:MM` strings. Kept as free-form strings rather than typed time
        objects —

        the value is display-oriented context for whoever works the appeal.


        `extra="ignore"` (not `forbid`): this model also validates the stored
        JSON

        on the response/read path, so an extra key added by a future writer must

        not turn a GET into a 500.
    PriorAuthorizationInsurance:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        trading_partner_service_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Trading Partner Service Id
          description: >-
            Trading partner service ID for this insurance, when mapped. Lets the
            client resolve the payer logo from the payer directory. Null when
            the insurance has no trading partner mapping.
      type: object
      required:
        - id
        - name
      title: PriorAuthorizationInsurance
      description: >-
        Nested insurance partner ({id, name}) for the FROZEN snapshot.


        Resolved from the `payor_insurance` relationship, which loads regardless
        of

        the insurance's `is_active` flag — so a PA submitted under a since-

        deactivated insurance still carries its name for display.
    PriorAuthorizationProvider:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        npi:
          type: string
          title: Npi
        tax_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tax Id
        type:
          type: string
          title: Type
        is_active:
          type: boolean
          title: Is Active
        location:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationProviderLocation'
            - type: 'null'
      type: object
      required:
        - id
        - name
        - npi
        - type
        - is_active
      title: PriorAuthorizationProvider
      description: Nested provider (credentialing record) in response.
    PriorAuthorizationServicingLocation:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        address:
          type: string
          title: Address
        address_2:
          anyOf:
            - type: string
            - type: 'null'
          title: Address 2
        city:
          type: string
          title: City
        state:
          type: string
          title: State
        zip_code:
          type: string
          title: Zip Code
      type: object
      required:
        - id
        - name
        - address
        - city
        - state
        - zip_code
      title: PriorAuthorizationServicingLocation
      description: Nested servicing location (full address) in response.
    PriorAuthorizationUser:
      properties:
        id:
          type: string
          title: Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        image:
          anyOf:
            - type: string
            - type: 'null'
          title: Image
        user_type:
          anyOf:
            - type: string
            - type: 'null'
          title: User Type
      type: object
      required:
        - id
      title: PriorAuthorizationUser
      description: Nested user (created_by) in response.
    PriorAuthorizationServiceResponse:
      properties:
        specialty:
          anyOf:
            - $ref: '#/components/schemas/PriorAuthorizationSpecialtyEnum'
            - type: 'null'
        service_type_codes:
          anyOf:
            - items:
                $ref: '#/components/schemas/ServiceType'
              type: array
            - type: 'null'
          title: Service Type Codes
        start_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Start Date
        end_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: End Date
        requested_visits:
          anyOf:
            - type: integer
            - type: 'null'
          title: Requested Visits
        requested_weeks:
          anyOf:
            - type: integer
            - type: 'null'
          title: Requested Weeks
        cpt_codes:
          anyOf:
            - items:
                $ref: '#/components/schemas/ServiceCptCode'
              type: array
            - type: 'null'
          title: Cpt Codes
        locations:
          anyOf:
            - items:
                $ref: '#/components/schemas/PlaceOfService'
              type: array
            - type: 'null'
          title: Locations
      type: object
      title: PriorAuthorizationServiceResponse
      description: >-
        Service request details returned in the response.


        See `PriorAuthorizationResultResponse` for the rationale on
        `validation_alias`.
    PriorAuthorizationResultResponse:
      properties:
        start_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Start Date
        end_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: End Date
        approved_visits:
          anyOf:
            - type: integer
            - type: 'null'
          title: Approved Visits
        approved_weeks:
          anyOf:
            - type: integer
            - type: 'null'
          title: Approved Weeks
        cpt_codes:
          anyOf:
            - items:
                $ref: '#/components/schemas/ServiceCptCode'
              type: array
            - type: 'null'
          title: Cpt Codes
        locations:
          anyOf:
            - items:
                $ref: '#/components/schemas/PlaceOfService'
              type: array
            - type: 'null'
          title: Locations
        authorization_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Authorization Number
        cpt_authorization_numbers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Cpt Authorization Numbers
        reference_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Reference Number
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        ai_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Ai Summary
        ai_summary_generated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ai Summary Generated At
      type: object
      title: PriorAuthorizationResultResponse
      description: |-
        Payor decision details. Populated only when `status` is `decided`.

        Uses `validation_alias` (not `alias`) so the alias only applies to input
        (reading the parent PA's `result_start_date` etc. columns via
        `from_attributes`). Output uses the field name; otherwise FastAPI's
        `response_model_by_alias=True` default would leak the column-prefixed
        name onto the wire and the frontend would see `resultStartDate` after
        `transformFromAPI` instead of the expected `startDate`.
    PriorAuthorizationFile:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
        path:
          type: string
          title: Path
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
        size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size
        document_type:
          anyOf:
            - $ref: '#/components/schemas/DocumentType'
            - type: 'null'
          description: AI-classified document category (e.g. referral, diagnosis).
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
        created_at:
          type: string
          format: date-time
          title: Created At
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
      type: object
      required:
        - id
        - name
        - path
        - created_at
      title: PriorAuthorizationFile
      description: File associated with a prior authorization.
    PriorAuthorizationCancellationReasonEnum:
      type: string
      enum:
        - duplicate_already_submitted
        - no_longer_needed
        - submitted_directly_to_payor
        - patient_no_longer_active
        - entered_in_error
        - other
      title: PriorAuthorizationCancellationReasonEnum
      description: >-
        Why a prior authorization was cancelled — captured on every transition

        into `cancelled`. `other` is the escape hatch (the free-text detail then

        lives in `cancellation_note`).


        Keep the members in sync with the Prisma enum

        `PriorAuthorizationCancellationReason`

        (apps/frontend/prisma/schema/enums.prisma) and the frontend label map

        `PRIOR_AUTH_CANCELLATION_REASON_LABELS`. `verify-enum-sync` only
        compares

        UPPERCASE Python members, so — like `PriorAuthorizationStatusEnum` —
        this

        lowercase enum is NOT covered by that check; sync it by hand.
    PriorAuthorizationProviderLocation:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
      type: object
      required:
        - id
        - name
      title: PriorAuthorizationProviderLocation
      description: Nested location reference inside a credentialing record.
    PriorAuthorizationSpecialtyEnum:
      type: string
      enum:
        - aba
        - speech_therapy
        - occupational_therapy
        - physical_therapy
        - mental_behavioral_health
      title: PriorAuthorizationSpecialtyEnum
      description: Clinical specialty the authorization covers.
    ServiceType:
      type: string
      enum:
        - medical_care
        - surgical
        - consultation
        - diagnostic_x_ray
        - diagnostic_lab
        - radiation_therapy
        - anesthesia
        - surgical_assistance
        - other_medical
        - blood_charges
        - used_durable_medical_equipment
        - durable_medical_equipment_purchase
        - ambulatory_service_center_facility
        - renal_supplies_in_home
        - alternate_method_dialysis
        - chronic_renal_disease_equipment
        - pre_admission_testing
        - durable_medical_equipment_rental
        - pneumonia_vaccine
        - second_surgical_opinion
        - third_surgical_opinion
        - social_work
        - diagnostic_dental
        - periodontics
        - restorative
        - endodontics
        - maxillofacial_prosthetics
        - adjunctive_dental_services
        - health_benefit_plan_coverage
        - plan_waiting_period
        - chiropractic
        - chiropractic_office_visits
        - dental_care
        - dental_crowns
        - dental_accident
        - orthodontics
        - prosthodontics
        - oral_surgery
        - routine_preventive_dental
        - home_health_care
        - home_health_prescriptions
        - home_health_visits
        - hospice
        - respite_care
        - hospital
        - hospital_inpatient
        - hospital_room_and_board
        - hospital_outpatient
        - hospital_emergency_accident
        - hospital_emergency_medical
        - hospital_ambulatory_surgical
        - long_term_care
        - major_medical
        - medically_related_transportation
        - air_transportation
        - cabulance
        - licensed_ambulance
        - general_benefits
        - in_vitro_fertilization
        - mri_cat_scan
        - donor_procedures
        - acupuncture
        - newborn_care
        - pathology
        - smoking_cessation
        - well_baby_care
        - maternity
        - transplants
        - audiology_exam
        - inhalation_therapy
        - diagnostic_medical
        - private_duty_nursing
        - prosthetic_device
        - dialysis
        - otological_exam
        - chemotherapy
        - allergy_testing
        - immunizations
        - routine_physical
        - family_planning
        - infertility
        - abortion
        - aids
        - emergency_services
        - cancer
        - pharmacy
        - free_standing_prescription_drug
        - mail_order_prescription_drug
        - brand_name_prescription_drug
        - generic_prescription_drug
        - podiatry
        - podiatry_office_visits
        - podiatry_nursing_home_visits
        - professional_physician
        - anesthesiologist
        - professional_visit_office
        - professional_visit_inpatient
        - professional_visit_outpatient
        - professional_visit_nursing_home
        - professional_visit_skilled_nursing_facility
        - professional_visit_home
        - psychiatric
        - psychiatric_room_and_board
        - psychotherapy
        - psychiatric_inpatient
        - psychiatric_outpatient
        - rehabilitation
        - rehabilitation_room_and_board
        - rehabilitation_inpatient
        - rehabilitation_outpatient
        - occupational_therapy
        - physical_medicine
        - speech_therapy
        - skilled_nursing_care
        - skilled_nursing_care_room_and_board
        - substance_abuse
        - alcoholism
        - drug_addiction
        - vision_optometry
        - frames
        - routine_exam
        - lenses
        - nonmedically_necessary_physical
        - experimental_drug_therapy
        - burn_care
        - brand_name_prescription_drug_formulary
        - brand_name_prescription_drug_non_formulary
        - independent_medical_evaluation
        - partial_hospitalization_psychiatric
        - day_care_psychiatric
        - cognitive_therapy
        - massage_therapy
        - pulmonary_rehabilitation
        - cardiac_rehabilitation
        - pediatric
        - nursery
        - skin
        - orthopedic
        - cardiac
        - lymphatic
        - gastrointestinal
        - endocrine
        - neurology
        - eye
        - invasive_procedures
        - gynecological
        - obstetrical
        - obstetrical_gynecological
        - mail_order_prescription_drug_brand_name
        - mail_order_prescription_drug_generic
        - physician_visit_office_sick
        - physician_visit_office_well
        - coronary_care
        - private_duty_nursing_inpatient
        - private_duty_nursing_home
        - surgical_benefits_professional
        - surgical_benefits_facility
        - mental_health_provider_inpatient
        - mental_health_provider_outpatient
        - mental_health_facility_inpatient
        - mental_health_facility_outpatient
        - substance_abuse_facility_inpatient
        - substance_abuse_facility_outpatient
        - screening_x_ray
        - screening_laboratory
        - mammogram_high_risk_patient
        - mammogram_low_risk_patient
        - flu_vaccination
        - eyewear_and_accessories
        - case_management
        - dermatology
        - durable_medical_equipment
        - diabetic_supplies
        - generic_prescription_drug_formulary
        - generic_prescription_drug_non_formulary
        - allergy
        - intensive_care
        - mental_health
        - neonatal_intensive_care
        - oncology
        - physical_therapy
        - pulmonary
        - renal
        - residential_psychiatric_treatment
        - transitional_care
        - transitional_nursery_care
        - urgent_care
      title: ServiceType
      description: |-
        X12 Service Type — human-readable enum values stored in the database.
        See app/utils/service_type_mapping.py for code-to-type mappings.
    ServiceCptCode:
      properties:
        code:
          type: string
          title: Code
          description: CPT or HCPCS procedure code.
        units:
          type: string
          title: Units
          description: >-
            Quantity for this code. Stored as a string because some payors
            permit non-integer quantities (e.g. `0.5` hours of evaluation).
        unit_type:
          $ref: '#/components/schemas/PriorAuthorizationUnitTypeEnum'
          description: >-
            What the quantity is measured in — `units`, `visits`, or `hours`.
            Defaults to `units`; entries created before this field existed read
            back as `units`.
          default: units
        modifiers:
          anyOf:
            - items:
                $ref: '#/components/schemas/CptModifier'
              type: array
            - type: 'null'
          title: Modifiers
          description: >-
            CPT/HCPCS modifiers that apply to this code (e.g. `95`, `GT`).
            Optional — entries created before this field existed omit it and
            read back as `None`.
      type: object
      required:
        - code
        - units
      title: ServiceCptCode
      description: >-
        Single CPT/HCPCS entry: code + quantity + the unit that quantity is in.


        `extra="ignore"` (not `forbid`): this model also validates the STORED
        JSON on

        the response/read path, so a stray key must not turn a GET into a 500.
        In

        particular, an earlier iteration briefly embedded a per-code

        `authorization_number` inside each entry (it now lives in the separate

        `cpt_authorization_numbers` column); rows written then still carry that
        key,

        and reading them must silently drop it rather than fail. Mirrors

        `AppealAvailabilitySlot`.
    PlaceOfService:
      type: string
      enum:
        - telehealth_other_home
        - school
        - telehealth_home
        - office
        - home
        - independent_clinic
        - community_mental_health_center
        - other
      title: PlaceOfService
      description: CMS Place of Service categories. Wire values are the snake_case keys.
    DocumentType:
      type: string
      enum:
        - referral
        - authorization
        - intake_documents
        - legal_documents
        - financial_documents
        - insurance_card
        - billing
        - spam
        - plan_of_care
        - diagnosis
        - medical_records
        - other
      title: DocumentType
      description: |-
        AI classification of any uploaded file, not just faxes.

        Lives on `files.document_type` and drives fax stage routing. Bound to PG
        enum `document_type`.
    PriorAuthorizationUnitTypeEnum:
      type: string
      enum:
        - units
        - visits
        - hours
      title: PriorAuthorizationUnitTypeEnum
      description: >-
        Quantity unit a CPT/HCPCS line is measured in.


        Lives inside the `service_cpt_codes` / `result_cpt_codes` JSON (not a

        dedicated column), so this is a plain str Enum with no `__pg_type__`.
        Old

        rows predate the field — readers default a missing value to `units`.


        Wire values mirror the Prisma `PriorAuthorizationUnitType` enum

        (`units` / `visits` / `hours`); keep them in sync by hand (the `...Enum`

        suffix here intentionally keeps this out of `verify-enum-sync`'s

        name-matched set, same as the other PA enums).
    CptModifier:
      type: string
      enum:
        - cf
        - hm
        - ho
        - hn
        - ad
        - ae
        - pt
        - af
        - ot
        - hp
        - gt
        - u1
        - u2
        - u3
        - u4
        - u5
        - u6
        - u7
        - u8
        - gp
        - go
        - gn
        - cq
        - co
        - kx
        - gq
        - fq
        - ga
        - gx
        - gy
        - gz
        - lt
        - rt
        - xe
        - xs
        - xu
        - '59'
        - '76'
        - '77'
        - '93'
        - '95'
        - '96'
        - '97'
      title: CptModifier
      description: >-
        CPT/HCPCS modifiers appended to default codes. Matches Prisma
        @@map("cpt_modifier").


        PROVISIONAL value set observed in the ops playbook — confirm the closed
        list

        with ops before relying on it; if open-ended, switch the column to
        String[].
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      scheme: bearer

````