# Merge two records

## `POST /v1/records/{id}/merge`

The caller must act as a user. The ID in the URL identifies the survivor. Requires the `write` scope.

```json
{
  "tags": [
    "Records"
  ],
  "operationId": "merge-record",
  "summary": "Merge two records",
  "description": "The caller must act as a user. The ID in the URL identifies the survivor. Requires the `write` scope.",
  "x-retainer-scope": "write",
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "description": "Retainer identifier.",
      "example": "d2c0648c-2994-4f16-bdf1-a0136be6037d",
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    },
    {
      "in": "header",
      "name": "Idempotency-Key",
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
      },
      "description": "Reuse the same key with the same request to retry."
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "bindings": {
              "type": "object",
              "properties": {
                "bindings_revision": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "objectId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "fieldIds": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "additionalProperties": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                }
              },
              "required": [
                "bindings_revision",
                "objectId",
                "fieldIds"
              ],
              "additionalProperties": false
            },
            "recordId": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "values": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "recordId"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Successful response.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MergeResult"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "default": {
      "$ref": "#/components/responses/ApiError"
    }
  }
}
```

[Full OpenAPI contract](/openapi.json)
