# mv.whoami

> The whoami methods of @morevoice/sdk: The API key making the request.

The API key making the request. These methods are on `mv.whoami`, where `mv` is your client (see [the Node.js SDK](https://docs.morevoice.ai/sdk/node/#connect)). Each one returns the response object and throws when the API answers with an error.

## `retrieve()`

**Retrieve the caller.** Returns the organisation, key, mode, scopes and API version of the key that authenticated the request, and what the organisation can do: its plan, the plan's features and main limits, and the partner-settable feature flags as they resolve for it. With `Mv-Account` (a partner key acting in a client organisation), the client's.

```ts
mv.whoami.retrieve(options?: RequestOptions): Promise<WhoamiRetrieveResponse>
```

`GET /whoami` · [API reference](https://docs.morevoice.ai/api/operations/whoami_retrieve/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `options.headers["MoreVoice-Version"]` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `options` | `RequestOptions` | no | `idempotencyKey`, extra `headers` and an abort `signal`: see [retries and idempotency](https://docs.morevoice.ai/sdk/typescript/retries/). |

### Returns

`ApiKeyPrincipal`:

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"api_key_principal"` | Always `api_key_principal`. |
| `org_id` | `string` | The organisation the key belongs to (`org_…`). |
| `key_id` | `string \| null` | The API key (`key_…`); null for OAuth app tokens. |
| `livemode` | `boolean` | false for test-mode keys (`mv_test_…`). |
| `scopes` | `string[]` | The scopes granted to the key; ["*"] means every scope. |
| `api_version` | `string` | The API version this request was answered in (MoreVoice-Version header, else the key's pinned version). |
| `plan` | `string \| null` | The organisation's plan (`starter`, `growth`, `business`, `enterprise`, …). With `Mv-Account`, the client organisation's. Null only while the plan can't be read (try again). |
| `features` | `PlanFeatures \| null` | — |
| `limits` | `PlanLimits \| null` | — |
| `flags` | `CapabilityFlags \| null` | — |

### Example

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const apiKeyPrincipal = await mv.whoami.retrieve();
console.log(apiKeyPrincipal);
```
