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

# Create Patient Medical Referral

> Atomic create: render PDF → upload → insert Document + PatientMedicalReferral row.



## OpenAPI

````yaml post /patient-medical-referrals
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /patient-medical-referrals:
    post:
      tags:
        - Referrals
      summary: Create Patient Medical Referral
      description: >-
        Atomic create: render PDF → upload → insert Document +
        PatientMedicalReferral row.
      operationId: create_patient_medical_referral_patient_medical_referrals_post
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatientMedicalReferralCreatePayload'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientMedicalReferralResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PatientMedicalReferralCreatePayload:
      properties:
        patientId:
          type: string
          title: Patientid
        referringProviderId:
          type: string
          title: Referringproviderid
        recipientFaxContactId:
          type: string
          title: Recipientfaxcontactid
        reason:
          type: string
          maxLength: 1000
          minLength: 1
          title: Reason
        clinicalNote:
          type: string
          maxLength: 5000
          minLength: 1
          title: Clinicalnote
      type: object
      required:
        - patientId
        - referringProviderId
        - recipientFaxContactId
        - reason
        - clinicalNote
      title: PatientMedicalReferralCreatePayload
      description: |-
        Form state for preview + create. Identical shape across both routes —
        preview consumes it without persisting, create persists atomically.
    PatientMedicalReferralResponse:
      properties:
        id:
          type: string
          title: Id
        patientId:
          type: string
          title: Patientid
        referringProviderId:
          type: string
          title: Referringproviderid
        recipientFaxContactId:
          type: string
          title: Recipientfaxcontactid
        reason:
          type: string
          title: Reason
        clinicalNote:
          type: string
          title: Clinicalnote
        documentId:
          type: string
          title: Documentid
        documentFilePath:
          type: string
          title: Documentfilepath
        documentTitle:
          type: string
          title: Documenttitle
        createdDate:
          type: string
          format: date-time
          title: Createddate
      type: object
      required:
        - id
        - patientId
        - referringProviderId
        - recipientFaxContactId
        - reason
        - clinicalNote
        - documentId
        - documentFilePath
        - documentTitle
        - createdDate
      title: PatientMedicalReferralResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````