> ## 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.

# List a machine user's API keys

> Lists a machine user's active API keys, newest first.



## OpenAPI

````yaml get /v1/grid/machine_users/{machine_user_id}/api_keys
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/grid/machine_users/{machine_user_id}/api_keys:
    parameters:
      - $ref: '#/components/parameters/machine_user_id'
    get:
      summary: Lists a machine user's API keys
      description: >-
        Lists the machine user's active API keys, newest first. Requires team
        admin for the machine user's team.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIKeysV1'
      x-codeSamples:
        - lang: bash
          source: >
            curl --request GET \

            --url
            https://api.baseten.co/v1/grid/machine_users/{machine_user_id}/api_keys
            \

            --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/grid/machine_users/{machine_user_id}/api_keys"


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


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


            print(response.text)
components:
  parameters:
    machine_user_id:
      schema:
        type: string
      name: machine_user_id
      in: path
      required: true
  schemas:
    APIKeysV1:
      description: A list of API keys.
      properties:
        keys:
          description: A list of API key information
          items:
            $ref: '#/components/schemas/APIKeyInfoV1'
          title: Keys
          type: array
      required:
        - keys
      title: APIKeysV1
      type: object
    APIKeyInfoV1:
      description: Represents the metadata of an API key.
      properties:
        prefix:
          description: The prefix of the API key
          title: Prefix
          type: string
        name:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Optional name for the API key
          examples:
            - my-api-key
          title: Name
        type:
          $ref: '#/components/schemas/APIKeyCategory'
          description: Type of the API key.
          examples:
            - PERSONAL
            - GRID
            - WORKSPACE_MANAGE_API_KEYS
            - WORKSPACE_EXPORT_METRICS
            - WORKSPACE_INVOKE
            - WORKSPACE_MANAGE_ALL
        model_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: >-
            List of model IDs to scope the API key to, only present if type is
            'WORKSPACE_EXPORT_METRICS' or 'WORKSPACE_INVOKE'
          examples:
            - - aaaaaaaa
          title: Model Ids
        team_name:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: The name of the team associated with the API key
          title: Team Name
        created_at:
          description: Creation time in ISO 8601 format
          format: date-time
          title: Created At
          type: string
        expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          default: null
          description: Expiry time in ISO 8601 format, or null if the key never expires.
          title: Expires At
        last_used_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          default: null
          description: >-
            Last recorded use in ISO 8601 format, or null if unavailable.
            Updates may be delayed.
          title: Last Used At
        owner:
          anyOf:
            - $ref: '#/components/schemas/APIKeyOwnerV1'
            - type: 'null'
          default: null
          description: The user who owns the API key. Only present for personal API keys.
      required:
        - prefix
        - type
        - created_at
      title: APIKeyInfoV1
      type: object
    APIKeyCategory:
      description: Enum representing the category of an API key.
      enum:
        - PERSONAL
        - GRID
        - WORKSPACE_MANAGE_ALL
        - WORKSPACE_EXPORT_METRICS
        - WORKSPACE_INVOKE
        - WORKSPACE_MANAGE_API_KEYS
      title: APIKeyCategory
      type: string
    APIKeyOwnerV1:
      description: The user who owns a personal API key.
      properties:
        user_id:
          description: Unique identifier for the user
          title: User Id
          type: string
        email:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Email address of the user
          title: Email
        name:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Display name of the user
          title: Name
      required:
        - user_id
      title: APIKeyOwnerV1
      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.

````