The Credentials API allows you to create, retrieve, update, list, and delete server-managed credentials (such as API keys, OAuth2 tokens, HTTP Bearer tokens, and environment variables) to authenticate tool calls and MCP servers.
CreateCredential
Creates a credential.
Request body
The request body structure depends on the interaction mode you choose:
EnvironmentVariableConfig
Configuration for environment variable credentials.
No description provided.
injection_location InjectionLocation or array (InjectionLocation) (required)
Required. Locations where the environment variable can be injected in outgoing HTTP requests. Must contain at least one location. Accepts either a single location (e.g. "header") or an array of locations.
Possible values
-
headerInjected into HTTP request headers.
-
queryInjected into HTTP URL query parameters.
-
bodyInjected into HTTP request body.
Optional. List of domains allowed to receive this environment variable value in HTTP requests.
No description provided.
Required. Input only. Secret value of the environment variable. Write-only; never returned in responses.
HttpBearerConfig
Configuration for HTTP Bearer token credentials.
Optional. Header name to inject the token into. Defaults to 'Authorization'.
No description provided.
Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' for no prefix.
Required. Input only. The static bearer token. Write-only; never returned in responses.
No description provided.
OAuth2Config
Configuration for OAuth2 credentials with automatic token refresh.
Required. OAuth2 client ID.
Required. Input only. OAuth2 client secret. Write-only; never returned in responses.
No description provided.
Required. Input only. OAuth2 refresh token. Write-only; never returned in responses.
Optional. List of OAuth2 scopes.
Required. OAuth2 token endpoint URL for refreshing access tokens.
No description provided.
Response
If successful, the response body contains data with the following structure:
Output only. The timestamp when the credential was created.
Required. Output only. Identifier. Unique identifier for the credential.
Output only. Current status of the credential.
Possible values:
-
activeThe credential is active and valid for use.
-
revokedThe credential has been revoked and is no longer valid.
Required. Output only. The type of credential.
Possible values:
-
bearer_tokenStatic token injected as header. No refresh logic.
-
oauth2Auto-refresh expired access tokens using stored refresh token.
-
environment_variableEnvironment variable injected into sandbox container.
Output only. The timestamp when the credential was last updated.
Example
Example Response
{ "create_time": "string", "id": "string", "status": "active", "type": "bearer_token", "update_time": "string" }
ListCredentials
Lists credentials for a project.
Path / Query Parameters
Optional. Maximum number of credentials to return. If unspecified, defaults to 50. Maximum is 1000.
Optional. Pagination token.
Response
If successful, the response body contains data with the following structure:
No description provided.
No description provided.
Example
Example Response
{ "credentials": [ { "create_time": "string", "id": "string", "status": "active", "type": "bearer_token", "update_time": "string" } ], "next_page_token": "string" }
GetCredential
Gets metadata of a single credential (no secret fields).
Response
If successful, the response body contains data with the following structure:
Output only. The timestamp when the credential was created.
Required. Output only. Identifier. Unique identifier for the credential.
Output only. Current status of the credential.
Possible values:
-
activeThe credential is active and valid for use.
-
revokedThe credential has been revoked and is no longer valid.
Required. Output only. The type of credential.
Possible values:
-
bearer_tokenStatic token injected as header. No refresh logic.
-
oauth2Auto-refresh expired access tokens using stored refresh token.
-
environment_variableEnvironment variable injected into sandbox container.
Output only. The timestamp when the credential was last updated.
Example
Example Response
{ "create_time": "string", "id": "string", "status": "active", "type": "bearer_token", "update_time": "string" }
UpdateCredential
Updates a credential.
Path / Query Parameters
Optional. The list of fields to update.
Request body
The request body structure depends on the interaction mode you choose:
EnvironmentVariableUpdateConfig
Configuration for updating environment variable credentials.
injection_location InjectionLocation or array (InjectionLocation) (optional)
Optional. Locations where the environment variable can be injected in outgoing HTTP requests. Accepts either a single location (e.g. "header") or an array of locations.
Possible values
-
headerInjected into HTTP request headers.
-
queryInjected into HTTP URL query parameters.
-
bodyInjected into HTTP request body.
Optional. List of domains allowed to receive this environment variable value in HTTP requests.
No description provided.
Optional. Input only. Secret value of the environment variable. Write-only; never returned in responses.
HttpBearerUpdateConfig
Configuration for updating HTTP Bearer token credentials.
Optional. Header name to inject the token into. Defaults to 'Authorization'.
Optional. Prefix to prepend to the token. Defaults to 'Bearer'. Set to '' for no prefix.
Optional. Input only. The static bearer token. Write-only; never returned in responses.
No description provided.
OAuth2UpdateConfig
Configuration for updating OAuth2 credentials.
Optional. OAuth2 client ID.
Optional. Input only. OAuth2 client secret. Write-only; never returned in responses.
Optional. Input only. OAuth2 refresh token. Write-only; never returned in responses.
Optional. List of OAuth2 scopes.
Optional. OAuth2 token endpoint URL for refreshing access tokens.
No description provided.
Response
If successful, the response body contains data with the following structure:
Output only. The timestamp when the credential was created.
Required. Output only. Identifier. Unique identifier for the credential.
Output only. Current status of the credential.
Possible values:
-
activeThe credential is active and valid for use.
-
revokedThe credential has been revoked and is no longer valid.
Required. Output only. The type of credential.
Possible values:
-
bearer_tokenStatic token injected as header. No refresh logic.
-
oauth2Auto-refresh expired access tokens using stored refresh token.
-
environment_variableEnvironment variable injected into sandbox container.
Output only. The timestamp when the credential was last updated.
Example
Example Response
{ "create_time": "string", "id": "string", "status": "active", "type": "bearer_token", "update_time": "string" }
DeleteCredential
Deletes a credential. Fails if referenced by active triggers.
Response
If successful, the response is empty.
Example
Resources
Credential
Server-managed credential resource stored in Secret Manager.
Fields
Output only. The timestamp when the credential was created.
Required. Output only. Identifier. Unique identifier for the credential.
Output only. Current status of the credential.
Possible values:
-
activeThe credential is active and valid for use.
-
revokedThe credential has been revoked and is no longer valid.
Required. Output only. The type of credential.
Possible values:
-
bearer_tokenStatic token injected as header. No refresh logic.
-
oauth2Auto-refresh expired access tokens using stored refresh token.
-
environment_variableEnvironment variable injected into sandbox container.
Output only. The timestamp when the credential was last updated.