# Use Domains

{% hint style="info" %}
**Endpoint changes**

The `/domain` endpoint was previously the `/collections` endpoint. Currently, the `/collections` endpoint will continue to work; however, work with your Immuta representative to migrate any automated jobs over to the `/domain` endpoint.
{% endhint %}

The domains API allows users to create domains and organize data sources into them.

## Endpoints and methods

| Method     | Endpoint                                                                                                                                                                             | Description                                                                                             |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
| **POST**   | [<mark style="color:blue;">`/domain`</mark>](#post-domain)                                                                                                                           | Creates a new domain                                                                                    |
| **GET**    | [<mark style="color:blue;">`/domain`</mark>](#get-domain)                                                                                                                            | Retrieves all domains                                                                                   |
| **GET**    | [<mark style="color:blue;">`/domain/{domainId}`</mark>](#get-domain-domainid)                                                                                                        | Retrieves a specific domain                                                                             |
| **GET**    | [<mark style="color:blue;">`/domain/{domainId}/allPermissions`</mark>](#get-domain-domainid-allpermissions)                                                                          | Retrieves all permission IDs for a specific domain                                                      |
| **GET**    | [<mark style="color:blue;">`/domain/name/{domainName}`</mark>](#get-domain-name-domainname)                                                                                          | Retrieves a specific domain by name                                                                     |
| **PUT**    | [<mark style="color:blue;">`/domain/{domainId}`</mark>](#put-domain-domainid)                                                                                                        | Updates a domain name or description                                                                    |
| **POST**   | [<mark style="color:blue;">`/domain/{domainId}/assignment`</mark>](#post-domain-domainid-assignment)                                                                                 | Updates the domain data source assignment type                                                          |
| **PUT**    | [<mark style="color:blue;">`/domain/{domainId}/settings`</mark>](#put-domain-domainid-settings)                                                                                      | Updates the domain's settings                                                                           |
| **DELETE** | [<mark style="color:blue;">`/domain/{domainId}`</mark>](#delete-domain-domainid)                                                                                                     | Deletes a domain                                                                                        |
| **POST**   | [<mark style="color:blue;">`/domain/{domainId}/datasources`</mark>](#post-domain-domainid-datasources)                                                                               | Adds data sources to a domain                                                                           |
| **GET**    | [<mark style="color:blue;">`/domain/{domainId}/datasources`</mark>](#get-domain-domainid-datasources)                                                                                | Retrieves the data sources in the domain                                                                |
| **DELETE** | [<mark style="color:blue;">`/domain/{domainId}/datasources/{dataSourceId}`</mark>](#delete-domain-domainid-datasources-datasourceid)                                                 | Deletes a data source from a domain                                                                     |
| **POST**   | [<mark style="color:blue;">`/domain/{domainId}/permissions`</mark>](#post-domain-domainid-permissions)                                                                               | Assigns a domain permission to a user                                                                   |
| **POST**   | [<mark style="color:blue;">`/domain/{domainId}/permissions/bulk-delete`</mark>](#post-domain-domainid-permissions-bulk-delete)                                                       | Deletes multiple permissions from a domain                                                              |
| **GET**    | [<mark style="color:blue;">`/domain/{domainId}/permissions/{memberType}`</mark>](#get-domain-domainid-permissions-membertype)                                                        | Retrieves user permissions assigned in the domain                                                       |
| **DELETE** | [<mark style="color:blue;">`/domain/{domainId}/permissions/{permissionId}`</mark>](#delete-domain-domainid-permissions-permissionid)                                                 | Removes a domain permission from a user by the permission ID                                            |
| **DELETE** | [<mark style="color:blue;">`/domain/{domainId}/permissions/{memberType}/{memberId}/{permissionType}`</mark>](#delete-domain-domainid-permissions-membertype-memberid-permissiontype) | Removes a domain permission from a user by the user ID and permission type                              |
| **GET**    | [<mark style="color:blue;">`/domain/permissions/{memberType}/{memberId}`</mark>](#get-domain-permissions-membertype-memberid)                                                        | Retrieves a list of permissions for the specified user or group across all domains they are a member of |
| **POST**   | [<mark style="color:blue;">`/policy/global`</mark>](#post-policy-global)                                                                                                             | Creates a domain-scoped policy                                                                          |
| **PUT**    | [<mark style="color:blue;">`/policy/global/{policyId}`</mark>](#put-policy-global-policyid)                                                                                          | Updates the specified domain-scoped policy                                                              |

## <mark style="color:green;">`POST`</mark> `/domain`

Create a new domain. You can also [add data sources](#post-domain-domainid-datasources), [update user permissions](#post-domain-domainid-permissions), and [change the data source assignment](#post-domain-domainid-assignment) after creating the domain.

**Required Immuta permission**: `GOVERNANCE`

```bash
curl -X 'POST' \
    'https://your.immuta.url.com/domain' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 09a0ffd7512f4aeeb66c09f3111c436c' \
    -d '{
    "name": "Research",
    "description": "This domain is for research team data.",
    "type": "domain",
    "domainPermissions": [
    {
      "profileId":99,
      "permission":"Manage Policies"
    },{
      "groupId":4,
      "permission":"Manage Policies"
    }],
    "domainDataSources": [
    {
      "dataSourceId": 437
    },{
      "dataSourceId": 417
    }]
    }'
```

### Body parameters

| Parameter                                         | Description                                                              | Required or optional                                                               | Default values | Accepted values                                                                                                                                                      |
| ------------------------------------------------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **id** `string`                                   | The unique identifier of the domain.                                     | Optional                                                                           | -              | -                                                                                                                                                                    |
| **name** `string`                                 | The name of the domain.                                                  | Required                                                                           | -              | -                                                                                                                                                                    |
| **description** `string`                          | The description of the domain that will be displayed for users.          | Optional                                                                           | -              | -                                                                                                                                                                    |
| **type** `string`                                 | The type of domain.                                                      | Required                                                                           | -              | `domain`                                                                                                                                                             |
| **domainPermissions** `array`                     | The users or groups to grant domain-specific permissions to.             | Optional                                                                           | `[]`           | -                                                                                                                                                                    |
| domainPermissions.**profileId** `integer`         | The profile ID of a single user to grant domain-specific permissions to. | Optional                                                                           | -              | -                                                                                                                                                                    |
| domainPermissions.**groupId** `integer`           | The group ID of a group to grant domain-specific permissions to.         | Optional                                                                           | -              | -                                                                                                                                                                    |
| domainPermissions.**permission** `string`         | The domain-specific permission to grant to the user or group.            | Required if including `domainPermissions.profileId` or `domainPermissions.groupId` | -              | <ul><li><code>Manage Policies</code></li><li><code>Manage Data Products</code></li><li><code>Audit Activity</code></li><li><code>Manage Identifiers</code></li></ul> |
| **domainDataSources** `array`                     | The data sources to add to the domain.                                   | Optional                                                                           | `[]`           | -                                                                                                                                                                    |
| domainDataSource&#x73;**.dataSourceId** `integer` | The data source ID of the data source to add to the domain.              | Optional                                                                           | -              | -                                                                                                                                                                    |

### Response

Returns a [domains object](#domain-object-attributes).

```json
{
  "id": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
  "name": "Research",
  "description": "This domain is for research team data.",
  "type": "domain",
  "settings": {
    "autoscanning": false
    },
  "createdAt": "2023-05-10T14:55:29.289Z",
  "updatedAt": "2023-05-10T14:55:29.289Z",
  "createdBy": 2,
  "profile": {
    "name": "Example User"
  },
  "tags": [],
  "assignmentType": "manual"
}
```

## <mark style="color:green;">`GET`</mark> `/domain`

Retrieve domains created in Immuta. These results can be filtered by permission or by name.

```bash
curl -X 'GET' \
    'https://your.immuta.url.com/domain&offset=0&size=10' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 9b06b571ab2c45f7ba315a3d80b6b6ec'
```

### Query parameters

| Parameter                          | Description                                                                                                                                                                                                                                                           | Required or optional | Accepted values                                                                                                                                                      |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **offset** `integer`               | The number of items from the beginning of the response to exclude. You can combine the `offset` and `size` parameters to return a specific set of domains. For example, to return the second and third domain in the response, you would set `offset=1` and `size=2`. | Optional             | Minimum value is `0`. Maximum value is the total number of domains minus `size`.                                                                                     |
| **size** `integer`                 | The number of domains to return.                                                                                                                                                                                                                                      | Optional             | Minimum value is `1`. Maximum value is the total number of domains.                                                                                                  |
| **searchText** `string`            | The text to search for in domain names. This will return domains with a name that contains this search text.                                                                                                                                                          | Optional             | -                                                                                                                                                                    |
| **withPermissions** `string`       | Only returns domains that the querying user has been granted the permission in.                                                                                                                                                                                       | Optional             | <ul><li><code>Manage Policies</code></li><li><code>Manage Data Products</code></li><li><code>Audit Activity</code></li><li><code>Manage Identifiers</code></li></ul> |
| **isExactMatch** `boolean`         | If `true`, will only return domains with the exact name.                                                                                                                                                                                                              | Optional             | `true` or `false`                                                                                                                                                    |
| **isDomainPolicySearch** `boolean` | If `true`, will only return domains that the user can modify policies on.                                                                                                                                                                                             | Optional             | `true` or `false`                                                                                                                                                    |

### Response

Returns a data property that contains an array of up to `size` [domain objects](#domain-object-attributes). If no domains exist, the array will be empty.

```json
{
  "data": [{
    "id": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
    "name": "Marketing domain",
    "description": "This is a domain of marketing data.",
    "type": "domain",
    "createdAt": "2023-05-10T14:55:29.289Z",
    "updatedAt": "2023-05-10T14:55:29.289Z",
    "createdBy": 2,
    "profile": {
      "name": "Example User"
      },
    "tags": [
      {
        "name": "Marketing data",
        "displayName": "Marketing data",
        "id": 116
      }
    ],
    "assignmentType": "automatic",
    "settings": {
      "autoscanning": false
    }
  }]
}
```

## <mark style="color:green;">`GET`</mark> `/domain/{domainId}`

Retrieve a domain with the given `domainId` to view the data sources, description, and assigned permissions associated with the domain.

```bash
curl -X 'GET' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 9b06b571ab2c45f7ba315a3d80b6b6ec'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Response

Returns a [domains object](#domain-object-attributes).

```json
{
  "data": [{
    "id": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
    "name": "Marketing domain",
    "description": "This is a domain of marketing data.",
    "type": "domain",
    "createdAt": "2023-05-10T14:55:29.289Z",
    "updatedAt": "2023-05-10T14:55:29.289Z",
    "createdBy": 2,
    "profile": {
      "name": "Example User"
      },
    "tags": [
      {
        "name": "Marketing data",
        "displayName": "Marketing data",
        "id": 116
      }
    ],
    "assignmentType": "automatic",
    "settings": {
      "autoscanning": false
    }
  }]
}
```

## <mark style="color:green;">`GET`</mark> `/domain/{domainId}/allPermissions`

Retrieve all permissions assigned to the specified domain.

```bash
curl -X 'GET' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/allPermissions' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 9b06b571ab2c45f7ba315a3d80b6b6ec'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Query parameters

| Parameter            | Description                                                                                                                                                                                                                                                                    | Accepted values                                                                                                                                                      |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **type** `string`    | The type of permission to return.                                                                                                                                                                                                                                              | <ul><li><code>Manage Policies</code></li><li><code>Manage Data Products</code></li><li><code>Audit Activity</code></li><li><code>Manage Identifiers</code></li></ul> |
| **offset** `integer` | The number of items from the beginning of the response to exclude. You can combine the `offset` and `size` parameters to return a specific set of permissions. For example, to return the second and third permissions in the response, you would set `offset=1` and `size=2`. | Minimum value is `0`. Maximum value is the total number of permissions minus `size`.                                                                                 |
| **size** `integer`   | The number of permissions to return.                                                                                                                                                                                                                                           | Minimum value is `1`. Maximum value is the total number of permissions.                                                                                              |

### Response

Returns an array of [domain permission objects](#domains-permissions-object-attributes) that represent a permission in a domain assigned to a specific user.

```json
{
  "data": [
    {
      "id": "3bafcd54-a18d-406d-a514-cb8a38586b7d",
      "name": "Taylor",
      "profileId": 2,
      "domainId": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
      "groupId": null,
      "permission": "Manage Policies",
      "createdAt": "2024-05-17T17:25:46.581Z"
    }
  ],
  "total": 1
}
```

## <mark style="color:green;">`GET`</mark> `/domain/name/{domainName}`

Retrieve a domain with the given `domainName` to view the data sources, description, and assigned permissions associated with the domain.

```bash
curl -X 'GET' \
    'https://your.immuta.url.com/domain/name/Research' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 9b06b571ab2c45f7ba315a3d80b6b6ec'
```

### Path parameter

| Parameter               | Description             |
| ----------------------- | ----------------------- |
| **domainName** `string` | The name of the domain. |

### Response

Returns a [domains object](#domain-object-attributes).

```json
{
  "data": [{
    "id": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
    "name": "Marketing domain",
    "description": "This is a domain of marketing data.",
    "type": "domain",
    "createdAt": "2023-05-10T14:55:29.289Z",
    "updatedAt": "2023-05-10T14:55:29.289Z",
    "createdBy": 2,
    "profile": {
      "name": "Example User"
      },
    "tags": [
      {
        "name": "Marketing data",
        "displayName": "Marketing data",
        "id": 116
      }
    ],
    "assignmentType": "automatic",
    "settings": {
      "autoscanning": false
    }
  }]
}
```

## <mark style="color:green;">`PUT`</mark> `/domain/{domainId}`

Change the domain name or description.

**Required Immuta permission**: `GOVERNANCE`

```bash
curl -X 'PUT' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f' \
    -d '{
    "name": "HR Research",
    "description": "This domain is specifically for human resources data and research."
    }'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Body parameters

| Parameter                | Description                                                     | Required or optional | Default values | Accepted values |
| ------------------------ | --------------------------------------------------------------- | -------------------- | -------------- | --------------- |
| **name** `string`        | The name of the domain.                                         | Optional             | -              | -               |
| **description** `string` | The description of the domain that will be displayed for users. | Optional             | -              | -               |

### Response

Returns a [domains object](#domain-object-attributes) with the new name or description.

```json
{
  "data": [{
    "id": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
    "name": "HR Research",
    "description": "This domain is specifically for human resources data and research.",
    "type": "domain",
    "createdAt": "2023-05-10T14:55:29.289Z",
    "updatedAt": "2023-05-10T14:55:29.289Z",
    "createdBy": 2,
    "profile": {
      "name": "Example User"
      },
    "tags": [
      {
        "name": "Marketing data",
        "displayName": "Marketing data",
        "id": 116
      }
    ],
    "assignmentType": "automatic",
    "settings": {
      "autoscanning": false
    }
  }]
}
```

## <mark style="color:green;">`POST`</mark> `/domain/{domainId}/assignment`

Change the data source assignment of the domain.

**Required Immuta permission**: `GOVERNANCE`

```bash
curl -X 'POST' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/assignment' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f' \
    -d '{
    "assignmentType": "dynamic",
    "tags": [{"name": "Marketing data"}]
    }'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Body parameters

| Parameter                   | Description                                                                                                                                                                                                                    | Required or optional                             | Default values | Accepted values                                                    |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------ | -------------- | ------------------------------------------------------------------ |
| **assignmentType** `string` | The way data sources will be added to the domain. If `manual`, data sources must be added by a user. If `dynamic`, include at least one tag and all data sources with any of the selected tag(s) will always be in the domain. | Required                                         | -              | <ul><li><code>dynamic</code></li><li><code>manual</code></li></ul> |
| **tags** `array`            | An array with an object for each of the tags used to dynamically assign data sources to the domain.                                                                                                                            | Required if `assignmentType` is set to `dynamic` | -              | -                                                                  |
| tags.**name** `string`      | The name of the tag to use for dynamic assignment.                                                                                                                                                                             | Required if `assignmentType` is set to `dynamic` | -              | -                                                                  |

### Response

Returns the number of data sources added and removed based on the domain assignment update and the new assignment type.

```json
{
  "assignmentType": "dynamic",
  "dataSourcesAdded": 0,
  "dataSourcesKept": 0,
  "dataSourcesRemoved": 2
}
```

## <mark style="color:green;">`PUT`</mark> `/domain/{domainId}/settings`

{% hint style="info" %}
**Private preview**: This feature is available to select accounts. Contact your Immuta representative for details.
{% endhint %}

Change the domain's autoscanning setting.

**Required Immuta permission**: `GOVERNANCE`

```bash
curl -X 'PUT' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/settings' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f' \
    -d '{
    "autoscanning": true
    }'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Body parameter

| Parameter                  | Description                                                                                                          | Required or optional | Default values | Accepted values   |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------- | -------------- | ----------------- |
| **autoscanning** `boolean` | If true, autoscanning is enabled and will run identification automatically for all data sources added to the domain. | Optional             | `false`        | `true` or `false` |

### Response

Returns the new autoscanning setting.

```json
{"autoscanning": true}
```

## <mark style="color:green;">`DELETE`</mark> `/domain/{domainId}`

Delete a domain. The domain must have zero data sources, policies, data products, and identifiers to be deleted.

**Required Immuta permission**: `GOVERNANCE`

```bash
curl -X 'DELETE' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Query parameter

| Parameter            | Description                                |
| -------------------- | ------------------------------------------ |
| **dryRun** `boolean` | If `true`, the domain will not be deleted. |

### Response

Returns a **204** code when the domain is successfully deleted. Additional responses are provided below:

* **400**: An invalid ID was provided.
* **404**: The domain was not found.

## <mark style="color:green;">`POST`</mark> `/domain/{domainId}/datasources`

Add existing data sources to a domain. Data sources can only be added to domains with `manual` data source assignment.

The request will fail if any data source IDs that have already been assigned to a domain are included in the payload or if data source assignment is set to `dynamic`.

**Required Immuta permission**: `GOVERNANCE`

```bash
curl -X 'POST' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/datasources' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f' \
    -d '[
    {
      "dataSourceId": 36
    }
    ]'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Body parameter

| Parameter                  | Description                                         | Required or optional | Default values | Accepted values |
| -------------------------- | --------------------------------------------------- | -------------------- | -------------- | --------------- |
| **dataSourceId** `integer` | The unique identifier of the data source in Immuta. | Required             | -              | -               |

### Response

Returns a unique identifier of the background job that adds the data sources to the domain.

```json
{
  "jobId": "e48e15a0-ef5c-11ed-892c-a75afcd86969"
}
```

## <mark style="color:green;">`GET`</mark> `/domain/{domainId}/datasources`

Retrieve the data sources within a domain.

```bash
curl -X 'GET' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/datasources?offset=0&size=10' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f'
```

### **Path parameter**

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Query parameters

| Parameter                   | Description                                                                                                                                                                                                                                                                     | Accepted values                                                                       |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| **offset** `integer`        | The number of items from the beginning of the response to exclude. You can combine the `offset` and `size` parameters to return a specific set of data sources. For example, to return the second and third data source in the response, you would set `offset=1` and `size=2`. | Minimum value is `0`. Maximum value is the total number of data sources minus `size`. |
| **size** `integer`          | The number of data sources to return.                                                                                                                                                                                                                                           | Minimum value is `1`. Maximum value is the total number of data sources.              |
| **searchText** `string`     | The text to search for in data source names. This will return data sources with a name that contains this search text.                                                                                                                                                          | -                                                                                     |
| **dataSourceIds** `integer` | Filters search results by data source ID.                                                                                                                                                                                                                                       | -                                                                                     |

### Response

Returns a data property that contains an array of up to `size` data sources. Each entry in the array is a separate data source. If there are no data sources in the domain, the array will be empty.

```json
{
  "data": [{
    "dataSourceId": 36,
    "createdAt": "2023-05-10T18:02:57.068Z",
    "name": "HR Data",
    "type": "queryable",
    "platform": "PostgreSQL",
    "connectionString": "immuta@your.database.host.com:5432/public",
    "schema": "public",
    "table": "research_data",
    "tags": []
    }],
  "total": 1
}
```

## <mark style="color:green;">`DELETE`</mark> `/domain/{domainId}/datasources/{dataSourceId}`

Remove data sources from a domain. Data sources can only be removed from domains with `manual` data source assignment.

The request will fail if the data source assignment is set to `dynamic`.

**Required Immuta permission**: `CREATE_DATA_SOURCE`

```bash
curl -X 'DELETE' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/datasources/36' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f'
```

### Path parameters

| Parameter                  | Description                                                               |
| -------------------------- | ------------------------------------------------------------------------- |
| **domainId** `string`      | The unique identifier of the domain from which to remove the data source. |
| **dataSourceId** `integer` | The unique identifier of the data source to remove.                       |

### Response

Returns a **204** code when the data source is successfully removed from the domain. Additional responses are included below:

* **403**: Requesting user does not have permission to remove the data source.
* **404**: The specified domain or data source was not found.

## <mark style="color:green;">`POST`</mark> `/domain/{domainId}/permissions`

Assign domain permissions to a specific user.

**Required Immuta permission**: `USER_ADMIN`

```bash
curl -X 'POST' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/permissions' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f' \
    -d '[
    {
      "profileId": 2,
      "permission": "Manage Policies"
    },
    {
      "profileId": 3,
      "permission": "Manage Policies"
    }
    ]'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Body parameters

| Parameter               | Description                                                | Required or optional | Default values | Accepted values                                                                                                                                                      |
| ----------------------- | ---------------------------------------------------------- | -------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **groupId** `integer`   | The unique identifier of the group.                        | Optional             | `[]`           | -                                                                                                                                                                    |
| **profileId** `integer` | The unique identifier of the user in the identity manager. | Optional             | `[]`           | -                                                                                                                                                                    |
| **permission** `string` | The domain permission to assign to the user or group.      | Required             | -              | <ul><li><code>Manage Policies</code></li><li><code>Manage Data Products</code></li><li><code>Audit Activity</code></li><li><code>Manage Identifiers</code></li></ul> |

### Response

Returns an array of [domain permission objects](#domains-permissions-object-attributes) that represent a permission in a domain assigned to a specific user. If the permission had already been assigned to the user for that domain, the response will include an error for the permissions that were not assigned to that user because the permission already existed.

```json
{
  "success": [
    {
      "id": "c2ec9049-ac93-4700-9e21-f0ec3a0de6bb",
      "profileId": 3,
      "domainId": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
      "permission": "Manage Policies",
      "createdAt": "2023-05-10T18:37:05.847Z"
    }
  ],
  "errors": [
    {
      "profileId": 2,
      "domainId": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
      "permission": "Manage Policies",
      "message": "Permission already exists"
    }
  ]
}
```

## <mark style="color:green;">`POST`</mark> `/domain/{domainId}/permissions/bulk-delete`

Remove permissions from multiple users or groups in a domain.

**Required Immuta permission**: `USER_ADMIN`

```bash
curl -X 'POST' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/permissions/bulk-delete' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f' \
    -d '[
    {
      "domainPermissions": [
        {
          "profileId": 2,
          "permission": "Manage Policies"
        },
        {
          "profileId": 3,
          "permission": "Manage Policies"
        }
      ]
    }
    ]'
```

### Path parameter

| Parameter             | Description                          |
| --------------------- | ------------------------------------ |
| **domainId** `string` | The unique identifier of the domain. |

### Body parameters

| Parameter                                 | Description                                                       | Required or Optional                      | Default values | Accepted values                                                                                                                                                      |
| ----------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| domainPermissions.**groupId** `integer`   | The unique identifier of the group the permission is assigned to. | Required if **profileId** is not provided | -              | -                                                                                                                                                                    |
| domainPermissions.**profileId** `integer` | The unique identifier of the user the permission is assigned to.  | Required if **groupId** is not provided   | -              | -                                                                                                                                                                    |
| domainPermissions.**permission** `string` | The domain permission assigned to the user or group.              | Required                                  | -              | <ul><li><code>Manage Policies</code></li><li><code>Manage Data Products</code></li><li><code>Audit Activity</code></li><li><code>Manage Identifiers</code></li></ul> |

### Response

Returns an array of [domain permission objects](#domains-permissions-object-attributes) that represent a permission in\
a domain deleted from that specific user or group. Response includes permissions that failed to delete.

```json
{
  "success": [
    "d6378973-e15d-4310-8f1e-671c6b08e6a2",
    "83e6cb4a-4f41-47b4-b455-16fe518d5068"
  ],
  "errors": []
}
```

## <mark style="color:green;">`GET`</mark> `/domain/{domainId}/permissions/{memberType}`

Retrieve a list of permissions associated with the domain.

```bash
curl -X 'GET' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/permissions/user?offset=0&size=10' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f'
```

### Path parameters

| Parameter               | Description                                                                                     |
| ----------------------- | ----------------------------------------------------------------------------------------------- |
| **domainId** `string`   | The unique identifier of the domain.                                                            |
| **memberType** `string` | The type of member to get a list of permissions for. Possible values include `user` or `group`. |

### Query parameters

| Parameter               | Description                                                                                                                                                                                                                                                                      | Accepted values                                                                                                                                                      |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **type** `string`       | The permission to return.                                                                                                                                                                                                                                                        | <ul><li><code>Manage Policies</code></li><li><code>Manage Data Products</code></li><li><code>Audit Activity</code></li><li><code>Manage Identifiers</code></li></ul> |
| **offset** `integer`    | The number of items from the beginning of the response to exclude. You can combine the `offset` and `size` parameters to return a specific set of domain users. For example, to return the second and third domain users in the response, you would set `offset=1` and `size=2`. | Minimum value is `0`. Maximum value is the total number of domain users minus `size`.                                                                                |
| **size** `integer`      | The number of users to return.                                                                                                                                                                                                                                                   | Minimum value is `1`. Maximum value is the total number of domain users.                                                                                             |
| **searchText** `string` | A string used to filter the results returned by the `name`.                                                                                                                                                                                                                      | -                                                                                                                                                                    |
| **sortField** `string`  | Specifies the field to sort the results by.                                                                                                                                                                                                                                      | <ul><li><code>domainId</code></li><li><code>name</code></li><li><code>profileId</code></li></ul>                                                                     |
| **sortOrder** `string`  | Specifies how to sort the results of the request.                                                                                                                                                                                                                                | <ul><li><code>asc</code></li><li><code>desc</code></li></ul>                                                                                                         |

### Response

Returns a data property that contains an array of users or groups who have been assigned that permission in the domain.

```json
{
  "data": [{
    "id": "1bf5fa36-8130-4f72-8f4f-d1f18c25c2a2",
    "name": "Example User",
    "profileId": 2,
    "domainId": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
    "permission": "Manage Policies",
    "source": [
      "User Permission(s)"
    ]
    },
    {
    "id": "6172d495-c560-4ae1-bceb-cc6ce15e55ec",
    "name": "Example User 2",
    "profileId": 3,
    "domainId": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
    "permission": "Manage Policies",
    "source": [
      "User Permission(s)"
    ]
    }],
  "total": 2
}
```

## <mark style="color:green;">`GET`</mark> `/domain/permissions/{memberType}/{memberId}`

Retrieve a list of permissions for the specified user or group across all domains they are a member of.

```bash
curl -X 'GET' \
    'https://your.immuta.url.com/domain/permissions/user/2?offset=0&size=10' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f'
```

### Path parameters

| Parameter               | Description                                                                                     |
| ----------------------- | ----------------------------------------------------------------------------------------------- |
| **memberType** `string` | The type of member to get a list of permissions for. Possible values include `user` or `group`. |
| **memberId** `string`   | The unique identifier of the user or group.                                                     |

### Query parameters

| Parameter               | Description                                                                                                                                                                                                                                                                          | Accepted values                                                                                                                                                      |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **type** `string`       | The permission to return.                                                                                                                                                                                                                                                            | <ul><li><code>Manage Policies</code></li><li><code>Manage Data Products</code></li><li><code>Audit Activity</code></li><li><code>Manage Identifiers</code></li></ul> |
| **offset** `integer`    | The number of items from the beginning of the response to exclude. You can combine the `offset` and `size` parameters to return a specific set of domain permissions. For example, to return the second and third permission in the response, you would set `offset=1` and `size=2`. | Minimum value is `0`. Maximum value is the total number of domain permissions that user or group has minus `size`.                                                   |
| **size** `integer`      | The number of permissions to return.                                                                                                                                                                                                                                                 | Minimum value is `1`. Maximum value is the total number of domain permissions that user or group has.                                                                |
| **searchText** `string` | A string used to filter the results returned by the `name`.                                                                                                                                                                                                                          | -                                                                                                                                                                    |
| **sortField** `string`  | Specifies the field to sort the results by.                                                                                                                                                                                                                                          | <ul><li><code>domainId</code></li><li><code>name</code></li><li><code>profileId</code></li></ul>                                                                     |
| **sortOrder** `string`  | Specifies how to sort the results of the request.                                                                                                                                                                                                                                    | <ul><li><code>asc</code></li><li><code>desc</code></li></ul>                                                                                                         |

### Response

Returns a data property that contains an array of permissions that have been assigned to the user or group in all the domains they are a member of.

```json
{
  "data": [{
    "profileId": 2,
    "name": "Taylor",
    "domainId": "c7458ee9-03e5-4b6f-8395-ad4e49235428",
    "domainName": "Marketing domain",
    "permission": "Manage Policies",
    "source": [
      "User Permission(s)"
    ],
    "userObjectId": 2,
    "iamId": "bim"
    },
    {
    "profileId": 2,
    "name": "Taylor",
    "domainId": "a5678ef9-53e5-4b6f-8395-aa4e49237689",
    "domainName": "Customer support domain",
    "permission": "Manage Policies",
    "source": [
      "User Permission(s)"
    ],
    "userObjectId": 2,
    "iamId": "bim"
    }
    ]
}
```

## <mark style="color:green;">`DELETE`</mark> `/domain/{domainId}/permissions/{permissionId}`

Remove a domain permission from a specific user or group.

**Required Immuta permission**: `USER_ADMIN`

```bash
curl -X 'DELETE' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/permissions/c2ec9049-ac93-4700-9e21-f0ec3a0de6bb' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f'
```

### Path parameters

<table><thead><tr><th width="360">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>domainId</strong> <code>string</code></td><td>The unique identifier of the domain.</td></tr><tr><td><strong>permissionId</strong> <code>string</code></td><td>The unique identifier of the assigned permission.</td></tr></tbody></table>

### Response

Returns a **204** code when the permission is successfully removed from the user. Additional responses are provided below:

* **400**: Invalid permission
* **404**: Domain or permission not found

## <mark style="color:green;">`DELETE`</mark> `/domain/{domainId}/permissions/{memberType}/{memberId}/{permissionType}`

Remove a domain permission based on the permission type.

**Required Immuta permission**: `USER_ADMIN`

```bash
curl -X 'DELETE' \
    'https://your.immuta.url.com/domain/c7458ee9-03e5-4b6f-8395-ad4e49235428/permissions/user/2/Manage%20Policies' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f'
```

### Path parameters

| Parameter                   | Description                                       | Accepted values                                                                                                                                                      |
| --------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **domainId** `string`       | The unique identifier of the domain.              | -                                                                                                                                                                    |
| **memberType** `string`     | The type of member to remove the permission from. | <ul><li><code>user</code></li><li><code>group</code></li></ul>                                                                                                       |
| **memberId** `integer`      | The unique identifier of the user or group.       | -                                                                                                                                                                    |
| **permissionType** `string` | The type of permission to delete.                 | <ul><li><code>Manage Policies</code></li><li><code>Manage Data Products</code></li><li><code>Audit Activity</code></li><li><code>Manage Identifiers</code></li></ul> |

### Response

Returns a **204** code when the permission is successfully removed. Additional responses are provided below:

* **400**: Invalid permission
* **404**: Domain or permission not found

## <mark style="color:green;">`POST`</mark> `/policy/global`

Create a domain-scoped policy.

**Required Immuta permission**: `GOVERNANCE` or `Manage Policies` domain permission

```bash
curl -X 'POST' \
    'https://your.immuta.url.com/policy/global' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f' \
    -d '[
    {
      "type": "subscription",
      "name": "Domain-scoped subscription policy",
      "template": false,
      "certification": null,
      "actions": [{
        "type": "subscription",
        "subscriptionType": "approval",
        "description": null,
        "shareResponsibility": true,
        "allowDiscovery": false,
        "accessGrant": "READ",
        "approvals": [{
          "specificApproverRequired": false,
          "requiredPermission": "OWNER"
        }],
        "automaticSubscription": false
      }],
      "staged": false,
      "circumstances": [{
        "type": "domains",
        "operator": "and",
        "domains": [{
          "id": "cdf90g39-b5df-4f3e-95b2-08ea7f47539a",
          "name": "Domain 1"
        }]
      }]
    }
    ]'
```

### Body parameters

The body parameters for authoring a domain policy are the same as the parameters listed for authoring a policy on the [Manage data and subscription policies page](/saas/developer-guides/api-intro/immuta-v1-api/manage-data-access/policy.md#create-a-global-policy-with-a-specified-entity-type).

To scope a policy to a domain, **circumstances.type** must be `domains` and the payload must include **circumstances.domains.id** and **circumstances.domains.name**.

### Response

When successful, the response returns the policy that was created.

```json
{
  "policyKey": "Domain-scoped subscription policy",
  "name": "Domain-scoped subscription policy",
  "type": "subscription",
  "template": false,
  "staged": false,
  "systemGenerated": false,
  "deleted": false,
  "certification": null,
  "actions": [{
    "type": "subscription",
    "approvals": [{
      "requiredPermission": "OWNER",
      "specificApproverRequired": false
    }],
    "accessGrant": "READ",
    "description": null,
    "allowDiscovery": false,
    "subscriptionType": "approval",
    "shareResponsibility": true,
    "automaticSubscription": false
  }],
  "circumstances": [{
    "type": "domains",
    "domains": [{
      "id": "cdf90g39-b5df-4f3e-95b2-08ea7f47539a",
      "name": "Domain 1"
    }],
    "operator": "and"
  }],
  "metadata": null,
  "clonedFrom": null,
  "createdBy": 2,
  "protected": false,
  "id": 90,
  "createdAt": "2025-09-19T15:01:00.290Z",
  "updatedAt": "2025-09-19T15:01:00.290Z",
  "createdByName": "Katie",
  "ownerRestrictions": null
}
```

## <mark style="color:green;">`PUT`</mark> `/policy/global/{policyId}`

Update a domain-scoped policy.

**Required Immuta permission**: `GOVERNANCE` or `Manage Policies` domain permission

```bash
curl -X 'PUT' \
    'https://your.immuta.url.com/policy/global/90' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer 71bd4a7088554159a7ad1ade9242568f' \
    -d '[
    {
      "policyKey": "Domain-scoped subscription policy",
      "createdBy": 2,
      "createdByName": "Katie",
      "createdAt": "2025-09-19T15:01:00.290Z",
      "metadata": null,
      "clonedFrom": null,
      "systemGenerated": false,
      "deleted": false,
      "id": 90,
      "type": "subscription",
      "name": "Domain-scoped subscription policy",
      "template": false,
      "certification": null,
      "actions": [{
        "type": "subscription",
        "subscriptionType": "policy",
        "description": null,
        "shareResponsibility": true,
        "allowDiscovery": false,
        "accessGrant": "READ",
        "exceptions": {
          "operator": "and",
          "conditions": [{
            "type": "groups",
            "group": {
              "name": "Marketing"
            }
          }]
        },
        "automaticSubscription": true
      }],
      "staged": false,
      "circumstances": [{
        "type": "domains",
        "operator": "and",
        "domains": [{
          "id": "cdf90g39-b5df-4f3e-95b2-08ea7f47539a",
          "name": "Domain 1"
        }]
      }]
    }
    ]'
```

### Body parameters

The body parameters for updating a domain policy are the same as the parameters listed for updating a global policy on the [Manage data and subscription policies page](/saas/developer-guides/api-intro/immuta-v1-api/manage-data-access/policy.md#update-a-global-policy).

To scope a policy to a domain, **circumstances.type** must be `domains` and the payload must include **circumstances.domains.id** and **circumstances.domains.name**.

### Response

When successful, the response returns the policy that was updated.

```json
{
  "policyKey": "Domain-scoped subscription policy",
  "name": "Domain-scoped subscription policy",
  "type": "subscription",
  "template": false,
  "staged": false,
  "systemGenerated": false,
  "deleted": false,
  "certification": null,
  "actions": [{
    "type": "subscription",
    "exceptions": {
      "operator": "and",
      "conditions": [{
        "type": "groups",
        "group": {
          "name": "Marketing"
        }
      }]
    },
    "accessGrant": "READ",
    "description": null,
    "allowDiscovery": false,
    "subscriptionType": "policy",
    "shareResponsibility": true,
    "automaticSubscription": true
  }],
  "circumstances": [{
    "type": "domains",
    "domains": [{
      "id": "cdf90g39-b5df-4f3e-95b2-08ea7f47539a",
      "name": "Domain 1"
    }],
    "operator": "and"
  }],
  "metadata": null,
  "clonedFrom": null,
  "createdBy": 2,
  "protected": false,
  "id": 90,
  "createdAt": "2025-09-19T15:01:00.290Z",
  "updatedAt": "2025-09-19T15:52:11.332Z",
  "createdByName": "Katie",
  "ownerRestrictions": null
}
```

## Domain object attributes

| Attribute                           | Description                                                                                         |
| ----------------------------------- | --------------------------------------------------------------------------------------------------- |
| **id** `string`                     | The unique identifier of the domain.                                                                |
| **name** `string`                   | The name of the domain.                                                                             |
| **description** `string`            | The description of the domain that will be displayed for users.                                     |
| **settings** `object`               | The domain settings.                                                                                |
| settings.**autoscanning** `boolean` | If true, identification autoscanning is on.                                                         |
| **tags** `array`                    | An array with an object for each of the tags used to dynamically assign data sources to the domain. |
| tags.**name** `string`              | The name of the tag used to dynamically assign data sources to the domain.                          |
| tags.**displayName** `string`       | The display name of the tag used to dynamically assign data sources to the domain.                  |
| tags.**id** `integer`               | The ID of the tag used to dynamically assign data sources to the domain.                            |
| **assignmentType** `string`         | The way data sources are assigned to the domain. Options are `dynamic` or `manual`.                 |
| **createdBy** `integer`             | The unique identifier of the user who created the domain.                                           |
| profile.**name** `string`           | The name of the user who created the domain.                                                        |
| **createdAt** `timestamp`           | The date and time the domain was created.                                                           |
| **updatedAt** `timestamp`           | The date and time the domain was updated.                                                           |

## Domains permissions object attributes

| Attribute                 | Description                                                                               |
| ------------------------- | ----------------------------------------------------------------------------------------- |
| **id** `string`           | The unique identifier of the permissions object.                                          |
| **profileId** `integer`   | The unique identifier of the user the permission is assigned to.                          |
| **groupId** `integer`     | The unique identifier of the group the permission is assigned to.                         |
| **domainId** `string`     | The unique identifier of the domain.                                                      |
| **permission** `string`   | The permission assigned to the user.                                                      |
| **createdAt** `timestamp` | The date and time the permission object was created.                                      |
| **source** `string`       | Indicates whether the permission was assigned as a user permission or a group permission. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.immuta.com/saas/developer-guides/api-intro/immuta-v1-api/domains-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
