> ## 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.

# Update Company

> Update an existing company's domain or name

## Overview

This endpoint updates an existing company using **sparse PUT** semantics. Any field you include is replaced with the value you provide; any field you omit is left untouched.

## Path Parameters

<ParamField path="id" type="integer" required>
  The unique identifier of the company to update.
</ParamField>

## Request Body

At least one of `domain` or `name` must be provided.

<ParamField body="domain" type="string" placeholder="acme.io">
  New domain for the company. Omit to leave the existing domain untouched. Maximum 255 characters.
</ParamField>

<ParamField body="name" type="string" placeholder="Acme Inc">
  New name for the company. Omit to leave the existing name untouched. Maximum 255 characters.
</ParamField>

## Response

### Success Response

Returns the full company object after the update.

<ResponseField name="id" type="integer">
  The unique identifier of the company.
</ResponseField>

<ResponseField name="domain" type="string">
  The domain currently associated with this company.
</ResponseField>

<ResponseField name="name" type="string">
  The name currently associated with this company.
</ResponseField>

### Error Response

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

## Example Requests

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://app.cometly.com/public-api/v1/companies/12345" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
      "domain": "acme.io",
      "name": "Acme Inc"
    }'
  ```

  ```javascript JavaScript theme={null}
  const companyId = 12345;
  const response = await fetch(`https://app.cometly.com/public-api/v1/companies/${companyId}`, {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      domain: 'acme.io',
      name: 'Acme Inc'
    })
  });

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

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

  $data = [
      'domain' => 'acme.io',
      'name' => 'Acme Inc',
  ];

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

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

  company_id = 12345
  url = f'https://app.cometly.com/public-api/v1/companies/{company_id}'
  headers = {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Accept': 'application/json',
      'Content-Type': 'application/json'
  }

  data = {
      'domain': 'acme.io',
      'name': 'Acme Inc',
  }

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

## Status Codes

| Status Code | Description                                                                               |
| ----------- | ----------------------------------------------------------------------------------------- |
| 200         | Company successfully updated                                                              |
| 401         | Missing or invalid API key                                                                |
| 403         | API key doesn't have permission or subscription is inactive                               |
| 404         | Company not found                                                                         |
| 422         | Invalid parameters provided (check error message for details)                             |
| 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.
* **Sparse PUT semantics**: Only the fields you include in the request body are modified. Other columns are left untouched.
* **At least one field is required**: A request with neither `domain` nor `name` is rejected with a 422 error.
