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

# Permission Entity APIs

<Badge icon="arrow-left" color="gray">[Back to API List](/ai-for-service/apis/searchai/api-list)</Badge>

## Get Permission Entities

This API lists all permission entities associated with a connector.

| Field             | Value                                                                         |
| ----------------- | ----------------------------------------------------------------------------- |
| **Method**        | GET                                                                           |
| **Endpoint**      | `<host_url>/api/public/bot/:botId/connector/:connectorId/permission-entities` |
| **Content-Type**  | `application/json`                                                            |
| **Authorization** | `auth: <JWT Token>`                                                           |
| **API Scope**     | Permission Entity Management                                                  |

### Query Parameters

| Parameter    | Description                                                             | Mandatory |
| ------------ | ----------------------------------------------------------------------- | --------- |
| Bot ID       | Provide your application ID here.                                       | Yes       |
| Connector ID | Unique ID of the connector for which permission entities are requested. | Yes       |
| `skip`       | Number of records to skip from the beginning of the response.           | No        |
| `limit`      | Maximum number of records to return in the response.                    | No        |

### Response Parameters

| Parameter    | Description                                                                                                                  |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Entity Id    | Unique identifier of the field used to create the permission entity.                                                         |
| `name`       | Name of the entity field as it appears in the source.                                                                        |
| `meta`       | Meta information about the entity.                                                                                           |
| `userIds`    | Array of users associated with the permission entity.                                                                        |
| `sourceType` | Source of the entity. Indicates the content source for which the permission entity was created (for example, `googleDrive`). |
| `type`       | Type of entity. Indicates the user permission type (for example, `userCriteria` for ServiceNow).                             |

### Sample Response

```json theme={null}
[
  {
    "_id": "fpe-82e99097-7532-506b-af42-363cbe5bb59c",
    "entityId": "john.doe@example.com",
    "meta": {},
    "name": "John",
    "userIds": [],
    "sourceType": "googleDrive",
    "type": "googleGroup"
  },
  {
    "_id": "fpe-5963cdfb-8401-5b90-8115-4c7624057733",
    "entityId": "2ftst48234234jf-ef",
    "meta": {},
    "name": "dev",
    "userIds": [],
    "sourceType": "serviceNow",
    "type": "usercriteria"
  }
]
```

***

## Get Permission Entity by ID

This API returns the details of a specific permission entity, including the users associated with it.

| Field             | Value                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------- |
| **Method**        | GET                                                                                     |
| **Endpoint**      | `<host_url>/api/public/bot/:botId/connector/:connectorId/permission-entities/:entityId` |
| **Content-Type**  | `application/json`                                                                      |
| **Authorization** | `auth: <JWT Token>`                                                                     |
| **API Scope**     | Permission Entity Management                                                            |

### Query Parameters

| Parameter    | Description                                                             | Mandatory |
| ------------ | ----------------------------------------------------------------------- | --------- |
| Bot ID       | Provide your application ID here.                                       | Yes       |
| Connector ID | Unique ID of the connector for which permission entities are requested. | Yes       |
| Entity Id    | Unique ID of the permission entity.                                     | Yes       |

### Sample Response

```json theme={null}
{
  "_id": "fpe-82e99097-7532-506b-af42-363cbe5bb59c",
  "entityId": "john.doe@example.com",
  "meta": {},
  "name": "John",
  "userIds": [],
  "sourceType": "googleDrive",
  "type": "googleGroup"
}
```

***

## Update Permission Entity by ID

This API associates users with a permission entity. Use it to add new users to an entity.

| Field             | Value                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------- |
| **Method**        | PUT                                                                                     |
| **Endpoint**      | `<host_url>/api/public/bot/:botId/connector/:connectorId/permission-entities/:entityId` |
| **Content-Type**  | `application/json`                                                                      |
| **Authorization** | `auth: <JWT Token>`                                                                     |
| **API Scope**     | Permission Entity Management                                                            |

### Query Parameters

| Parameter    | Description                                                                 | Mandatory |
| ------------ | --------------------------------------------------------------------------- | --------- |
| Stream ID    | Provide your application ID here.                                           | Yes       |
| Connector ID | Unique ID of the connector for which permission entities are to be updated. | Yes       |
| Entity Id    | Unique ID of the permission entity.                                         | Yes       |

### Sample Request Body

```json theme={null}
{
  "userList": ["john@example.com"]
}
```

***

## Delete Users from Permission Entity by ID

This API removes a user already associated with a permission entity.

| Field             | Value                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------- |
| **Method**        | DELETE                                                                                  |
| **Endpoint**      | `<host_url>/api/public/bot/:botId/connector/:connectorId/permission-entities/:entityId` |
| **Content-Type**  | `application/json`                                                                      |
| **Authorization** | `auth: <JWT Token>`                                                                     |
| **API Scope**     | Permission Entity Management                                                            |

### Query Parameters

| Parameter    | Description                                                                 | Mandatory |
| ------------ | --------------------------------------------------------------------------- | --------- |
| Stream ID    | Provide your application ID here.                                           | Yes       |
| Connector ID | Unique ID of the connector for which permission entities are to be updated. | Yes       |
| Entity Id    | Unique ID of the permission entity.                                         | Yes       |

### Sample Request Body

```json theme={null}
{
  "userList": ["john@example.com"]
}
```
