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

# Merge identities

POST https://api.withverifa.com/api/v1/identities/merge
Content-Type: application/json

Merges two identities into one. The secondary identity is folded
into the primary. Per-object-type transfer toggles control which
linked data is re-pointed. Tags are always merged.

- Sessions linked to the secondary are re-pointed to the primary
- Session counts are combined (when sessions are transferred)
- Screening checks, face embeddings, IP/device links optionally transferred
- Tags are merged and deduplicated
- The secondary identity is marked as `merged` (or `redacted` if requested)

Both identities must belong to the same organization and environment.
Redacted or already-merged identities cannot be used as the secondary.


Reference: https://docs.withverifa.com/api-reference/identities/merge-identities

## Authentication

- `X-API-Key` header (required) — Organization API key. Keys are prefixed with `vk_live_` (production) or `vk_sandbox_` (sandbox).

## Request

### Headers

- `Verifa-Version` (date, optional) — API version date string (e.g. `2026-02-01`). If omitted, the version pinned to your API key is used.
- `Key-Inflection` (enum, optional, default: snake) — Response key casing. Defaults to `snake`.
  - Allowed values: `camel`, `kebab`, `snake`
- `Idempotency-Key` (string, optional) — Unique key for idempotent requests. Cached for 24 hours. Sending the same key with different parameters returns `422`.

### Body (application/json)

This endpoint expects an object.

- `primary_identity_id` (string, required) — The identity to keep.
- `secondary_identity_id` (string, required) — The identity to merge into the primary.
- `transfer` (ApiV1IdentitiesMergePostRequestBodyContentApplicationJsonSchemaTransfer, optional) — Per-object-type toggles for what to transfer. All default to true.
- `redact_secondary` (boolean, optional, default: false) — If true, redact the secondary identity's PII after merge.
- `reason` (string, optional, nullable) — Optional note explaining why the merge was performed.

## Response

### 200

Merge result.

- `primary` (IdentityDetail, required)
- `secondary` (ApiV1IdentitiesMergePostResponsesContentApplicationJsonSchemaSecondary, required)
- `transfer_summary` (ApiV1IdentitiesMergePostResponsesContentApplicationJsonSchemaTransferSummary, required) — Which object types were transferred.
- `redacted_secondary` (boolean, required)
- `reason` (string, optional, nullable)

## Errors

### 401 Unauthorized Error

Missing or invalid API key.

- `error` (string, required) — Short error code.
- `status_code` (integer, required) — HTTP status code.
- `detail` (string, optional) — Human-readable error description.

### 404 Not Found Error

Resource not found.

- `error` (string, required) — Short error code.
- `status_code` (integer, required) — HTTP status code.
- `detail` (string, optional) — Human-readable error description.

### 422 Unprocessable Entity Error

Validation error (same identity, already merged, or redacted).

- `error` (string, required) — Short error code.
- `status_code` (integer, required) — HTTP status code.
- `detail` (string, optional) — Human-readable error description.

## Types

### ApiV1IdentitiesMergePostRequestBodyContentApplicationJsonSchemaTransfer

Per-object-type toggles for what to transfer. All default to true.

- `sessions` (boolean, optional, default: true)
- `screening_checks` (boolean, optional, default: true)
- `face_embeddings` (boolean, optional, default: true)
- `ip_links` (boolean, optional, default: true)
- `device_links` (boolean, optional, default: true)

### IdentityDetail

- `id` (string, required)
- `status` (string, required)
- `session_count` (integer, required)
- `is_sandbox` (boolean, required)
- `created_at` (datetime, required)
- `external_ref` (string, optional, nullable)
- `latest_session_id` (string, optional, nullable)
- `latest_result_id` (string, optional, nullable)
- `latest_session_snapshot` (LatestSessionSnapshot, optional, nullable) — Most-recent session result. `null` when the identity has no results yet (e.g. screening-only identities) or when the result row could not be loaded.
- `country` (string, optional, nullable)
- `extracted_data` (ExtractedData, optional) — PII extracted from the identity document. Fields returned depend on your organization's `api_pii_fields` configuration.
- `documents` (list of IdentityDocument, optional) — Every government document this person has verified with, primary first. A driver-license verification followed by a passport verification yields two entries — earlier documents are never replaced. `extracted_data.document_*` mirrors the primary entry (strongest verified, unexpired document; passport outranks a driver license). Only returned on single-identity responses.
- `first_verified_at` (datetime, optional, nullable)
- `last_verified_at` (datetime, optional, nullable)
- `archived_at` (datetime, optional, nullable)
- `identity_type_id` (string, optional, nullable)
- `custom_fields` (map from string to any, optional)
- `tags` (list of string, optional)
- `updated_at` (datetime, optional)

