> ## AI Agent Context
> Get the complete documentation index at: https://aistudio.google.com/llms.txt
> Use this file to discover all available pages.
> For the full documentation in a single file, fetch: https://aistudio.google.com/llms-full.txt

# Gemini Credentials API

{% callout type="note" %}
  This API is in Beta. Endpoints are under `/v1beta/`.

{% /callout %}

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.

## Methods  {% id="methods" %}

{% table %}
  * Method
  * HTTP request

  ---

  * [Creating a credential](/api-reference/credentials/create-credential)
  *     {% mark class="http-post" %}{% icon name="north_east" /%}`POST`{% /mark %} `/v1beta/credentials`

    Creates a new credential.


  ---

  * [Listing credentials](/api-reference/credentials/list-credentials)
  *     {% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `/v1beta/credentials`

    Lists credentials.


  ---

  * [Getting a credential](/api-reference/credentials/get-credential)
  *     {% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `/v1beta/credentials/{id}`

    Gets a credential by ID.


  ---

  * [Updating a credential](/api-reference/credentials/update-credential)
  *     {% mark class="http-patch" %}{% icon name="north_east" /%}`PATCH`{% /mark %} `/v1beta/credentials/{id}`

    Updates a credential.


  ---

  * [Deleting a credential](/api-reference/credentials/delete-credential)
  *     {% mark class="http-delete" %}{% icon name="close" /%}`DELETE`{% /mark %} `/v1beta/credentials/{id}`

    Deletes a credential.

{% /table %}

## Resources  {% id="resources" %}

### Credential  {% id="Resource:Credential" %}

Server-managed credential resource stored in Secret Manager.

**Properties:**

{% section class="api-ref-property-list" %}
  **id**: {% mark %}required{% /mark %} `string`

  Output only. Identifier. Unique identifier for the credential.

  {% hr /%}

  {% details %}
  {% summary %}
  **type**: {% mark %}required{% /mark %} `string enum`

  Output only. The type of credential.

  {% /summary %}

  Possible values:

  - `bearer_token`: Static token injected as header. No refresh logic.
  - `oauth2`: Auto-refresh expired access tokens using stored refresh token.
  - `environment_variable`: Environment variable injected into sandbox container.

  {% /details %}

  {% hr /%}

  {% details %}
  {% summary %}
  **status**: `string enum`

  Output only. Current status of the credential.

  {% /summary %}

  Possible values:

  - `active`: The credential is active and valid for use.
  - `revoked`: The credential has been revoked and is no longer valid.

  {% /details %}

  {% hr /%}

  **create_time**: `string`

  Output only. The timestamp when the credential was created.

  {% hr /%}

  **update_time**: `string`

  Output only. The timestamp when the credential was last updated.

{% /section %}

