Skip to Content

The ApiKeyCreated type of the TypeScript SDK, which apiKeys.create take or answer.

type ApiKeyCreated = {
  accountId: string | null
  domains?: string[]
  id: string
  idleExpiresAt: number | null
  idleTtlS: number | null
  kind: string | null
  managed: boolean
  name: string
  role: string
  token: string
}

Fields

FieldTypeDescription
accountIdstring | nullOwning account ID (null for system keys)
domainsstring[]Optional. The domains this key is scoped to, normalized (lowercased, deduplicated, sorted); ABSENT when the key was minted unscoped. A minter that asked for a scope and does not see it echoed here is talking to a core that predates the feature and must treat the key as mis-minted (revoke it) — core strips unknown request keys.
idstringUnique API key identifier
idleExpiresAtnumber | nullWhen this key would lapse if never used, in epoch seconds — null when it never lapses. Present so a client can show the date without doing calendar arithmetic against its own clock, which may not be the server's.
idleTtlSnumber | nullSeconds of disuse after which this key stops authenticating, or null for never
kindstring | nullDisplay metadata for what this key is, or null (see ApiKey.kind)
managedbooleanTrue if this key is managed by platform infrastructure
namestringDescriptive name for the API key
rolestringKey role ('system' or 'account')
tokenstringPlaintext API key secret token (returned once only at creation)

Used by

MethodWhat it does
apiKeys.createCreate API key

On this page