> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.joincandidhealth.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.joincandidhealth.com/_mcp/server.

# Scan

GET https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan

Scans up to 1000 patient merge updates. The since query parameter is inclusive, and the result list is ordered by updatedAt ascending.

**Polling Pattern:**
To continuously poll for updates without gaps:
1. Make your initial request with a `since` timestamp (e.g., `since=2020-01-01T13:00:00.000Z`)
2. The API returns 100 by default and up to 1000 patient merge records, sorted by `updated_at` ascending
3. Find the `updated_at` value from the last record in the response
4. Use that `updated_at` value as the `since` parameter in your next request
5. Repeat steps 2-4 to ingest updates until you receive an empty list

**Important Notes:**
- The `since` parameter is inclusive, so you may receive the last record from the previous batch again (you can deduplicate by ID and version)
- All patient merge records include `updated_at`, `id`, `version`, `deactivated`, and `updating_user` fields for tracking changes
- Timestamps have millisecond resolution for precise ordering

Reference: https://docs.joincandidhealth.com/api-reference/pre-encounter/patient-merges/v-1/scan

## Authentication

- OAuth2 — send the obtained token as `Authorization: Bearer <token>`

## Servers

- `https://pre-api.joincandidhealth.com` (Production, default)
- `https://pre-api-staging.joincandidhealth.com` (Staging)
- `https://sandbox-pre-api.joincandidhealth.com` (CandidSandbox)
- `https://staging-pre-api.joincandidhealth.com` (CandidStaging)
- `http://localhost:4000` (Local)

## Request

### Query parameters

- `since` (datetime, required)
- `maxResults` (integer, optional)

## Response

### 200

- `list of PatientMerge`

## Types

### PatientMerge

A PatientMerge object with immutable server-owned properties.

- `alternative_patient_mrn` (string, required) — The MRN of the patient that was merged.
- `deactivated` (boolean, required) — True if the object is deactivated. Deactivated objects are not returned in search results but are returned in all other endpoints including scan.
- `id` (string, required) — The unique identifier for a PatientMerge record.
- `organization_id` (string, required) — The organization that owns this object.
- `primary_patient_mrn` (string, required) — The MRN of the patient that is getting a patient merged into them.
- `updated_at` (datetime, required)
- `updating_user_id` (string, required) — The user ID of the user who last updated the object.
- `version` (integer, required) — The version of the object. Any update to any property of an object object will create a new version.

## Examples

**Response**

```json
[
  {
    "alternative_patient_mrn": "alternative_patient_mrn",
    "deactivated": true,
    "id": "id",
    "organization_id": "organization_id",
    "primary_patient_mrn": "primary_patient_mrn",
    "updated_at": "2024-01-15T09:30:00Z",
    "updating_user_id": "updating_user_id",
    "version": 1
  },
  {
    "alternative_patient_mrn": "alternative_patient_mrn",
    "deactivated": true,
    "id": "id",
    "organization_id": "organization_id",
    "primary_patient_mrn": "primary_patient_mrn",
    "updated_at": "2024-01-15T09:30:00Z",
    "updating_user_id": "updating_user_id",
    "version": 1
  }
]
```

**SDK Code**

```python
import requests

url = "https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan"

querystring = {"since":"2024-01-15T09:30:00Z"}

headers = {"Authorization": "<token>."}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan?since=2024-01-15T09%3A30%3A00Z';
const options = {method: 'GET', headers: {Authorization: '<token>.'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan?since=2024-01-15T09%3A30%3A00Z"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<token>.")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan?since=2024-01-15T09%3A30%3A00Z")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<token>.'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan?since=2024-01-15T09%3A30%3A00Z")
  .header("Authorization", "<token>.")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan?since=2024-01-15T09%3A30%3A00Z', [
  'headers' => [
    'Authorization' => '<token>.',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan?since=2024-01-15T09%3A30%3A00Z");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<token>.");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<token>."]

let request = NSMutableURLRequest(url: NSURL(string: "https://pre-api.joincandidhealth.com/patient-merge/v1/updates/scan?since=2024-01-15T09%3A30%3A00Z")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```