> ## AI Agent Context
> - Full documentation index: https://aistudio.google.com/llms.txt
> - Gemini Docs MCP server (consistent live info): https://gemini-api-docs-mcp.dev
> - Coding agent skills & setup guide: https://aistudio.google.com/docs/coding-agents.md

# Getting a credential

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

{% /callout %}

{% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `https://generativelanguage.googleapis.com/v1beta/credentials/{id}`

Gets a credential by ID.

{% two-column-layout %}
  {% left-column %}
## Parameters  {% class="hide-from-toc" id="parameters" %}

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

  Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example request** {% class="example-heading" %}

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X GET "https://generativelanguage.googleapis.com/v1beta/credentials/$CREDENTIAL_ID" \
    -H "x-goog-api-key: $GEMINI_API_KEY"
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

{% /two-column-layout %}

{% two-column-layout %}
  {% left-column %}
## Response  {% class="hide-from-toc" id="response" %}

  {% 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 %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example response** {% class="example-heading" %}

  ```json
  {
    "id": "string",
    "type": "bearer_token",
    "status": "active",
    "create_time": "string",
    "update_time": "string"
  }
  ```

  {% /right-column %}

{% /two-column-layout %}

