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

# Create Patient's Consolidated Data

> Create Patient's Consolidated Data with a FHIR Bundle.

## Path Params

<ParamField path="id" type="string" required>
  The ID of the Patient.
</ParamField>

## Body

<ParamField body="resourceType" type="string" required>
  The resource needs to be "Bundle"
</ParamField>

<ParamField body="type" type="string" required>
  The type needs to be "collection"
</ParamField>

<ParamField body="entry" type="BackboneElement[]" required>
  The entry needs to be an array of BackboneElement, containing:

  <Expandable title="entry properties" defaultOpen="true">
    <ParamField body="resource" type="Resource" required>
      The [FHIR resource](/medical-api/fhir/resources) being contributed.
    </ParamField>
  </Expandable>
</ParamField>

See an example on [Contributing Data](/medical-api/handling-data/contribution#example-resource-to-contribute).

<Info>
  At the moment there is a limit to how much data you can
  send in a single request. The content-length must not
  exceed 1MB (and 50 resources when in `sandbox`).
</Info>

## Response

Returns a [Bundle](/medical-api/fhir/resources/bundle) of type "transaction-response" with the
entry being the outcome of the query.

<ResponseExample>
  ```javascript Metriport SDK theme={null}
  import { MetriportMedicalApi } from "@metriport/api-sdk";

  const metriport = new MetriportMedicalApi("YOUR_API_KEY");

  await metriport.createPatientConsolidated(patientId, {
    resourceType: "Bundle",
    type: "collection",
    entry: [
      {
        resource: {
          resourceType: "Appointment",
          status: "booked",
          participant: [
            {
              actor: {
                reference: `Patient/${patientId}`,
                display: "John Doe",
              },
              status: "accepted",
              period: {
                start: "2021-05-24T13:21:28.527Z",
                end: "2021-05-24T13:21:28.527Z",
              },
            },
          ],
          meta: {
            versionId: "12345",
            lastUpdated: "2023-05-24T13:21:28.527Z",
          },
        },
      },
    ],
  });
  ```
</ResponseExample>

```json theme={null}
{
  "resourceType": "Bundle",
  "id": "bc0fcad0-6457-4b9e-93b3-44212e386138",
  "type": "transaction-response",
  "entry": [
    {
      "response": {
        "status": "201 Created",
        "location": "Appointment/3/_history/1",
        "etag": "1",
        "lastModified": "2023-07-27T21:29:31.491+00:00",
        "outcome": {
          "resourceType": "OperationOutcome",
          "issue": [
            {
              "severity": "information",
              "code": "informational",
              "details": {
                "coding": [
                  {
                    "system": "https://public.metriport.com/fhir/StructureDefinition/operation-outcome",
                    "code": "SUCCESSFUL_CREATE",
                    "display": "Create succeeded."
                  }
                ]
              },
              "diagnostics": "Successfully created resource \"Appointment/3/_history/1\". Took 7ms."
            }
          ]
        }
      }
    }
  ]
}
```
