key management

List Keys

List all keys for a given user / team / organization.

Parameters: expand: Optional[List[str]] - Expand related objects (e.g. 'user' to include user information) status: Optional[str] - Filter by status: "active", "expired", "revoked" (blocked) or "deleted". "deleted" reads the LiteLLM_DeletedVerificationToken archive; the other values partition the live key table, so every live key matches exactly one of them.

Returns: { "keys": List[str] or List[UserAPIKeyAuth], "total_count": int, "current_page": int, "total_pages": int, }

When expand includes "user", each key object will include a "user" field with the associated user object. Note: When expand=user is specified, full key objects are returned regardless of the return_full_object parameter.

get/key/list

Request

  • Base URL: https://docs.litellm.com.cn (the document declares no server; this is the origin it was published from)
  • URL: https://docs.litellm.com.cn/key/list
  • Auth: API key in header x-litellm-api-key

Query parameters

pageinteger

Page number

sizeinteger

Page size

user_idstring nullable

Filter keys by user ID. Exact match by default; set substring_matching=true (admin only) for case-insensitive substring matching.

team_idstring nullable

Filter keys by team ID

organization_idstring nullable

Filter keys by organization ID

key_hashstring nullable

Filter keys by key hash

key_aliasstring nullable

Filter keys by key alias. Exact match by default; set substring_matching=true for case-insensitive substring matching.

searchstring nullable

Combined search: matches keys whose token (key hash) equals the value OR whose key_alias contains it (case-insensitive).

return_full_objectboolean

Return full key object

include_team_keysboolean

Include all keys for teams that user is an admin of.

include_created_by_keysboolean

Include keys created by the user

sort_bystring nullable

Column to sort by (e.g. 'user_id', 'created_at', 'spend')

sort_orderstring

Sort order ('asc' or 'desc')

expandstring[] nullable

Expand related objects (e.g. 'user')

statusstring nullable

Filter by status: 'active' (not blocked, not expired), 'expired' (not blocked, past expiry), 'revoked' (blocked) or 'deleted' (archived keys). Omit to return live keys regardless of status.

project_idstring nullable

Filter keys by project ID

access_group_idstring nullable

Filter keys by access group ID

agent_idstring nullable

Filter keys by agent ID

substring_matchingboolean

If true, match key_alias (any caller) and user_id (proxy admins only) as case-insensitive substrings instead of exact values. Defaults to false: /key/list matched these exactly before substring search was added, and an exact user_id filter must never return another user's keys.

expiresstring nullable

Filter keys by expiration. 'expired' returns keys whose expires is in the past; 'active' returns keys that never expire or expire in the future. Omit to return keys regardless of expiration.

Response

Successful Response

total_countinteger nullable
current_pageinteger nullable
total_pagesinteger nullable

Changes

No recorded changes to this operation across all 1 revision of this API.