mv.whoami
The API key making the request. These methods are on mv.whoami, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.
retrieve()
Section titled “retrieve()”Retrieve the caller. Returns the organisation, key, mode, scopes and API version of the key that authenticated the request.
mv.whoami.retrieve(options?: RequestOptions): Promise<WhoamiRetrieveResponse>GET /whoami · API reference
Parameters
Section titled “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. |
Returns
Section titled “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). |
Example
Section titled “Example”import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({ client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),});
const apiKeyPrincipal = await mv.whoami.retrieve();console.log(apiKeyPrincipal);