# ApiKeyCreated

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

```ts
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

| Field | Type | Description |
| --- | --- | --- |
| `accountId` | `string` \| `null` | Owning account ID (null for system keys) |
| `domains` | `string[]` | 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. |
| `id` | `string` | Unique API key identifier |
| `idleExpiresAt` | `number` \| `null` | When 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. |
| `idleTtlS` | `number` \| `null` | Seconds of disuse after which this key stops authenticating, or null for never |
| `kind` | `string` \| `null` | Display metadata for what this key is, or null (see ApiKey.kind) |
| `managed` | `boolean` | True if this key is managed by platform infrastructure |
| `name` | `string` | Descriptive name for the API key |
| `role` | `string` | Key role ('system' or 'account') |
| `token` | `string` | Plaintext API key secret token (returned once only at creation) |

## Used by

| Method | What it does |
| --- | --- |
| [`apiKeys.create`](/docs/sdks/typescript/api-keys/create) | Create API key |
