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

# Can I send an electronic prescription to Blend directly?

> Yes — POST /api/v1/prescriptions/electronic_prescriptions with NCPDP SCRIPT XML or JSON. This is an alternative to Surescripts, available for non-controlled substances only at this time.

Yes. Sending prescriptions directly to Blend over the API is an alternative to routing them through Surescripts, and is available for **non-controlled substances only** at this time. Post to `/api/v1/prescriptions/electronic_prescriptions` with either NCPDP SCRIPT XML (`application/xml`) or a JSON body. In JSON you supply a `patient`, a `prescriber`, and either a single `medication` or an array of `medications`. Blend then matches the prescription to a patient, a prescriber, and one of your products — you do not have to resolve those links yourself.

A prescription can be sent before or after the patient and the order exist. Blend matches whenever the data is available, so ordering is not a constraint.

## Send one prescription

```bash theme={null}
curl -X POST https://api.byblend.com/api/v1/prescriptions/electronic_prescriptions \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "patient": { "external_id": "clinic-pt-4471" },
    "prescriber": { "id": "0227d1e5-ba9a-42b5-8fe2-38882aa65708" },
    "medication": {
      "product_code": "HC-RAPA31",
      "drug_name": "Rapamycin",
      "quantity": 30,
      "units": "C48480",
      "days_supply": 30,
      "refills": 4,
      "sig": "Take one capsule by mouth once weekly",
      "written_at": "2026-08-20T00:00:00"
    }
  }'
```

Key fields:

* **`product_code`** — your own code for the prescription product. Send this or `prescription_product_id` (the Blend UUID); you don't need both.
* **`units`** — an NCPDP quantity-unit code, not a word. `C48480` is Capsule, `C48542` is Tablet, `C28253` is Milligram. Pull the full list from `GET /prescriptions/quantity_units`, which returns each `code` alongside its `term` and definition.
* **`patient`** — reference an existing patient by `id` or `external_id`, or pass a full new-patient object to create one inline.
* **`medications`** — use the array form when one prescription carries several drugs; each becomes its own prescription in Blend.

## Sending SCRIPT XML instead

If you already generate NCPDP SCRIPT, post the raw XML with `Content-Type: application/xml`. Blend parses `<ProductCode>`, `<DrugDescription>`, and `<Note>` looking for matches against your products' `product_code`, `sku`, `id`, or `name`.

```bash theme={null}
curl -X POST https://api.byblend.com/api/v1/prescriptions/electronic_prescriptions \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/xml" \
  --data-binary @newrx.xml
```

## Attaching it to an order

An order can be created before or after the prescription. If the order already exists, pass its `id` or `order_number` in the `order` object. If it doesn't, create it afterwards with `POST /orders` and optionally list the prescription in `electronic_prescription_ids` to help matching along. To do all of it in one request, use the [composite endpoint](/guides/composite-creation).

<CardGroup cols={2}>
  <Card title="Create an electronic prescription" icon="prescription" href="/api-reference/electronic-prescriptions/create-a-new-electronic-prescription">
    POST /prescriptions/electronic\_prescriptions
  </Card>

  <Card title="Get quantity units" icon="ruler" href="/api-reference/electronic-prescriptions/get-quantity-units">
    Valid NCPDP `units` codes
  </Card>

  <Card title="Get electronic prescription" icon="file-lines" href="/api-reference/electronic-prescriptions/get-electronic-prescription">
    Add `include_xml=true` for raw SCRIPT
  </Card>

  <Card title="Composite creation" icon="layer-group" href="/api-reference/composite-creation/single-request-creation-of-a-prescription-and-order-and-patientprescriber">
    Prescription + order in one call
  </Card>
</CardGroup>
