# Relation Delete

Source: https://marketplace.gohighlevel.com/docs/webhook/RelationDelete

## Overview

This webhook response is triggered when an existing relation between objects is deleted.

For example, in a business management system, a company may want to remove an relation between a custom object record and a contact. In this case:
- The **first object** (custom object record) could represent an entity such as a project or a transaction.
- The **second object** (contact) would represent a person associated with the custom object.

This event is emitted for relations deleted through custom object associations and through company-to-contact associations: both the built-in primary company link and user-defined labels (for example, "Employee"). See [Company-to-contact associations](#company-to-contact-associations).

## Schema

The webhook response follows the JSON schema below:

```json json_schema
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "firstObjectKey": {
      "type": "string"
    },
    "firstRecordId": {
      "type": "string"
    },
    "secondObjectKey": {
      "type": "string"
    },
    "secondRecordId": {
      "type": "string"
    },
    "associationId": {
      "type": "string"
    },
    "locationId": {
      "type": "string"
    },

  }
}
```

## Field Descriptions

### `id`
- Type: `string`
- Unique identifier for the deleted association.

### `firstObjectKey`
- Type: `string`
- Key representing the first object in the association.

### `firstRecordId`
- Type: `string`
- Identifier of the first object’s specific record.

### `secondObjectKey`
- Type: `string`
- Key representing the second object in the association.

### `secondRecordId`
- Type: `string`
- Identifier of the second object’s specific record.

### `associationId`
- Type: `string`
- Unique identifier for the association that was deleted.

### `locationId`
- Type: `string`
- Identifies the location associated with the deleted association.

## Example Response

```json
{
  "id": "67ae0d741119d218c9d0c477",
  "firstObjectKey": "custom_objects.mad",
  "firstRecordId": "67a349a79b28947ec1f65bb5",
  "secondObjectKey": "contact",
  "secondRecordId": "emqfhnG3g9D9chy9inTz",
  "associationId": "669e5795add2094075906c65",
  "locationId": "eHy2cOSZxMQzQ6Yyvl8P"
}
```

## Company-to-contact associations

`RelationDelete` is delivered for company-to-contact relations:

- **Primary company** — the built-in association, delivered with `associationId` `BUSINESSES_CONTACTS_ASSOCIATION`. Primary company links removed through the associations relations API (for example, on the record page) trigger this event when the link has a relation record; older primary links stored only on the contact's `businessId` do not. Changes made only to the contact's `businessId` field (for example, bulk **Manage companies**) do not.
- **User-defined labels** (for example, "Employee") — delivered with the label's own `associationId`.

In both cases `firstObjectKey` / `secondObjectKey` are `business` and `contact`.

Relations written by platform data migrations or backfills (for example, when existing primary company links are copied into relations) are not delivered.

## Additional Notes

- The `firstObjectKey` and `secondObjectKey` define the relationship between the deleted entities.
