Specialty × workflow
Patient Portal Apps for Pain Medicine Practices: HIPAA Rules for Apps You Build Yourself
Last reviewed: . Vendor facts checked against each vendor's own pages on the dates shown.
Short answer: If a pain medicine practice is a HIPAA covered entity, a patient portal it builds itself needs a BAA for every service holding patient data, plus limited, logged access. DEA bars refills of Schedule II opioids (DEA (eCFR), 21 CFR 1306.12 -- Refilling prescriptions; issuance of multiple prescriptions., verified November 15, 2026), so route opioid requests to a clinician and never create prescriptions in the portal; also keep drug names out of texts.
In a pain practice, the portal is where controlled-substance care happens between visits. Patients send medication requests, review their opioid agreement, log pain and function scores, see upcoming drug-screen and pill-count appointments, and report how they did after an injection or ablation. Building this in an AI app builder or coding agent is a fast way to prototype it. The hard part: a generic refill feature treats every medication the same, and opioids cannot be handled that way.
This page covers the portal only. For the practice-level picture (opioids, PDMP checks, 42 CFR Part 2 questions), see the pain medicine guide. For portals in general, see building your own patient portal.
What the rules and vendors say, in their own words (checked November 15, 2026)
DEA prescription rules (not HIPAA, but they shape the portal)
Oxycodone and hydrocodone are Schedule II drugs. (DEA (eCFR), 21 CFR 1308.12 -- Schedule II., verified November 15, 2026) (DEA (eCFR), 21 CFR 1308.12 -- Schedule II., verified November 15, 2026) DEA's rule on refills is short:
“The refilling of a prescription for a controlled substance listed in Schedule II is prohibited.”
A physician may instead issue multiple Schedule II prescriptions totaling up to a 90-day supply, if listed conditions are met. (DEA (eCFR), 21 CFR 1306.12 -- Refilling prescriptions; issuance of multiple prescriptions., verified November 15, 2026) One condition is that each prescription after an immediate first one carries the earliest date a pharmacy may fill it. (DEA (eCFR), 21 CFR 1306.12 -- Refilling prescriptions; issuance of multiple prescriptions., verified November 15, 2026) Electronic prescribing of controlled substances (EPCS) has its own requirements, and DEA says:
“An electronic prescription for a Schedule II, III, IV, or V controlled substance created using an electronic prescription application that does not meet the requirements of this subpart is not a valid prescription”
DEA's telemedicine flexibilities for prescribing controlled substances run until the end of December 31, 2026. (DEA / HHS, Fourth Temporary Extension of COVID-19 Telemedicine Flexibilities for Prescription of Controlled Medications (Federal Register, December 31, 2025, FR Doc. 2025-24123), verified November 15, 2026) Whether a specific prescription is valid is a question for counsel.
HIPAA
A covered provider must let patients request communications by alternative means or at alternative locations, and must accommodate reasonable requests. (HHS (eCFR), 45 CFR 164.522 -- Rights to request privacy protection for protected health information., verified November 15, 2026) Systems holding electronic PHI (protected health information) need access controls (HHS (eCFR), 45 CFR 164.312 -- Technical safeguards., verified November 15, 2026) and audit controls that record activity. (HHS (eCFR), 45 CFR 164.312 -- Technical safeguards., verified November 15, 2026) Patients asking for their records must get action within 30 days, (HHS (eCFR), 45 CFR 164.524 -- Access of individuals to protected health information., verified November 15, 2026) in the electronic form they ask for if it is readily producible. (HHS (eCFR), 45 CFR 164.524 -- Access of individuals to protected health information., verified November 15, 2026)
The messaging vendor
Twilio says HIPAA workflows require a Twilio Editions package with HIPAA Accounts, used to designate HIPAA Projects. (Architecting for HIPAA on Twilio, verified November 15, 2026) It also puts this on the customer: “It is the customer’s responsibility to ensure that no data that could be construed as PHI is entered into the custom attributes fields for Message Tagging, including any of the custom attributes that are available to be configured.” (Architecting for HIPAA on Twilio, verified November 15, 2026) Twilio says it cannot sign a BAA for SendGrid, its email service. (Twilio SendGrid, Is SendGrid HIPAA Compliant?, verified November 15, 2026)
Where patient data goes in a pain management portal
Follow one patient on long-term opioid therapy through a month of portal use:
- Medication request. The patient asks for next month's oxycodone. Because a Schedule II prescription cannot be refilled, each request becomes a new prescription the physician writes, sometimes as a series with earliest-fill dates. The portal's only job is to carry the request to a clinician queue and hand it to the practice's e-prescribing system. It should never produce anything a pharmacy acts on.
- Context around the request. Last fill date, preferred pharmacy, agreement status, and any drug-screen or pill-count flags. Staff see these in an admin view; the patient sees a narrower version.
- Agreement and diaries. The signed opioid agreement (signing is covered in pain medicine consent forms) and daily pain and function scores, stored in the app's database and file storage.
- Call-backs and procedures. Notices for random pill counts or drug screens, and check-ins after injections or ablations. Screen results themselves are covered in pain medicine lab results delivery.
- Notifications. Every new message, request update or call-back notice triggers an SMS or email through the builder's messaging service. Some patients ask to be reached only one way, such as email but never text.
- Telemedicine follow-up. If a clinician prescribes a controlled substance after a video visit to a patient never seen in person, that may rely on DEA's telemedicine flexibilities, which allow it through December 31, 2026 when listed conditions are met. (DEA / HHS, Fourth Temporary Extension of COVID-19 Telemedicine Flexibilities for Prescription of Controlled Medications (Federal Register, December 31, 2025, FR Doc. 2025-24123), verified November 15, 2026) A portal that books those visits and passes requests from them inherits that deadline.
What this means for your app
- The refill button. A coding agent asked to add refills may build one generic flow for every drug. For Schedule II drugs that flow has to become a request, not a prescription.
- Notification text. A template drafted in builder chat may say exactly what happened (Your oxycodone request was approved). That text passes through the messaging vendor and shows on the lock screen of whatever phone receives it.
- Contact preferences. If the preference lives inside one feature, other features ignore it. It belongs on the patient record.
- The login table. Every account in a pain portal belongs to a pain patient, many on long-term opioids. The login service's user table (names, emails, phone numbers) is patient data and needs a BAA too. See Clerk and Auth0.
- Admin views. Drug-screen flags and pill-count results are highly sensitive. A single admin page every staff login can open is easy to build and hard to defend, since HIPAA expects access only for people granted it. (HHS (eCFR), 45 CFR 164.312 -- Technical safeguards., verified November 15, 2026)
- Email. If a coding agent added a transactional email service, check which one and whether it signs a BAA before any message carries PHI. See SendGrid and BAAs and Twilio and BAAs.
How this goes wrong: an oxycodone refill button that emails a PDF
Hypothetical. Imagine a pain physician builds a portal from a primary care template and keeps its Request refill button. For oxycodone, the coding agent wires the button to generate a PDF prescription with the physician's scanned signature, email it to the patient's pharmacy through the app's default transactional email service (no BAA), and text the patient that the refill was sent.
The button should never have existed. DEA prohibits refilling Schedule II prescriptions, (DEA (eCFR), 21 CFR 1306.12 -- Refilling prescriptions; issuance of multiple prescriptions., verified November 15, 2026) and DEA says an electronic controlled-substance prescription created with an application that does not meet its EPCS rules is not valid. (DEA (eCFR), 21 CFR 1311.100 -- General., verified November 15, 2026) The patient taps the button on a Friday afternoon. The request never reaches a clinician queue, so nobody in the clinic sees it. The pharmacist declines the PDF, and the patient runs short over the weekend.
Meanwhile the email provider now holds the patient's name, date of birth, drug and dose. The text naming oxycodone went to a shared family phone the patient had asked the practice not to use. One button created a patient-safety gap, a vendor holding PHI without an agreement, and an ignored confidential-communication request.
What changes from the generic portal checklist for pain medicine
Start with the general list in Building Your Own Patient Portal: The HIPAA Guide. For a pain practice, add or tighten these:
- No refill button for Schedule II drugs. Replace it with a medication request message routed to a clinician queue. The portal never generates, signs, faxes or emails a prescription; prescribing happens only in the practice's EPCS-capable e-prescribing system.
- No drug names in notifications. Texts and emails say only You have a new message. Store each patient's preferred contact channel on the patient record so requests, call-backs and results all honor it.
- SMS under a BAA. Twilio signs a BAA only on its Security or Enterprise Edition, (Twilio and HIPAA, verified November 15, 2026) and patient data must stay in accounts or projects designated as HIPAA Projects. (Architecting for HIPAA on Twilio, verified November 15, 2026) Keep drug names out of message-tagging fields too. (Architecting for HIPAA on Twilio, verified November 15, 2026) Keep portal email off SendGrid. (Twilio SendGrid, Is SendGrid HIPAA Compliant?, verified November 15, 2026)
- Split views. Patients see their agreement, upcoming screens and messages. Drug-screen flags, pill-count results and diversion concerns stay in a staff view, limited by role, with every view logged.
- Call-back records. Log when each pill-count or drug-screen notice was sent and when the patient acknowledged it. The response to a missed call-back stays with the clinician, not an automated rule.
- Telemedicine date. Re-check any telemedicine-dependent medication flow before December 31, 2026.
- Download my records. Build an export that can meet a 30-day access request in the electronic format the patient asks for, if readily producible. See patient access export workflows.
Compare urgent care portals, which handle episodic walk-in visits, and pain medicine intake, which starts the record this portal carries forward.
Keep, refactor, or rebuild?
A pain portal's screens are usually worth keeping. Any feature that produces or sends a prescription has to be removed and replaced with a hand-off to e-prescribing, and the messaging and admin layers need refactoring before real patients use them.
The diary screens, agreement view and messaging layout can usually stay. What changes is the plumbing: the medication flow, the email and SMS services and their agreements, notification templates, and how staff and patient views are separated. If the platform cannot export code and data, the current app becomes the specification for a rebuild.
Frequently asked questions
Can my portal have a refill button for oxycodone or hydrocodone?
Not one that works like a refill. Both are Schedule II drugs, (DEA (eCFR), 21 CFR 1308.12 -- Schedule II., verified November 15, 2026) and DEA prohibits refilling Schedule II prescriptions. (DEA (eCFR), 21 CFR 1306.12 -- Refilling prescriptions; issuance of multiple prescriptions., verified November 15, 2026) Use a medication request that goes to a clinician, who prescribes in your e-prescribing system.
Can my vibe-coded app send controlled-substance prescriptions to pharmacies?
DEA says an electronic controlled-substance prescription created with an application that does not meet its EPCS requirements is not valid. (DEA (eCFR), 21 CFR 1311.100 -- General., verified November 15, 2026) Keep prescribing in a system built for EPCS, and ask counsel about anything in between.
A patient asked us never to text about their medications. Does the portal have to honor that?
A covered provider must accommodate reasonable requests to receive communications by alternative means or at alternative locations. (HHS (eCFR), 45 CFR 164.522 -- Rights to request privacy protection for protected health information., verified November 15, 2026) Store the preference on the patient record so every feature uses it.
Should patients see their drug-screen and pill-count flags in the portal?
That is a clinical decision. Technically, keep those flags in a staff view limited by role, with audit logs recording each view. (HHS (eCFR), 45 CFR 164.312 -- Technical safeguards., verified November 15, 2026) If a patient asks for their records, the practice must act on the request within 30 days. (HHS (eCFR), 45 CFR 164.524 -- Access of individuals to protected health information., verified November 15, 2026)
What happens to telemedicine follow-ups after 2026?
DEA's telemedicine flexibilities for prescribing controlled substances expire at the end of December 31, 2026. (DEA / HHS, Fourth Temporary Extension of COVID-19 Telemedicine Flexibilities for Prescription of Controlled Medications (Federal Register, December 31, 2025, FR Doc. 2025-24123), verified November 15, 2026) Check the current rule before then and adjust any portal flow that depends on it.
Palo Alto Health Labs Fabrica
Keep building. We make it safe.
Already taking medication requests from pain patients through a portal you built? Talk it through before the next request lands on a Friday.
Fabrica moves the patient data in your vibe-coded app into an environment your practice owns, built for HIPAA compliance, with a BAA. You keep building in the tool you already use. Start with a 30-minute call about what you have built and where patient data goes today.
See how Fabrica works and book a 30-minute call
Please do not send patient information when you get in touch. The call is a conversation, not an audit or legal advice.
Sources
Every vendor statement on this page comes from the vendor's own terms, documentation or trust pages, or from the regulator, opened and read on the date shown. Vendor terms change; confirm the current version and your own signed agreement before relying on it. This page is general information, not legal advice.
- DEA (eCFR), 21 CFR 1306.12 -- Refilling prescriptions; issuance of multiple prescriptions.. Checked November 15, 2026. Page dated eCFR text current as of 2026-11-01.
- DEA (eCFR), 21 CFR 1308.12 -- Schedule II.. Checked November 15, 2026. Page dated eCFR text current as of 2026-11-01.
- DEA (eCFR), 21 CFR 1311.100 -- General.. Checked November 15, 2026. Page dated eCFR text current as of 2026-11-01.
- DEA / HHS, Fourth Temporary Extension of COVID-19 Telemedicine Flexibilities for Prescription of Controlled Medications (Federal Register, December 31, 2025, FR Doc. 2025-24123). Checked November 15, 2026. Page dated 2025-12-31 (published); effective 2026-01-01 through 2026-12-31.
- HHS (eCFR), 45 CFR 164.522 -- Rights to request privacy protection for protected health information.. Checked November 15, 2026. Page dated eCFR text current as of 2026-11-01.
- HHS (eCFR), 45 CFR 164.312 -- Technical safeguards.. Checked November 15, 2026. Page dated eCFR text current as of 2026-11-12 (Title 45 up to date as of 2026-11-12).
- HHS (eCFR), 45 CFR 164.524 -- Access of individuals to protected health information.. Checked November 15, 2026. Page dated eCFR text current as of 2026-11-12 (Title 45 up to date as of 2026-11-12).
- Architecting for HIPAA on Twilio. Checked November 15, 2026. Page dated Last Updated: June 30, 2026.
- Twilio SendGrid, Is SendGrid HIPAA Compliant?. Checked November 15, 2026. Page dated dateModified 2026-07-23 (page metadata).
- Twilio and HIPAA. Checked November 15, 2026.