### ApiV1IdentitiesMergePostResponsesContentApplicationJsonSchemaSecondary

- `id` (string, required)
- `status` (string, required) — "merged" or "redacted" depending on redact_secondary.

### ApiV1IdentitiesMergePostResponsesContentApplicationJsonSchemaTransferSummary

Which object types were transferred.

- `sessions` (boolean, optional)
- `screening_checks` (boolean, optional)
- `face_embeddings` (boolean, optional)
- `ip_links` (boolean, optional)
- `device_links` (boolean, optional)

### LatestSessionSnapshot

Compact view of the identity's most recent verification result, joined from `session_results`. Fields that used to live on the identity row (face_match, age_check, rejection_reason, etc.) moved here once we stopped denormalizing per-session outcomes onto the identity.

- `result_id` (string, optional)
- `session_id` (string, optional)
- `status` (string, optional, nullable)
- `face_match_passed` (boolean, optional, nullable)
- `face_match_score` (double, optional, nullable)
- `age_check_passed` (boolean, optional, nullable)
- `extracted_age` (integer, optional, nullable)
- `rejection_reason` (string, optional, nullable)
- `rejection_reason_code` (enum, optional) — Structured reason a verification was rejected. Complements the free-text `rejection_reason`. Stable enum — clients can pivot UI and metrics off this without parsing prose.
  - Allowed values: `document_unreadable`, `document_expired`, `document_unsupported`, `document_authenticity`, `face_mismatch`, `liveness_failed`, `age_under_threshold`, `aml_hit`, `duplicate_identity`, `blocklist_match`, `geo_blocked`, `identity_blocked`, `poa_failed`, `poa_review`, `nfc_failed`, `consistency_failed`, `manual_reject`, `other`
- `check_results` (map from string to any, optional)
- `reviewed_by` (string, optional, nullable)
- `reviewed_at` (datetime, optional, nullable)
- `created_at` (datetime, optional, nullable)

### ExtractedData

PII extracted from the identity document. Fields returned depend on your organization's `api_pii_fields` configuration.

- `first_name` (string, optional, nullable)
- `last_name` (string, optional, nullable)
- `date_of_birth` (string, optional, nullable) — ISO 8601 date (YYYY-MM-DD).
- `address` (Address, optional)
- `document_number` (string, optional, nullable)
- `nationality` (string, optional, nullable)
- `gender` (string, optional, nullable)
- `ssn` (string, optional, nullable) — Social Security Number (US only).
- `document_type` (string, optional, nullable) — Type of document (e.g. drivers_license, passport, state_id).
- `document_expiration_date` (string, optional, nullable) — ISO 8601 date (YYYY-MM-DD).
- `document_issuing_state` (string, optional, nullable) — Issuing state or jurisdiction code.

### IdentityDocument

A government document attached to an identity as verification evidence.

- `id` (string, required)
- `document_type` (string, required)
- `status` (enum, required) — `verified` once any approved session used this document. A later failed session never downgrades it — the failure lives on the session.
  - Allowed values: `verified`, `unverified`
- `expired` (boolean, required) — Derived from `document_expiration_date` at read time.
- `verification_count` (integer, required) — Sessions that verified with this exact document.
- `first_seen_at` (datetime, required)
- `last_seen_at` (datetime, required)
- `document_number` (string, optional, nullable)
- `personal_number` (string, optional, nullable)
- `document_issuing_country` (string, optional, nullable)
- `document_issuing_state` (string, optional, nullable)
- `issuing_authority` (string, optional, nullable)
- `document_expiration_date` (string, optional, nullable)
- `document_issue_date` (string, optional, nullable)
- `mrz_line1` (string, optional, nullable)
- `mrz_line2` (string, optional, nullable)
- `mrz_line3` (string, optional, nullable)
- `attribute_conflicts` (list of enum, optional) — Profile fields this document disagreed with when it was captured (field names only — values are never echoed). Worth a reviewer's look.
  - Allowed values: `first_name`, `last_name`, `date_of_birth`
- `captures` (list of IdentityDocumentCapturesItems, optional) — Image files that evidenced this credential, newest first, as signed time-limited URLs. Captures from sessions past your sensitive-data access window are omitted.
- `first_session_id` (string, optional, nullable)
- `latest_session_id` (string, optional, nullable)

### Address

- `line1` (string, optional, nullable)
- `line2` (string, optional, nullable)
- `city` (string, optional, nullable)
- `state` (string, optional, nullable)
- `zip` (string, optional, nullable)

### IdentityDocumentCapturesItems

