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

# Split and merge SOAP notes with Multi-SOAP

> Use the Squire SDK to split a single SOAP consultation recording into multiple episode notes, or merge previously split notes back into one unified summary.

Multi-SOAP lets you take a single consultation recording and split it into separate SOAP notes — one per patient concern discussed during the visit. You can also merge previously split notes back into a unified summary if the split is no longer needed.

## Prerequisites

Before using Multi-SOAP:

* Complete a consultation using a SOAP template (for example, `soap_new_complaint_api`).
* Have the `Consultation` object returned by `startRecording`, or the consultation ID so you can reconstruct it.

## Split a consultation

Call `splitSoap` on the `Consultation` object to divide the consultation into separate SOAP notes. The method is asynchronous and resolves with the updated summary containing one entry per episode.

```javascript theme={null}
const splitSummary = await consultation.splitSoap();
console.log('Split result:', splitSummary);
// splitSummary.data contains one entry per episode.
```

## Merge split notes

If you previously split a consultation and want to consolidate the notes back into a single summary, call `mergeSoap`:

```javascript theme={null}
const mergedSummary = await consultation.mergeSoap();
console.log('Merge result:', mergedSummary);
// mergedSummary.data contains a single consolidated episode.
```

<Warning>
  You can only merge a consultation that has already been split. Calling `mergeSoap` on an unsplit consultation will result in an error.
</Warning>

## Full example

```javascript theme={null}
// Start a SOAP consultation.
const consultation = await squire.startRecording({
  inputLanguage: 'nl',
  templateId: 'soap_new_complaint_api',
});

// ... recording in progress ...

squire.stopRecording();

// Wait for the summary-ready event, then split.
squire.on('summary-ready', async () => {
  // Split the consultation into multiple episodes.
  const splitSummary = await consultation.splitSoap();
  console.log('Split result:', splitSummary);

  // Or merge episodes back into a single consultation.
  const mergedSummary = await consultation.mergeSoap();
  console.log('Merge result:', mergedSummary);
});
```

## Recover a lost consultation reference

If you no longer hold the `Consultation` object — for example, after a page refresh or in-app navigation — reconstruct it from the consultation ID using `squire.consultation()`:

```javascript theme={null}
const consultation = squire.consultation('consultation-uuid');

// Call splitSoap, mergeSoap, or getSummary as normal.
const summary = await consultation.splitSoap();
```

## Output format

After splitting, the returned summary contains one entry per episode in the `data` array:

```json theme={null}
{
  "id": "8lbv3SJ7ObqOWh11",
  "data": [
    {
      "episode": "Episode 1",
      "template": "soap_new_complaint_api",
      "sections": []
    },
    {
      "episode": "Episode 2",
      "template": "soap_new_complaint_api",
      "sections": []
    }
  ]
}
```

Each episode contains its own independent SOAP sections. For the complete output structure and available fields, see the [output documentation](/integration/output).
