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

# Attach a patient document to a prior authorization

> Attach an existing patient document to this prior authorization. A document not attached to any prior authorization is linked directly; a document that already belongs to another prior authorization is attached as an independent copy, leaving the original request's record untouched. Returns the attached file.



## OpenAPI

````yaml https://api.getsolum.com/openapi.json post /v1/prior-authorizations/{id}/documents
openapi: 3.1.0
info:
  title: Solum Health API
  description: '## Solum Health Backend API '
  version: 1.0.0
servers: []
security: []
paths:
  /v1/prior-authorizations/{id}/documents:
    post:
      tags:
        - Prior Authorizations
      summary: Attach a patient document to a prior authorization
      description: >-
        Attach an existing patient document to this prior authorization. A
        document not attached to any prior authorization is linked directly; a
        document that already belongs to another prior authorization is attached
        as an independent copy, leaving the original request's record untouched.
        Returns the attached file.
      operationId: >-
        attach_prior_authorization_document_v1_prior_authorizations__id__documents_post
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            title: Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PriorAuthorizationAttachDocumentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          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:
    PriorAuthorizationAttachDocumentRequest:
      properties:
        source_file_id:
          type: string
          title: Source File Id
          description: Id of the patient document to attach to this prior authorization.
      additionalProperties: false
      type: object
      required:
        - source_file_id
      title: PriorAuthorizationAttachDocumentRequest
      description: Body for POST /prior-authorizations/{id}/documents.
    File:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
        name:
          type: string
          title: Name
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: User-friendly display name for the file
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: File URL (may require authentication)
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
          description: MIME type of the file
        size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size
        uploaded_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Uploaded By
        type:
          anyOf:
            - $ref: '#/components/schemas/FileType'
            - type: 'null'
          description: 'File category: fax, prior_auth, patient_document, form_upload'
        patient_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Patient Id
        form_submission_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Form Submission Id
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Id
        prior_authorization_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Prior Authorization Id
        patient:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Patient
        document_type:
          anyOf:
            - $ref: '#/components/schemas/DocumentType'
            - type: 'null'
        page_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page Count
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
      type: object
      required:
        - id
        - created_at
        - name
      title: File
      description: |-
        File resource.

        Extends BaseResource to include file-specific fields.
        All fields use snake_case.
    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``.
    FileType:
      type: string
      enum:
        - fax
        - prior_auth
        - patient_document
        - form_upload
      title: FileType
      description: >-
        File category enum matching Prisma @map values. Bound to PG enum
        `file_type`.
    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`.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      scheme: bearer

````