> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get an API key

> Fetch metadata for one federated API key by its prefix. The plaintext key is never returned after creation.

Fetch one federated API key by its `prefix`. Only metadata is returned; the plaintext key is shown exactly once at creation and is unrecoverable afterward. To inspect the model access and limits the key resolves to, fetch its [group](/reference/gateway/groups/get-a-group) and read the `effective_models` block.

### Errors

| Status          | Meaning                                                                                           |
| --------------- | ------------------------------------------------------------------------------------------------- |
| `403 Forbidden` | The group or key exists but isn't in your workspace, or the caller doesn't have management scope. |
| `404 Not Found` | No group or key with these identifiers in your workspace, or the key has been revoked.            |

<RequestExample>
  ```bash curl theme={"system"}
  curl --request GET \
    --url https://api.baseten.co/v1/gateway/groups/abc123hash/api_keys/sky_sCqhBwEy4kPd \
    --header "Authorization: Bearer $BASETEN_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"system"}
  {
    "prefix": "sky_sCqhBwEy4kPd",
    "name": "prod-key-1"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml get /v1/gateway/groups/{group_id}/api_keys/{api_key_prefix}
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/gateway/groups/{group_id}/api_keys/{api_key_prefix}:
    parameters:
      - $ref: '#/components/parameters/group_id'
      - $ref: '#/components/parameters/api_key_prefix'
    get:
      summary: Gets an API key for a group
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayKeyInfoV1'
      x-codeSamples:
        - lang: bash
          source: >
            curl --request GET \

            --url
            https://api.baseten.co/v1/gateway/groups/{group_id}/api_keys/{api_key_prefix}
            \

            --header "Authorization: Bearer $BASETEN_API_KEY"
        - lang: python
          source: >-
            import requests

            import os

            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")

            url =
            "https://api.baseten.co/v1/gateway/groups/{group_id}/api_keys/{api_key_prefix}"


            headers = {"Authorization": f"Bearer {API_KEY}"}


            response = requests.request(
                "GET",
                url,
                headers=headers,
                json={}
            )


            print(response.text)
components:
  parameters:
    group_id:
      schema:
        type: string
      name: group_id
      in: path
      required: true
    api_key_prefix:
      schema:
        type: string
      name: api_key_prefix
      in: path
      required: true
  schemas:
    GatewayKeyInfoV1:
      properties:
        prefix:
          description: The prefix of the Model API key.
          title: Prefix
          type: string
        name:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Optional display name.
          title: Name
      required:
        - prefix
      title: GatewayKeyInfoV1
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````