> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cometly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Detach Contact Company

> Detach a contact from its current company

## Overview

This endpoint detaches a contact from its company, leaving it with no company. In the same transaction, the contact's conversions, touchpoints, and visit metadata are re-stamped with a `null` company id, so company-level reports and the [Companies dataset](/data-warehouse/datasets/companies) `company_id` columns in the data warehouse follow immediately.

There is no request body — the contact id in the path is the whole request.

This call is idempotent: calling it on a contact that already has no company returns a normal `200`, not an error.

## Path Parameters

<ParamField path="id" type="integer" required>
  The unique identifier of the contact to detach. Merged profile aliases are automatically resolved to the current canonical contact — the response's `id` is the surviving contact.
</ParamField>

## Response

### Success Response

<ResponseField name="id" type="integer">
  The unique identifier of the contact (after resolving merged-profile aliases).
</ResponseField>

<ResponseField name="company_id" type="null">
  Always `null` after a successful detach.
</ResponseField>

### Error Response

<ResponseField name="message" type="string">
  Error description explaining what went wrong.
</ResponseField>

## Example Requests

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://app.cometly.com/public-api/v1/contacts/12345/company" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Accept: application/json"
  ```

  ```javascript JavaScript theme={null}
  const contactId = 12345;
  const response = await fetch(`https://app.cometly.com/public-api/v1/contacts/${contactId}/company`, {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Accept': 'application/json'
    }
  });

  const data = await response.json();
  console.log('Detached company:', data);
  ```

  ```php PHP theme={null}
  <?php
  $contactId = 12345;
  $url = 'https://app.cometly.com/public-api/v1/contacts/' . $contactId . '/company';
  $headers = [
      'Authorization: Bearer YOUR_API_KEY',
      'Accept: application/json'
  ];

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

  $response = curl_exec($ch);
  $result = json_decode($response, true);
  curl_close($ch);
  ?>
  ```

  ```python Python theme={null}
  import requests

  contact_id = 12345
  url = f'https://app.cometly.com/public-api/v1/contacts/{contact_id}/company'
  headers = {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Accept': 'application/json'
  }

  response = requests.delete(url, headers=headers)
  result = response.json()
  ```
</CodeGroup>

## Status Codes

| Status Code | Description                                                                                      |
| ----------- | ------------------------------------------------------------------------------------------------ |
| 200         | Contact successfully detached (also returned as a no-op when the contact already had no company) |
| 401         | Missing or invalid API key                                                                       |
| 403         | API key doesn't have permission or subscription is inactive                                      |
| 404         | Contact not found                                                                                |
| 422         | Invalid contact ID provided                                                                      |
| 429         | Too many requests - rate limit exceeded. See [Rate Limiting](/introduction/rate-limiting)        |

## Notes

* **Rate Limit**: This endpoint has a limit of **60 requests per minute** per Space. See [Rate Limiting](/introduction/rate-limiting) for details, the same bucket as [Update Contact](/api-reference/endpoint/update-contact).
* **No request body**: the contact id in the path is the whole request.
* **Rows are re-stamped, not just the pivot**: the contact's conversions, touchpoints, and visit metadata are updated to a `null` `company_id` in the same transaction, so company-level reports and the data warehouse [Companies dataset](/data-warehouse/datasets/companies) reflect the detach right away.
* **No-op on an already-detached contact**: calling this on a contact with no company still returns `200` with `company_id: null` — it is not an error.
* **Merged profiles**: If you pass an ID that was merged into another profile, the detach is applied to the canonical (current) profile, and the response's `id` is that canonical id.
* **Behavior after a manual detach depends on company identity mode**: in the default **Auto** mode, the tracker assigns a company to any contact that currently has none, so the contact's next event carrying a business-email domain undoes the detach. In **External ID** mode, the next event carrying a `company_external_id` re-points the contact the same way.
