# Propose a merge of two contacts

Source: https://amanucci.com/docs/developers/api/parties/proposePartyMerge

## POST /v1/entities/{entityId}/parties/{partyId}/merge-proposals

Propose a merge of two contacts

Propose that this contact is a duplicate of another, two contacts that are one business (a human confirms). Opens a `duplicate_party` case whose subject is the pair; `mergeParty` on that case resolves it. A firm hat holding `documents.exchange` proposes; an organisation hat meets the hidden 404. Idempotent per open pair: while a case on the two is live, named either way round, the call answers 200 with it. Both must be live contacts of these books (another entity's, or none, is 404 `party_not_found`; a merged one is 409 `party_conflict`), two of them, and neither the entity's own party (422 `party_invalid`).

Operation ID: `proposePartyMerge`

### Parameters

```json
[
  {
    "schema": {
      "type": "string",
      "format": "uuid"
    },
    "required": true,
    "name": "entityId",
    "in": "path"
  },
  {
    "schema": {
      "type": "string",
      "format": "uuid"
    },
    "required": true,
    "name": "partyId",
    "in": "path"
  }
]
```

### Request body

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ProposePartyMerge"
      }
    }
  }
}
```

### Responses

#### 200 A live case already holds the pair: this is it.

```json
{
  "application/json": {
    "schema": {
      "$ref": "#/components/schemas/PartyMergeProposal"
    }
  }
}
```

#### 201 The case is open, the pair its subject.

```json
{
  "application/json": {
    "schema": {
      "$ref": "#/components/schemas/PartyMergeProposal"
    }
  }
}
```

#### 401 Dead or absent credential (`unauthenticated`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 403 Authenticated, present, and refused: a missing grant, a missing seat, or a missing step-up.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 404 Absent, or hidden from this asker — the two are indistinguishable (`not-found`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 409 The world is not in the state the request assumed: a stale `expectedSeq`, or a transition already made.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 422 The request did not satisfy the schema (`invalid-input`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 429 Too many requests on this door's bucket (`rate-limited`); refused before any handler ran, `Retry-After` says when to come back.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 503 Temporarily unavailable; `Retry-After` says when to come back.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```
