---
title: "Update a specific relationship"
description: "PUT /contacts/{contact_id}/relationships/{relationship_id} — Replaces a relationship outright: send relationship_type_id and both related_contacts entries in full. The type can change and one contact can be swapped, but the path contact must remain a party."
canonical_url: https://developer.onepagecrm.com/api/reference/contacts/put-contacts-contact_id-relationships-relationship_id/
source: Markdown mirror of https://developer.onepagecrm.com/api/reference/contacts/put-contacts-contact_id-relationships-relationship_id/
---

`PUT /contacts/{contact_id}/relationships/{relationship_id}`

Replaces a relationship outright: send relationship_type_id and both related_contacts entries in full. The type can change and one contact can be swapped, but the path contact must remain a party.

Resource: [Contacts](https://developer.onepagecrm.com/api/reference/contacts/) · [API Reference](https://developer.onepagecrm.com/api/reference/)

## Request

```bash
curl -X PUT "https://app.onepagecrm.com/api/v3/contacts/{contact_id}/relationships/{relationship_id}" \
  -u $user_id:$api_key \
  -H "Content-Type: application/json" \
  -d '{
    "relationship_type_id": "5aaa9b059007ba08c9ebaf57",
    "related_contacts": [
      {
        "contact_id": "5aba31ea9007ba0f570c92d4",
        "variant_id": "5aaa9b059007ba08c9ebaf59"
      },
      {
        "contact_id": "5aba31ea9007ba0f570c92d5",
        "variant_id": "5aaa9b059007ba08c9ebaf59"
      }
    ]
  }'
```

Authentication is HTTP Basic — `user_id` as username, `api_key` as password.
See https://developer.onepagecrm.com/api/authentication/.

## Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `contact_id` | string | Contact ID |
| `relationship_id` | string | Relationship ID |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `relationship_type_id` | string (bson-id) |  | ID of the relationship type |
| `related_contacts` | array<object> |  | Related contacts with relationship variant names |

## Responses

### 200

OK

```json
{
  "status": 0,
  "message": "OK",
  "timestamp": 1528373119,
  "data": {
    "relationship": {
      "id": "5aaa9b059007ba08c9ebaf57",
      "relationship_type_id": "5aaa9b059007ba08c9ebaf58",
      "related_contacts": [
        {
          "variant_id": "5aaa9b059007ba08c9ebaf59",
          "variant_name": "Partner",
          "contact_id": "5aba31ea9007ba0f570c92d4",
          "first_name": "Joe",
          "last_name": "Bloggs",
          "company_id": "5aba31ea9007ba0f570c92f1",
          "company_name": "Morgan's Forensic Lab",
          "photo_url": "https://{foo.bar}/joe-bloggs.jpg",
          "owner_id": "5aba31ea9007ba0f570c92c3"
        },
        {
          "variant_id": "5aaa9b059007ba08c9ebaf59",
          "variant_name": "Partner",
          "contact_id": "5aba31ea9007ba0f570c92d5",
          "first_name": "Jane",
          "last_name": "Doe",
          "company_id": "5aba31ea9007ba0f570c92f3",
          "company_name": "Acme Inc",
          "photo_url": "https://{foo.bar}/jane-doe.jpg",
          "owner_id": "5aba31ea9007ba0f570c92c3"
        }
      ],
      "created_at": "2018-03-15T16:10:45Z",
      "modified_at": "2018-03-15T16:10:45Z"
    }
  }
}
```

Standard error responses: 400, 401, 403, 404, 409, 500 — shared across the API. See https://developer.onepagecrm.com/api/errors/.

## Related guides

- [Authentication](https://developer.onepagecrm.com/api/authentication/)
- [Errors](https://developer.onepagecrm.com/api/errors/)
- [Rate limits](https://developer.onepagecrm.com/api/rate-limits/)
- [Partial updates](https://developer.onepagecrm.com/api/partial-updates/)
