Skip to main content
Lists the active API keys for a Kosli service account. Only key metadata is returned. The raw key value is never retrievable after creation. Use this data source to:
  • Audit the active API keys of a service account
  • Alert on keys nearing their expires_at
  • Find keys that have never been used (last_used_at is null) as candidates for cleanup
To mint a new key, use the kosli_service_account_api_key resource. All timestamps are RFC3339 UTC strings. expires_at is null for keys that never expire, and last_used_at is null for keys that have never been used.

Example usage

Schema

Required

  • service_account_name (String) The name of the service account whose API keys should be listed.

Read-only

  • keys (Attributes List) The list of active API keys for the service account, sorted by creation time (oldest first). See the nested schema below.

Nested schema for keys

Read-only:
  • created_at (String) RFC3339 UTC timestamp of when the API key was created.
  • description (String) Description of the API key.
  • expires_at (String) RFC3339 UTC timestamp at which the key expires. Null if the key never expires.
  • id (String) Server-assigned identifier of the API key.
  • last_used_at (String) RFC3339 UTC timestamp of when the API key was last used. Null if the key has never been used.
Last modified on November 16, 2026