- [HTTP request](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#body.request_body)
- [Response body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#body.CompleteExternalIdentitiesResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#body.aspect_1)
- [EntityTypeFilter](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#EntityTypeFilter)
- [ExternalIdentity](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#ExternalIdentity)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#ExternalIdentity.SCHEMA_REPRESENTATION)
- [UserMetadata](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#UserMetadata)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#UserMetadata.SCHEMA_REPRESENTATION)
- [GroupMetadata](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#GroupMetadata)

This method provides suggestions for users and groups managed in an external identity provider, based on the provided prefix.

### HTTP request

Choose an endpoint:
global us   
`GET https://discoveryengine.googleapis.com/v1alpha/{parent=projects/*/locations/*}:completeExternalIdentities`

<br />

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent location resource name, such as `projects/*/locations/global`. |

### Query parameters

| Parameters ||
|---|---|
| `prefixQuery` | `string` Required. The prefix to search for. For users, this prefix is matched against the `primaryEmail`. For groups, this prefix is matched against the `displayName`. The matching is case-insensitive. |
| `maxSuggestions` | `integer` Optional. The maximum number of user and group results to return. The service may return fewer than this value. If unspecified, at most 6 results will be returned. The limit is distributed as evenly as possible across users and groups. For example, if maxSuggestions is 7, the service may return 4 users and 3 groups. If there are fewer suggestions of one type than half the limit, the other type may return more suggestions up to the maxSuggestions limit. |
| `entityTypeFilter` | ``enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#EntityTypeFilter`)`` Optional. The type of entities to fetch. If not set, all entity types will be returned. |
| `useScimIdentities` | `boolean` Optional. Whether to use scim identities for external identity completion. If false, we will call the Microsoft graph API to fetch the external identities. |

### Request body

The request body must be empty.

### Response body

Response message for `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#google.cloud.discoveryengine.v1alpha.CompletionService.CompleteExternalIdentities`.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "externalIdentities": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#ExternalIdentity`) } ] } ``` |

| Fields ||
|---|---|
| `externalIdentities[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#ExternalIdentity`)`` The list of external identities that match the query. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/discoveryengine.assist.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.serving.readwrite`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `discoveryengine.locations.completeExternalIdentities`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## EntityTypeFilter

The type of entities to fetch.

| Enums ||
|---|---|
| `ENTITY_TYPE_FILTER_UNSPECIFIED` | Unspecified entity type filter. |
| `USERS` | Fetch only users. |
| `GROUPS` | Fetch only groups. |

## ExternalIdentity

External identity representing either a user or group. This user or group is from an external identity provider (IdP).

| JSON representation |
|---|
| ``` { "externalId": string, "displayName": string, "subject": string, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "userMetadata": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#UserMetadata`) }, "groupMetadata": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#GroupMetadata`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `externalId` | `string` The unique 3P id(externalId) of the entity (user or group). |
| `displayName` | `string` The display name of the user or group. |
| `subject` | `string` Output only. Represents the canonical IAM subject identifier (for users) or group identifier (for groups), derived from the workforce-pool claim mapping. Falls back to custom logic if not set. This must be used for IAM bindings. |
| The type of the external identity. This is used to indicate the type of entity (user or group) and the corresponding metadata. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `userMetadata` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#UserMetadata`)`` metadata corresponding to the external user. |
| `groupMetadata` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations/completeExternalIdentities#GroupMetadata`)`` metadata corresponding to the external user. |
| End of mutually exclusive fields. ||

## UserMetadata

metadata corresponding to the external user.

| JSON representation |
|---|
| ``` { "givenName": string, "familyName": string, "primaryEmail": string } ``` |

| Fields ||
|---|---|
| `givenName` | `string` The user's given name. |
| `familyName` | `string` The user's family name. |
| `primaryEmail` | `string` The user's primary email address. Do not use this for IAM bindings. Use ExternalIdentity.subject. |

## GroupMetadata

This type has no fields.
metadata corresponding to the external group.