- `document_id` (string, optional)
- `doc_type` (string, optional)
- `session_id` (string, optional, nullable)
- `mime_type` (string, optional, nullable)
- `url` (string, optional) — Signed download URL; valid for `expires_in` seconds.
- `expires_in` (integer, optional)
- `created_at` (datetime, optional, nullable)

## Examples

**Request**

```json
{
  "primary_identity_id": "idn_abc123",
  "secondary_identity_id": "idn_def456"
}
```

**Response**

```json
{
  "primary": {
    "id": "idn_abc123",
    "status": "string",
    "session_count": 1,
    "is_sandbox": true,
    "created_at": "2024-01-15T09:30:00Z",
    "external_ref": "string",
    "latest_session_id": "string",
    "latest_result_id": "string",
    "latest_session_snapshot": {
      "result_id": "string",
      "session_id": "string",
      "status": "string",
      "face_match_passed": true,
      "face_match_score": 1.1,
      "age_check_passed": true,
      "extracted_age": 1,
      "rejection_reason": "string",
      "rejection_reason_code": "document_unreadable",
      "check_results": {},
      "reviewed_by": "string",
      "reviewed_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z"
    },
    "country": "string",
    "extracted_data": {
      "first_name": "string",
      "last_name": "string",
      "date_of_birth": "string",
      "address": {
        "line1": "string",
        "line2": "string",
        "city": "string",
        "state": "string",
        "zip": "string"
      },
      "document_number": "string",
      "nationality": "string",
      "gender": "string",
      "ssn": "string",
      "document_type": "string",
      "document_expiration_date": "string",
      "document_issuing_state": "string"
    },
    "documents": [
      {
        "id": "iddoc_abc123",
        "document_type": "passport",
        "status": "verified",
        "expired": true,
        "verification_count": 1,
        "first_seen_at": "2024-01-15T09:30:00Z",
        "last_seen_at": "2024-01-15T09:30:00Z",
        "document_number": "string",
        "personal_number": "string",
        "document_issuing_country": "string",
        "document_issuing_state": "string",
        "issuing_authority": "string",
        "document_expiration_date": "string",
        "document_issue_date": "string",
        "mrz_line1": "string",
        "mrz_line2": "string",
        "mrz_line3": "string",
        "attribute_conflicts": [
          "first_name"
        ],
        "captures": [
          {
            "document_id": "doc_abc123",
            "doc_type": "id_front",
            "session_id": "string",
            "mime_type": "string",
            "url": "string",
            "expires_in": 1,
            "created_at": "2024-01-15T09:30:00Z"
          }
        ],
        "first_session_id": "string",
        "latest_session_id": "string"
      }
    ],
    "first_verified_at": "2024-01-15T09:30:00Z",
    "last_verified_at": "2024-01-15T09:30:00Z",
    "archived_at": "2024-01-15T09:30:00Z",
    "identity_type_id": "string",
    "custom_fields": {},
    "tags": [
      "string"
    ],
    "updated_at": "2024-01-15T09:30:00Z"
  },
  "secondary": {
    "id": "string",
    "status": "merged"
  },
  "transfer_summary": {
    "sessions": true,
    "screening_checks": true,
    "face_embeddings": true,
    "ip_links": true,
    "device_links": true
  },
  "redacted_secondary": true,
  "reason": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.withverifa.com/api/v1/identities/merge"

payload = {
    "primary_identity_id": "idn_abc123",
    "secondary_identity_id": "idn_def456"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.withverifa.com/api/v1/identities/merge';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"primary_identity_id":"idn_abc123","secondary_identity_id":"idn_def456"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withverifa.com/api/v1/identities/merge"

	payload := strings.NewReader("{\n  \"primary_identity_id\": \"idn_abc123\",\n  \"secondary_identity_id\": \"idn_def456\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	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://api.withverifa.com/api/v1/identities/merge")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"primary_identity_id\": \"idn_abc123\",\n  \"secondary_identity_id\": \"idn_def456\"\n}"

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.post("https://api.withverifa.com/api/v1/identities/merge")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"primary_identity_id\": \"idn_abc123\",\n  \"secondary_identity_id\": \"idn_def456\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.withverifa.com/api/v1/identities/merge', [
  'body' => '{
  "primary_identity_id": "idn_abc123",
  "secondary_identity_id": "idn_def456"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.withverifa.com/api/v1/identities/merge");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"primary_identity_id\": \"idn_abc123\",\n  \"secondary_identity_id\": \"idn_def456\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "primary_identity_id": "idn_abc123",
  "secondary_identity_id": "idn_def456"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withverifa.com/api/v1/identities/merge")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```