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

> Atomic create: validate refs + the client-rendered PDF → upload → insert
Document + PatientRequisition.

The requisition PDF is rendered in the browser (the single source of truth
shared with the preview) and sent as the ``pdf`` part; the structured fields
arrive as a JSON ``payload`` part. This endpoint validates the patient /
ordering provider / recipient references and that the upload is a real PDF,
then persists the passed-in bytes — it does not re-derive the document.
``provider`` (CurrentProvider) gates the caller to an authenticated
provider; the *ordering* provider is chosen on the form and validated in the
service, so it need not match the caller.



## OpenAPI

````yaml post /requisitions
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /requisitions:
    post:
      tags:
        - Requisitions
      summary: Create Requisition
      description: >-
        Atomic create: validate refs + the client-rendered PDF → upload → insert

        Document + PatientRequisition.


        The requisition PDF is rendered in the browser (the single source of
        truth

        shared with the preview) and sent as the ``pdf`` part; the structured
        fields

        arrive as a JSON ``payload`` part. This endpoint validates the patient /

        ordering provider / recipient references and that the upload is a real
        PDF,

        then persists the passed-in bytes — it does not re-derive the document.

        ``provider`` (CurrentProvider) gates the caller to an authenticated

        provider; the *ordering* provider is chosen on the form and validated in
        the

        service, so it need not match the caller.
      operationId: create_requisition_requisitions_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:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_create_requisition_requisitions_post'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequisitionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_create_requisition_requisitions_post:
      properties:
        payload:
          type: string
          title: Payload
        pdf:
          type: string
          contentMediaType: application/octet-stream
          title: Pdf
      type: object
      required:
        - payload
        - pdf
      title: Body_create_requisition_requisitions_post
    RequisitionResponse:
      properties:
        id:
          type: string
          title: Id
        patientId:
          type: string
          title: Patientid
        orderingProviderId:
          type: string
          title: Orderingproviderid
        recipientFaxContactId:
          type: string
          title: Recipientfaxcontactid
        cptCodes:
          items:
            $ref: '#/components/schemas/RequisitionCPTCode'
          type: array
          title: Cptcodes
        clinicalNote:
          anyOf:
            - type: string
            - type: 'null'
          title: Clinicalnote
        orderPriority:
          $ref: '#/components/schemas/RequisitionOrderPriority'
        icd10Codes:
          items:
            $ref: '#/components/schemas/RequisitionICD10Code'
          type: array
          title: Icd10Codes
        signatureUrl:
          anyOf:
            - type: string
            - type: 'null'
          title: Signatureurl
        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
        - orderingProviderId
        - recipientFaxContactId
        - cptCodes
        - clinicalNote
        - orderPriority
        - icd10Codes
        - signatureUrl
        - documentId
        - documentFilePath
        - documentTitle
        - createdDate
      title: RequisitionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RequisitionCPTCode:
      properties:
        code:
          type: string
          maxLength: 16
          minLength: 1
          title: Code
        description:
          type: string
          maxLength: 1024
          minLength: 1
          title: Description
      type: object
      required:
        - code
        - description
      title: RequisitionCPTCode
      description: >-
        A single ordered test/procedure (CPT code) for the Tests Ordered box.

        ``description`` is the human-readable text that rides along with the

        ``code``, rendered together as ``code  description`` (code-first).
        Mirrors

        ``RequisitionICD10Code``.
    RequisitionOrderPriority:
      type: string
      enum:
        - ROUTINE
        - URGENT
        - EMERGENT
      title: RequisitionOrderPriority
      description: |-
        Triage priority for a patient requisition.

        Mirrors the requisition-form "Order Priority" field. Uses triage tiers
        ("EMERGENT" rather than the lab term "STAT"). Stored as VARCHAR via
        ``TypedEnum``; ``ROUTINE`` is the default for existing rows.
    RequisitionICD10Code:
      properties:
        code:
          type: string
          maxLength: 16
          minLength: 1
          title: Code
        description:
          type: string
          maxLength: 1024
          minLength: 1
          title: Description
      type: object
      required:
        - code
        - description
      title: RequisitionICD10Code
      description: >-
        A single selected ICD-10 diagnosis. ``description`` is the
        human-readable

        text that rides along with the ``code`` (the lookup's short
        description),

        rendered together as ``code  description`` (code-first) in the Diagnosis

        Information box, mirroring ``RequisitionCPTCode``.
    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

````