- [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#SCHEMA_REPRESENTATION)
- [ApiKeyConfig](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ApiKeyConfig)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ApiKeyConfig.SCHEMA_REPRESENTATION)
- [ApiKeyConfig.RequestLocation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ApiKeyConfig.RequestLocation)
- [OAuthConfig](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#OAuthConfig)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#OAuthConfig.SCHEMA_REPRESENTATION)
- [OAuthConfig.OauthGrantType](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#OAuthConfig.OauthGrantType)
- [ServiceAgentIdTokenAuthConfig](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ServiceAgentIdTokenAuthConfig)
- [ServiceAccountAuthConfig](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ServiceAccountAuthConfig)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ServiceAccountAuthConfig.SCHEMA_REPRESENTATION)
- [BearerTokenConfig](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#BearerTokenConfig)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#BearerTokenConfig.SCHEMA_REPRESENTATION)

Authentication information required for API calls.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "apiKeyConfig": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ApiKeyConfig`) }, "oauthConfig": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#OAuthConfig`) }, "serviceAgentIdTokenAuthConfig": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ServiceAgentIdTokenAuthConfig`) }, "serviceAccountAuthConfig": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ServiceAccountAuthConfig`) }, "bearerTokenConfig": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#BearerTokenConfig`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| The auth configuration. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `apiKeyConfig` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ApiKeyConfig`)`` Optional. Config for API key auth. |
| `oauthConfig` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#OAuthConfig`)`` Optional. Config for OAuth. |
| `serviceAgentIdTokenAuthConfig` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ServiceAgentIdTokenAuthConfig`)`` Optional. Config for ID token auth generated from CES service agent. |
| `serviceAccountAuthConfig` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ServiceAccountAuthConfig`)`` Optional. Config for service account authentication. |
| `bearerTokenConfig` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#BearerTokenConfig`)`` Optional. Config for bearer token auth. |
| End of mutually exclusive fields. ||

## ApiKeyConfig

Configurations for authentication with API key.

| JSON representation |
|---|
| ``` { "keyName": string, "apiKeySecretVersion": string, "requestLocation": enum (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ApiKeyConfig.RequestLocation`) } ``` |

| Fields ||
|---|---|
| `keyName` | `string` Required. The parameter name or the header name of the API key. E.g., If the API request is "https://example.com/act?X-Api-Key=", "X-Api-Key" would be the parameter name. |
| `apiKeySecretVersion` | `string` Required. The name of the SecretManager secret version resource storing the API key. Format: `projects/{project}/secrets/{secret}/versions/{version}` Note: You should grant `roles/secretmanager.secretAccessor` role to the CES service agent `service-<PROJECT-NUMBER>@gcp-sa-ces.iam.gserviceaccount.com`. |
| `requestLocation` | ``enum (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#ApiKeyConfig.RequestLocation`)`` Required. Key location in the request. |

## ApiKeyConfig.RequestLocation

The location of the API key in the request.

| Enums ||
|---|---|
| `REQUEST_LOCATION_UNSPECIFIED` | Unspecified. This value should not be used. |
| `HEADER` | Represents the key in http header. |
| `QUERY_STRING` | Represents the key in query string. |

## OAuthConfig

Configurations for authentication with OAuth.

| JSON representation |
|---|
| ``` { "oauthGrantType": enum (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#OAuthConfig.OauthGrantType`), "clientId": string, "clientSecretVersion": string, "tokenEndpoint": string, "scopes": [ string ] } ``` |

| Fields ||
|---|---|
| `oauthGrantType` | ``enum (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/ApiAuthentication#OAuthConfig.OauthGrantType`)`` Required. OAuth grant types. |
| `clientId` | `string` Required. The client ID from the OAuth provider. |
| `clientSecretVersion` | `string` Required. The name of the SecretManager secret version resource storing the client secret. Format: `projects/{project}/secrets/{secret}/versions/{version}` Note: You should grant `roles/secretmanager.secretAccessor` role to the CES service agent `service-<PROJECT-NUMBER>@gcp-sa-ces.iam.gserviceaccount.com`. |
| `tokenEndpoint` | `string` Required. The token endpoint in the OAuth provider to exchange for an access token. |
| `scopes[]` | `string` Optional. The OAuth scopes to grant. |

## OAuthConfig.OauthGrantType

OAuth grant types. Only [client credential grant](https://oauth.net/2/grant-types/client-credentials) is supported.

| Enums ||
|---|---|
| `OAUTH_GRANT_TYPE_UNSPECIFIED` | Unspecified. Defaults to CLIENT_CREDENTIAL. |
| `CLIENT_CREDENTIAL` | Represents the [client credential flow](https://oauth.net/2/grant-types/client-credentials). |

## ServiceAgentIdTokenAuthConfig

This type has no fields.
Configurations for authentication with [ID token](https://cloud.google.com/docs/authentication/token-types#id) generated from service agent.

## ServiceAccountAuthConfig

Configurations for authentication using a custom service account.

| JSON representation |
|---|
| ``` { "serviceAccount": string, "scopes": [ string ] } ``` |

| Fields ||
|---|---|
| `serviceAccount` | `string` Required. The email address of the service account used for authentication. CES uses this service account to exchange an access token and the access token is then sent in the `Authorization` header of the request. The service account must have the `roles/iam.serviceAccountTokenCreator` role granted to the CES service agent `service-<PROJECT-NUMBER>@gcp-sa-ces.iam.gserviceaccount.com`. |
| `scopes[]` | `string` Optional. The OAuth scopes to grant. If not specified, the default scope `https://www.googleapis.com/auth/cloud-platform` is used. |

## BearerTokenConfig

Configurations for authentication with a bearer token.

| JSON representation |
|---|
| ``` { "token": string } ``` |

| Fields ||
|---|---|
| `token` | `string` Required. The bearer token. Must be in the format `$context.variables.<name_of_variable>`. |