---
title: "List Api Keys"
method: GET
path: "/api/v1/service_accounts/{service_account_id}/api_keys"
tags: ["service_accounts", "api_keys"]
---

# List Api Keys

`GET /api/v1/service_accounts/{service_account_id}/api_keys`

## Request

- The document declares no server URL.
- Auth: OAuth 2
  - Password
  - Token URL: `/api/v1/login`
- TypeScript: <https://skmtc.dev/zenml-io/apis/zenml/docs/api/v1/service_accounts/:service_account_id/api_keys/get.ts> (a function with typed inputs; its response is checked against the schema)

List API keys associated with a service account.

Args:
    service_account_id: ID of the service account to which the API keys
        belong.
    hydrate: Flag deciding whether to hydrate the output model(s)
        by including metadata fields in the response.
    filter_model: Filter model used for pagination, sorting,
        filtering

Returns:
    All API keys matching the filter and associated with the supplied
    service account.

## Path parameters

- `service_account_id` string, uuid, required

## Query parameters

- `hydrate` boolean
- `sort_by` string
- `logical_operator` 'or' | 'and': Logical Ops to use to combine filters on list methods.
- `page` integer
- `size` integer
- `id` union
  - string, uuid
  - string
- `created` union
  - string, date-time
  - string
- `updated` union
  - string, date-time
  - string
- `service_account` string, uuid, nullable
- `name` string, nullable
- `description` string, nullable
- `active` union
  - boolean
  - string
- `last_login` union
  - string, date-time
  - string
- `last_rotated` union
  - string, date-time
  - string

## Response `200`

Successful Response

- PageAPIKeyResponse
  - `index` integer, required
  - `max_size` integer, required
  - `total_pages` integer, required
  - `total` integer, required
  - `items` APIKeyResponse[], required
    - `body` APIKeyResponseBody: Response body for API keys.
      - `created` string, date-time, required
      - `updated` string, date-time, required
      - `key` string, nullable
      - `active` boolean
      - `service_account` ServiceAccountResponse, required: Response model for service accounts.
        - `body` ServiceAccountResponseBody: Response body for service accounts.
          - `created` string, date-time, required
          - `updated` string, date-time, required
          - `active` boolean
        - `metadata` ServiceAccountResponseMetadata: Response metadata for service accounts.
          - `description` string
        - `resources` ServiceAccountResponseResources: Class for all resource models associated with the service account entity.
        - `id` string, uuid, required
        - `permission_denied` boolean
        - `name` string, required
    - `metadata` APIKeyResponseMetadata: Response metadata for API keys.
      - `description` string
      - `retain_period_minutes` integer, required
      - `last_login` string, date-time, nullable
      - `last_rotated` string, date-time, nullable
    - `resources` APIKeyResponseResources: Class for all resource models associated with the APIKey entity.
    - `id` string, uuid, required
    - `permission_denied` boolean
    - `name` string, required

## Other responses

- `401`: Unauthorized
- `404`: Not Found
- `422`: Unprocessable Entity

---

[API](https://skmtc.dev/zenml-io/apis/zenml.md) - [All operations](https://skmtc.dev/zenml-io/apis/zenml/llms.txt) - [OpenAPI document](https://skmtc.dev/zenml-io/apis/zenml/revisions/abe684261209?raw)
