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

# Single request creation of a prescription and order (and patient/prescriber)

> The composite request is a convenience function that allows you to create an electronic prescription and order in a single request, and optionally also create a patient and/or prescriber. The request body can contain the following objects: `patient`, `prescriber`, `electronic_prescription`, `order`. While no single entity is required (the composite request can be used to create a standalone order or electronic prescription), it is designed to be comprehensive. If any single entity creation fails, the entire request will fail and no entities will be created.



## OpenAPI

````yaml /openapi-public.yml post /api/v1/prescriptions/electronic_prescriptions/composite
openapi: 3.0.3
info:
  title: Blend API
  version: 1.0.0
  description: API for Blend
servers:
  - url: https://api.byblend.com
    description: Blend production server
security:
  - bearerAuth: []
tags:
  - name: Orders
    description: Order management endpoints
  - name: Patients
    description: Patient management endpoints
  - name: Reports
    description: Reporting endpoints
  - name: Products and Materials
    description: Product catalog and inventory endpoints
  - name: Electronic Prescriptions
    description: Electronic prescription management endpoints
  - name: Prescriptions
    description: Prescription management endpoints
  - name: Authentication
    description: Authentication endpoints
  - name: Notifications
    description: User management endpoints
  - name: Prescribers
paths:
  /api/v1/prescriptions/electronic_prescriptions/composite:
    post:
      tags:
        - Composite Creation
      summary: >-
        Single request creation of a prescription and order (and
        patient/prescriber)
      description: >-
        The composite request is a convenience function that allows you to
        create an electronic prescription and order in a single request, and
        optionally also create a patient and/or prescriber. The request body can
        contain the following objects: `patient`, `prescriber`,
        `electronic_prescription`, `order`. While no single entity is required
        (the composite request can be used to create a standalone order or
        electronic prescription), it is designed to be comprehensive. If any
        single entity creation fails, the entire request will fail and no
        entities will be created.
      parameters:
        - name: force_new
          in: query
          required: false
          description: >-
            If 'true', always create a new order even if a mergeable order
            exists for the patient. Default is 'false', which merges into
            existing open orders when available.
          schema:
            type: boolean
            example: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                electronic_prescription:
                  type: object
                  description: >-
                    An electronic prescription object. Please refer to the
                    Create a New Electronic Prescription endpoint for more
                    information on required fields.
                order:
                  type: object
                  description: >-
                    An order object. Please refer to the Create an Order
                    endpoint for more information on required fields.
                patient:
                  type: object
                  description: >-
                    A patient object. If you pass new patient data, a new
                    patient will be created. Or you may reference an existing
                    patient by `id` or `external_id`. Please refer to the Create
                    a Patient endpoint for more information on required fields.
                prescriber:
                  type: object
                  description: >-
                    A prescriber object. If you pass new prescriber data, a new
                    prescriber will be created. Or you may reference an existing
                    prescriber by `id` or `npi`. Please refer to the Create a
                    New Prescriber endpoint for more information on required
                    fields.
      responses:
        '201':
          description: >
            Response from composite entity creation. Only includes keys for
            entities that were provided in the request. For example, if only
            patient and order were requested, only those keys (plus summary)
            will be present in the response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  patient:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: The patient ID
                      created:
                        type: boolean
                        description: >-
                          Whether the patient was created (true) or referenced
                          (false)
                  prescriber:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: The prescriber ID
                      created:
                        type: boolean
                        description: >-
                          Whether the prescriber was created (true) or
                          referenced (false)
                  electronic_prescription:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: >-
                          The electronic prescription ID, if an electronic
                          prescription was created.
                      created:
                        type: boolean
                        description: >-
                          Whether the electronic prescription was created
                          (always true for composite)
                  order:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: The order ID, if an order was created.
                      created:
                        type: boolean
                        description: >-
                          Whether the order was created (always true for
                          composite)
                  summary:
                    type: object
                    properties:
                      entities_created:
                        type: integer
                        description: Total number of entities created in this request
                        minimum: 0
                      entities_referenced:
                        type: integer
                        description: >-
                          Total number of existing entities referenced in this
                          request
                        minimum: 0
                example:
                  patient:
                    id: 123e4567-e89b-12d3-a456-426614174000
                    created: true
                  prescriber:
                    id: 987fcdeb-51a2-43d1-9f12-345678901234
                    created: false
                  electronic_prescription:
                    id: 456789ab-cdef-1234-5678-90abcdef1234
                    created: true
                  order:
                    id: 789abcde-f012-3456-7890-123456789abc
                    created: true
                  summary:
                    entities_created: 3
                    entities_referenced: 1
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````