---
title: "Search and filter API keys"
method: POST
path: "/api/v1/api-keys/search"
tags: ["api-keys"]
---

# Search and filter API keys

`POST /api/v1/api-keys/search`

Search API keys with flexible filtering, sorting, and pagination. Supports filtering by username (admin-only), subscription name, status, sorting by multiple fields, and pagination.

## Request body

- object
  - `filters` object
    - `username` string — Filter by username (admin-only)
    - `subscription` string — Filter by subscription. Matches the subscription id on the key
    - `status` string[] — Filter by status (active, revoked, expired). Defaults to active only.
  - `sort` object
    - `by` 'created_at' | 'expires_at' | 'last_used_at' | 'name' — Field to sort by
    - `order` 'asc' | 'desc' — Sort order
  - `pagination` object
    - `limit` integer
    - `offset` integer

## Response `200`

OK response.

- ApiKeyListResponse
  - `object` string, required — Object type, always "list"
  - `data` ApiKey[], required — Array of API key metadata objects
    - `id` string, required — Unique identifier for the API key
    - `name` string, required — User-friendly name for the API key
    - `description` string — Optional description providing context about the key's purpose
    - `username` string — Username that owns this API key
    - `groups` string[] — User's groups at creation time (immutable snapshot for authorization)
    - `creationDate` string, date-time, required — When the API key was created
    - `expirationDate` string, date-time — When the API key expires (empty for permanent keys)
    - `status` 'active' | 'revoked' | 'expired', required — Current status of the API key
    - `lastUsedAt` string, date-time — When the API key was last used for validation
    - `subscription` string — Name of the subscription associated with this API key
  - `has_more` boolean, required — Whether there are more results beyond this page
  - `subscriptionDetails` object — Map of subscription name to its details (model names). Populated by the BFF by fetching MaaSSubscription resources for any subscription values found on the returned API keys.

## Other responses

- `400` — Bad Request. Invalid search parameters.
- `401` — Unauthorized response.
- `500` — Internal Server Error

---

[API](https://skmtc.net/opendatahub-io/apis/maas-bff-api.md) · [All operations](https://skmtc.net/opendatahub-io/apis/maas-bff-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/opendatahub-io/maas-bff-api/versions/9112415ceeca/schema)
