---
title: "ApiKeyCreated"
description: "Shape returned when an ApiKey is first created."
section: "Reference"
group: "Types"
order: 17
---

## Definition

```ts
interface ApiKeyCreated {
  id: string;
  name: string;
  key: string;
  keyHint: string;
  type: "private" | "public";
  expiresAt: string | null;
  scopes?:
    | {
        operations?: Array<string> | undefined;
        entityIds?: Array<string> | undefined;
      }
    | null
    | undefined;
}
```

## Fields

| Field       | Type                                                                                                        | Notes                                                                                          |
| ----------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `id`        | `string`                                                                                                    | `readonly` `required`                                                                          |
| `name`      | `string`                                                                                                    | `required` — Human-readable label for the key.                                                 |
| `key`       | `string`                                                                                                    | `required` — Full plaintext key value — returned only once at creation time.                   |
| `keyHint`   | `string`                                                                                                    | `required` — Last few characters of the key, safe to display for identification.               |
| `type`      | `"private" \| "public"`                                                                                     | `required` — Key type — 'private' for server-side use, 'public' for clients.                   |
| `expiresAt` | `string \| null`                                                                                            | `required` — ISO-8601 timestamp after which the key is rejected; null = no expiry.             |
| `scopes`    | `{ operations?: Array<string> \| undefined; entityIds?: Array<string> \| undefined; } \| null \| undefined` | `optional` — Restricts what this key may do; null/empty means full access within its key type. |
