> For the complete documentation index, see [llms.txt](https://docs.mdintegrations.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mdintegrations.com/partner/troubleshooting/technical-concepts/security-and-data-handling.md).

# Security & Data Handling

MDI is built to handle protected health information (PHI) responsibly, and its infrastructure is HIPAA, SOC 2, and ISO 27001 compliant, as well as LegitScript certified. This page isn't a compliance deep-dive — it's a pointer to the handful of practical patterns those requirements translate into for your integration.

## Files go through the Files API first

Any file a physician needs to interact with — photos, lab results, identity documents, audio or video — must be uploaded to MDI through the Files API before it can be referenced anywhere else in the platform:

```
POST https://api.mdintegrations.com/v1/partner/files
Content-Type: multipart/form-data
```

The response returns a `file_id`, which you then reference wherever the platform expects a file:

* `drivers_license_id` on a Patient (see Identity Verification)
* `intro_video_id` on a Patient (see State AV/Sync Requirements)
* `case_files` on an Encounter
* `message_files` on a message

You can't pass a raw external URL in place of a `file_id`. Requiring every file to land in MDI's storage first — rather than being linked to from wherever it happens to be hosted — keeps PHI handling centralized and auditable instead of scattered across partner infrastructure.

## Webhook payloads are signed

Webhooks carry Patient and Encounter data, so MDI signs every payload with HMAC-SHA256. Verify the signature before trusting the contents of any webhook you receive — an unsigned or mismatched payload should be rejected, not processed. See Webhook Setup & Signature Verification for the verification steps.

## Sandbox and Live are isolated

API access is scoped per-partner into Sandbox and Live credentials. Sandbox data is synthetic and never touches real PHI, while Live data is real and subject to the full handling requirements described on this page. Keeping the two isolated means your development and testing work never puts real patient data at risk. See Sandbox vs. Live Environments for how the two environments differ and when to switch between them.

## What this means for your integration

In practice, these three patterns cover most of what you need to think about as a partner:

1. **Never build your own file storage or linking scheme for PHI** — route everything through the Files API and reference the resulting `file_id`.
2. **Never trust an unverified webhook body** — check the HMAC signature on every request before acting on it.
3. **Never point Live-only logic at Sandbox data, or vice versa** — keep credentials, and the assumptions your code makes about them, cleanly separated.

If you need specifics beyond what's covered here — audit documentation, signed BAAs, or formal compliance reports — reach out to your MDI account contact directly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mdintegrations.com/partner/troubleshooting/technical-concepts/security-and-data-handling.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
