---
title: Upload Document
slug: upload-document
docTags: 
createdAt: 2023-09-12T11:09:22.690Z
---

The Founda Health Platform allows applications to upload/publish documents to the EHR of a hospital. This interaction allows medical devices or applications that are generating reports like questionnaires, directly into the patient's EHR.

### Profile

The Upload Document interaction with the Founda Platform is based on the IHE MHD profile. An application can use the ITI-65 transaction to upload a document, that has to comply with the [MHD Minimal Provide Document Bundle](https://profiles.ihe.net/ITI/MHD/StructureDefinition-IHE.MHD.Minimal.ProvideBundle.html) resource profile. The \_profile parameter should be included in the payload that is being send to the endpoint.

**How to include the profile URL in the request body:**

```json
{
    "meta": {
        "profile": [
            "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.ProvideBundle"
        ]
    }
}
```

### Interaction

A document can be published with a **POST** request to the base FHIR endpoint: `http://api.<region>.founda.com/1/health/organizations/<org-x>/fhir/4/`depending on the [region](docId\:ncFf15xNu1WGlST2wNm-P) you are in.

The FHIR Bundle for this profile is expected to be of type `transaction` and is expected to include a minimal set of FHIR resources:&#x20;

- One List resource modelled after an IHE XDS [SubmissionSet](https://profiles.ihe.net/ITI/TF/Volume3/ch-4.2.html#4.2.1.2)
- One DocumentReference resource modelled after an IHE XDS [DocumentEntry](https://profiles.ihe.net/ITI/TF/Volume3/ch-4.2.html#4.2.1.1)
- One Binary resource containing the actual document to be uploaded
- One Patient resource containing the patient demographics that is the subject of the actual document
- One or more FHIR resources referenced by the documentReference.context&#x20;

For more details on the FHIR bundle definition please see the: [Formal Views of Profile Content](https://profiles.ihe.net/ITI/MHD/StructureDefinition-IHE.MHD.Minimal.ProvideBundle.html#profile) in the IHE MHD profile.

In order to format your Bundle correctly, you can use the example resource payload in the file below:

::File{src="https://api.archbee.com/api/presign/qsnSu06VCo6Yg7Tb9KMlD/17n3tF_-VhF0YA_t5MNtc_iti-65-minimal-document-provide-bundle.json" label="iti-65-minimal-document-provide-bundle.json" isUploading="false"}

:::hint{type="warning"}
To be able to publish a document, the Client you are using has to be authorized to publish a Bundle of type `transaction`. This can be requested and set-up by applications in the [Client Management](docId\:vuYHChkPC7QGZOhTFjWZk) section of the Console.
:::

### Example API call

::::CodeDrawer{title="Upload Document" isResponseExpanded="true" autoGeneratedAnchorSlug="upload-document" legacyHash="PWGPp0r773A8GYhpKp7kp"}
:::CodeblockTabsExamples
```curl
curl --location 'https://api.eu.founda.com/1/health/organizations/org-4c5739ba994d4ce9b5255d3f84a2d367/fhir/4/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ory_at_xAaz7Fdz2xsLsfxKiH-5I0kSFVuLH0q-fbTLKM0-vn0.GeiZjJEig4p5nmypcuDFFMhhBEMU6d-54oVy8K41V-0' \
--data '{
    "resourceType": "Bundle",
    "meta": {
        "profile": [
            "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.ProvideBundle"
        ]
    },
    "type": "transaction",
    "timestamp": "2023-04-21T08:19:13+00:00",
    "entry": [
        {
            "fullUrl": "urn:uuid:d7385c46-f683-4d8d-a167-a92478b39a18",
            "resource": {
                "resourceType": "List",
                "id": "d7385c46-f683-4d8d-a167-a92478b39a18",
                "meta": {
                    "profile": [
                        "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.SubmissionSet"
                    ]
                },
                "extension" : [
                    {
                        "url" : "https://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-sourceId",
                        "valueIdentifier" : {
                        "value" : "urn:oid:1.2.3.4"
                      }
                    }
                ],
                "status": "current",
                "mode": "working",
                "code" : {
                    "coding" : [
                      {
                        "system" : "https://profiles.ihe.net/ITI/MHD/CodeSystem/MHDlistTypes",
                        "code" : "submissionset"
                      }
                    ]
                },
                "subject": {
                    "reference": "urn:uuid:2b405ca5-d290-41cf-9354-9eb039120c14"
                },
                "date": "2023-04-21T08:19:13+00:00",
                "entry": [
                    {
                        "item": {
                            "reference": "urn:uuid:aa1c1684-e14f-4785-99b7-71c5d88a4e1d"
                        }
                    }
                ]
            },
            "request": {
                "method": "POST",
                "url": "List"
            }
        },
        {
            "fullUrl": "urn:uuid:aa1c1684-e14f-4785-99b7-71c5d88a4e1d",
            "resource": {
                "resourceType": "DocumentReference",
                "id": "aa1c1684-e14f-4785-99b7-71c5d88a4e1d",
                "meta": {
                    "profile": [
                        "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.DocumentReference"
                    ]
                },
                "masterIdentifier": {
                    "system": "http://www.somedomain.com/masterIdentifier",
                    "value": "4334"
                },
                "status": "current",
                "subject": {
                    "reference": "urn:uuid:2b405ca5-d290-41cf-9354-9eb039120c14"
                },
                "content": [
                    {
                        "attachment": {
                            "creation": "2023-04-27T08:19:13+00:00",
                            "contentType": "application/pdf",
                            "url": "urn:uuid:1c89145a-d172-4a51-9a02-3e88aba802ae"
                        }
                    }
                ],
                "author": [
                    {
                        "type": "Device",
                        "identifier": {
                            "system": "http://www.somedomain.com/device",
                            "value": "DeviceName"
                        }
                    }
                ],
                "context": {
                    "encounter": [
                        {
                            "reference": "urn:uuid:1837d6b3-4096-4d1b-8574-875d3131bff9"
                        }
                    ],
                    "event": [
                        {
                            "coding": [
                                {
                                    "display": "Some clincial event",
                                    "system": "http://www.somedomain.com/event-codes",
                                    "code": "47"
                                }
                            ],
                            "text": "Free text related to this event"
                        }
                    ],
                    "period": {
                        "start": "2023-04-20T12:28:24.000000Z",
                        "end": "2023-04-20T12:29:17.000000Z"
                    },
                    "practiceSetting": {
                        "coding": [
                            {
                                "system": "http://www.somedomain/com/practice-setting",
                                "code": "CAR",
                                "display": "Cardiology"
                            }
                        ],
                        "text": "Free text related to this practice setting"
                    }
                }
            },
            "request": {
                "method": "POST",
                "url": "DocumentReference"
            }
        },
        {
            "fullUrl": "urn:uuid:2b405ca5-d290-41cf-9354-9eb039120c14",
            "resource": {
                "resourceType": "Patient",
                "id": "2b405ca5-d290-41cf-9354-9eb039120c14",
                "identifier": [
                    {
                        "use": "usual",
                        "type": {
                            "coding": [
                                {
                                    "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                                    "code": "MR"
                                }
                            ]
                        },
                        "system": "http://www.somedomain.com/assigning-authority",
                        "value": "09869613"
                    }
                ],
                "name": [
                    {
                        "family": "FamilyName",
                        "given": [
                            "FirstName"
                        ]
                    }
                ]
            },
            "request": {
                "method": "POST",
                "url": "Patient"
            }
        },
        {
            "fullUrl": "urn:uuid:1837d6b3-4096-4d1b-8574-875d3131bff9",
            "resource": {
                "resourceType": "Encounter",
                "id": "1837d6b3-4096-4d1b-8574-875d3131bff9",
                "status": "finished",
                "basedOn": [
                    {
                        "reference": "urn:uuid:f450732c-3b0b-49d9-a69b-b788f54e48ba"
                    }
                ],
                "class": {
                    "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
                    "code": "IMP",
                    "display": "inpatient encounter"
                },
                "subject": {
                    "reference": "urn:uuid:2b405ca5-d290-41cf-9354-9eb039120c14"
                },
                "identifier": [
                    {
                        "use": "official",
                        "system": "http://www.somedomain.com/patient-identifier",
                        "value": "123456789"
                    }
                ],
                "reasonReference": [
                    {
                        "reference": "urn:uuid:c55b6f85-4b04-482a-b25f-a1c703728adb"
                    }
                ],
                "period": {
                    "start": "2023-04-20"
                }
            },
            "request": {
                "method": "POST",
                "url": "Encounter"
            }
        },
        {
            "fullUrl": "urn:uuid:f450732c-3b0b-49d9-a69b-b788f54e48ba",
            "resource": {
                "resourceType": "ServiceRequest",
                "subject": {
                    "reference": "urn:uuid:2b405ca5-d290-41cf-9354-9eb039120c14"
                },
                "status": "active",
                "intent": "proposal",
                "code": {
                    "coding": [
                        {
                            "system": "http://www.somedomain.com/procedure-code",
                            "code": "722009"
                        }
                    ],
                    "text": "Free text related to this procedure"
                },
                "identifier": [
                    {
                        "use": "usual",
                        "type": {
                            "coding": [
                                {
                                    "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                                    "code": "PLAC"
                                }
                            ]
                        },
                        "system": "http://www.somedomain.com/placer-order-number",
                        "value": "P12345"
                    },
                    {
                        "type": {
                            "coding": [
                                {
                                    "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                                    "code": "FILL"
                                }
                            ]
                        },
                        "system": "http://www.somedomain.com/filler-order-number",
                        "value": "F12345"
                    }
                ]
            },
            "request": {
                "method": "POST",
                "url": "ServiceRequest"
            }
        },
        {
            "fullUrl": "urn:uuid:c55b6f85-4b04-482a-b25f-a1c703728adb",
            "resource": {
                "resourceType": "Procedure",
                "id": "c55b6f85-4b04-482a-b25f-a1c703728adb",
                "status": "completed",
                "performedDateTime": "2023-04-21",
                "subject": {
                    "reference": "urn:uuid:2b405ca5-d290-41cf-9354-9eb039120c14"
                },
                "bodySite": [
                    {
                        "coding": [
                            {
                                "display": "left-side",
                                "system": "http://www.somedomain.com/body-site",
                                "code": "left"
                            }
                        ]
                    }
                ]
            },
            "request": {
                "method": "POST",
                "url": "Procedure"
            }
        },
        {
            "fullUrl": "urn:uuid:1c89145a-d172-4a51-9a02-3e88aba802ae",
            "resource": 
            {
                "resourceType": "Binary",
                "id": "1c89145a-d172-4a51-9a02-3e88aba802ae",
                "contentType": "application/pdf",
                "data": "JVBERi0x..."
            },
            "request": 
            {
                "method": "POST",
                "url": "Binary"
            }
        }
    ]
}
'
```
:::

:::CodeblockTabsResponses
```javascript
{
    "resourceType": "Bundle",
    "id": "e135d3df-6b50-4f7c-b6bf-c10fec4b1149",
    "type": "transaction-response",
    "link": [
        {
            "relation": "self",
            "url": "https://api.eu.founda.com/1/health/organizations/org-4c5739ba994d4ce9b5255d3f84a2d367/fhir/4/"
        }
    ],
    "entry": [
        {
            "response": {
                "status": "201 Created",
                "location": "List/2224/_history/1",
                "etag": "1",
                "lastModified": "2023-10-16T13:20:04.942+00:00"
            }
        },
        {
            "response": {
                "status": "201 Created",
                "location": "DocumentReference/2225/_history/1",
                "etag": "1",
                "lastModified": "2023-10-16T13:20:04.942+00:00"
            }
        },
        {
            "response": {
                "status": "201 Created",
                "location": "Patient/2226/_history/1",
                "etag": "1",
                "lastModified": "2023-10-16T13:20:04.942+00:00"
            }
        },
        {
            "response": {
                "status": "201 Created",
                "location": "Encounter/2227/_history/1",
                "etag": "1",
                "lastModified": "2023-10-16T13:20:04.942+00:00"
            }
        },
        {
            "response": {
                "status": "201 Created",
                "location": "ServiceRequest/2228/_history/1",
                "etag": "1",
                "lastModified": "2023-10-16T13:20:04.942+00:00"
            }
        },
        {
            "response": {
                "status": "201 Created",
                "location": "Procedure/2229/_history/1",
                "etag": "1",
                "lastModified": "2023-10-16T13:20:04.942+00:00"
            }
        },
        {
            "response": {
                "status": "201 Created",
                "location": "Binary/2230/_history/1",
                "etag": "1",
                "lastModified": "2023-10-16T13:20:04.942+00:00"
            }
        }
    ]
}
```
:::
::::

