---
title: "List API keys"
method: GET
path: "/v2/api_keys"
tags: ["API Keys"]
---

# List API keys

`GET /v2/api_keys`

Lists the API keys the caller can access. The response shows the corpora each key can access and with what permissions.

Callers with the `corpus_administrator`, `administrator`, or `owner` role list every API key in the account. Users holding only other roles must set `api_key_role` to `personal` and receive only their own personal key; machine credentials — API keys, app clients, and service accounts — without one of those three roles cannot list keys at all.

## Query parameters

- `limit` integer
- `page_key` string
- `corpus_key` string — A user-provided key for a corpus.
- `api_key_role` 'serving' | 'serving_and_indexing' | 'personal' — The role of the API key. A `personal` key has the same permissions as its owner. A `serving` API key can only perform query type requests on its corpora, and a `serving_and_indexing` key can perform both indexing and query type requests; these two roles are deprecated for creation — assign roles with `api_roles` instead.

## Headers

- `Request-Timeout` integer
- `Request-Timeout-Millis` integer

## Response `200`

The response includes an `api_keys` array with the API keys, and a `metadata` field with the pagination key.

- ListApiKeysResponse — Response containing a list of API keys for the authenticated customer.
  - `api_keys` ApiKey[] — List of API keys.
    - `id` string, required — The ID of the API key.
    - `name` string, required — The human-readable name of the API key.
    - `secret_key` string, required — The key used in API requests. Keep the key secure.
    - `enabled` boolean — Indicates whether the API key is enabled.
    - `api_roles` ApiRole[] — Customer-level roles for this API key.
    - `api_key_role` 'serving' | 'serving_and_indexing' | 'personal' — The role of the API key. A `personal` key has the same permissions as its owner. A `serving` API key can only perform query type requests on its corpora, and a `serving_and_indexing` key can perform both indexing and query type requests; these two roles are deprecated for creation — assign roles with `api_roles` instead.
    - `corpus_roles` CorpusRole[] — Corpus-specific role assignments for this API key.
      - `corpus_key` string, required — The key of the corpus this role applies to.
      - `role` 'owner' | 'administrator' | 'viewer' | 'editor', required — The role assigned for this specific corpus.
    - `agent_roles` AgentRole[] — Agent-specific role assignments for this API key.
      - `agent_key` string, required — The key of the agent this role applies to.
      - `role` 'agent_administrator' | 'agent_viewer' | 'agent_developer' | 'agent_user' | 'agent_end_user', required — The role assigned for this specific agent. * `agent_administrator` - Full administrative access to the agent including deletion and configuration. * `agent_viewer` - Read-only access to view agent configuration, sessions, events, instructions, and tools. * `agent_developer` - Can modify agent configuration, create/manage sessions, update tools and instructions. * `agent_user` - Limited access to interact with the agent by creating sessions and sending inputs. Cannot view agent configuration or modify settings. * `agent_end_user` - Granted on an alias, lets a user create sessions and send messages through it. They see only their own sessions, and within them only their own messages and the agent's replies. This must be the only role the user holds. The platform rejects assigning it alongside any other role.
    - `api_policy` ApiPolicy — The actions a principal can take on the Vectara platform.
      - `name` string, required — The name of the API role.
      - `allowed_operations` object, required — The operations the API role allows. Each operation may allow only certain resources, described by a map of resource path to resource values. If the value is null, the operation allows any resource.
  - `metadata` ListMetadata — The standard metadata in the response of a list operation.
    - `page_key` string — The page key for the next page of results. Pass it as a query parameter to request the next page.

## Other responses

- `400` — API key list request was malformed.
- `403` — The caller's roles do not allow this listing. Users that hold none of the `corpus_administrator`, `administrator`, or `owner` roles may only request their own personal keys with `api_key_role` set to `personal`; machine credentials without one of those three roles are refused regardless.

---

[API](https://skmtc.net/vectara/apis/vectara-rest-api-v2.md) · [All operations](https://skmtc.net/vectara/apis/vectara-rest-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vectara/vectara-rest-api-v2/revisions/a95087fe3a20/schema)
