---
title: "Add a domain to a company. Rejected if the domain already belongs to another company (naming it) or is a free-mail provider. Triggers the async domain auto-association job."
method: POST
path: "/api/v1/company/{companyId}/domain"
tags: ["Company"]
---

# Add a domain to a company. Rejected if the domain already belongs to another company (naming it) or is a free-mail provider. Triggers the async domain auto-association job.

`POST /api/v1/company/{companyId}/domain`

## Request

- Base URL: `https://api.intheloop.io`
- URL: `https://api.intheloop.io/api/v1/company/{companyId}/domain`
- Auth: API key in header `Authorization`

## Path parameters

- `companyId` string, required

## Headers

- `Loop-Workspace-Id` string
- `Authorization` string
- `X-Impersonate-User` string

## Request body

- CompanyDomainRequest: Request body to add or remove a domain on a Company.
  - `domain` string: The email domain to add or remove, e.g. "unija.si".

## Response `200`

OK

- CompanyDomainUpdateResult: Result of a domain add/remove operation, including how many profiles were affected so the caller can report it (e.g. the FE's company_domain_added/company_domain_removed Mixpanel events).
  - `company` Company: A workspace-shared Company that groups profiles belonging to the same organization.
    - `id` string: Resource id
    - `name` string: Resource name or title
    - `revision` string: Resource revision
    - `clientId` string: Resource client id
    - `$type` string, required
    - `domains` string[]: 0-n email domains owned by this Company. A domain belongs to exactly one Company per workspace.
    - `logo` string: Manually uploaded logo link. No third-party favicon resolution in v1.
    - `description` string: Free-text description.
    - `externalId` string: External CRM/ERP id. Unique within the workspace if set.
    - `profileCount` integer: Number of workspace profiles linked to this Company that the caller can see. Only populated when requested with ?with=profileCount on a single-company get; read-only, ignored on create/update.
  - `affectedProfileCount` integer, required: Number of profiles auto-linked (on add) or auto-unlinked (on remove) as a result of this change.

## Other responses

- `400`: Bad request. Check fields message and error code from response body for additional information.
- `401`: Unauthorized request. Check fields message and error code from response body for additional information.
- `404`: Requested resource not found.
- `409`: Request failed due to conflict resource state.Check fields message and error code from response body for additional information.
- `422`: Unprocessable Content - points to logical or data validation problems.
- `429`: Too many requests. Check response header Retry-After indicating how long to wait before making a new request.

---

[API](https://skmtc.dev/intheloop/apis/loop-api.md) - [All operations](https://skmtc.dev/intheloop/apis/loop-api/llms.txt) - [OpenAPI document](https://skmtc.dev/intheloop/apis/loop-api/revisions/0892c5ba0787?raw)
