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

# apiKeys.list()

> List API keys in an organization.

List API keys visible to the caller. Secret key values are never returned.

**Required scope: `admin`**

```ts theme={null}
const keys = await mesa.apiKeys.list();

for (const key of keys.api_keys) {
  console.log(key.id, key.name, key.scopes);
}
```

## Options

<ParamField path="org" type="string | undefined">
  Organization override.
</ParamField>

## Response

<ResponseField name="next_cursor" type="string | null">
  Cursor for the next page, or null when no more results remain.
</ResponseField>

<ResponseField name="has_more" type="boolean">
  Whether another page of results is available.
</ResponseField>

<ResponseField name="api_keys" type="ApiKeyListItem[]">
  API key summaries.
</ResponseField>

### ApiKeyListItem

<ResponseField name="id" type="string">
  API key ID.
</ResponseField>

<ResponseField name="name" type="string | null">
  API key name, or null when unnamed.
</ResponseField>

<ResponseField name="scopes" type="string[]">
  Scopes granted to this key.
</ResponseField>

<ResponseField name="repo_ids" type="string[] | null">
  Repository allowlist, or null when the key is not repo-scoped.
</ResponseField>

<ResponseField name="metadata" type="Record<string, unknown> | null">
  Additional API key metadata, or null when absent.
</ResponseField>

<ResponseField name="tags" type="Record<string, string>">
  User-defined API key tags.
</ResponseField>

<ResponseField name="last_used_at" type="string | null">
  Last use time, or null when the key has not been used.
</ResponseField>

<ResponseField name="expires_at" type="string | null">
  Expiration time, or null when the key does not expire.
</ResponseField>

<ResponseField name="revoked_at" type="string | null">
  Revocation time, or null when the key is active.
</ResponseField>

<ResponseField name="created_at" type="string">
  Creation time.
</ResponseField>

## Raw filters

The high-level method currently accepts only `org`. Use `mesa.raw.listApiKeys(...)` for generated filters such as `query`, `status`, `scope`, `repo_id`, `cursor`, and `limit`.
