LOOMAL
SDK / API Reference

Whoami

Identify the caller behind the current API key (works with both loid- and lopk-)

Scope: None required

Returns the caller's identity. The response shape depends on which key type you authenticate with:

  • Bearer loid-… (project key) → single-Identity detail: name, email, scopes, usage counters, the agent's DID.
  • Bearer lopk-… (platform key) → org-admin view: User + Org + list of Identities under the org.

Use the same URL with either key — no need to remember which endpoint matches which tier.

Request

import { Loomal } from "@loomal/sdk";

const loomal = new Loomal({ apiKey: process.env.LOOMAL_API_KEY! });
const me = await loomal.identity.whoami();

console.log(me.identityId, me.email, me.scopes);
import os
from loomal import Loomal

loomal = Loomal(api_key=os.environ["LOOMAL_API_KEY"])
me = loomal.identity.whoami()

print(me.identity_id, me.email, me.scopes)
loomal whoami

Add --json for machine-readable output. The CLI reads LOOMAL_API_KEY from your environment.

identity.whoami()

Available as an MCP tool through @loomal/mcp — see MCP setup.

curl https://api.loomal.ai/v0/whoami \
  -H "Authorization: Bearer loid-..."

Response — loid-… (project key)

{
  "identityId": "id-b103b0e752d24018",
  "name": "Sales",
  "email": "sales-x3unq@mailgent.dev",
  "displayName": "Sales",
  "type": "INBOX",
  "purpose": "BUYER",
  "scopes": ["mail:read", "mail:send", "mail:manage", "vault:read", "vault:write"],
  "usageCount": 126,
  "lastUsedAt": "2026-03-30T03:20:25.696Z",
  "createdAt": "2026-03-29T03:13:22.848Z",
  "wallet": { "address": "0x…" }
}
FieldTypeDescription
identityIdstringStable unique ID for the project's agent identity
namestringProject name
emailstringAgent inbox address at mailgent.dev
displayNamestringDisplay name shown in mail headers
typestringProject type (INBOX)
purpose"BUYER" | "SELLER"Whether this Identity consumes paid APIs or operates a paid endpoint
scopesstring[]Granted permissions for this API key
usageCountnumberTotal API requests made with this key
lastUsedAtstring | nullISO 8601 timestamp of the most recent request
createdAtstringISO 8601 timestamp of project creation
wallet{ address } | nullUSDC smart wallet address on Base (null until provisioned)

Response — lopk-… (platform key)

{
  "user": {
    "id": "user_a3f91b00",
    "name": "bright-quiet-otter",
    "email": "bright-quiet-otter-k3f9a@mailgent.dev",
    "userType": "AGENT"
  },
  "org": {
    "id": "org_xq2k9m",
    "name": "bright-quiet-otter",
    "plan": "FREE",
    "createdAt": "2026-05-18T12:00:00Z"
  },
  "identities": [
    {
      "identityId": "id-a3f91b00c2d54e87",
      "name": "bright-quiet-otter",
      "purpose": "BUYER",
      "email": "bright-quiet-otter-k3f9a@mailgent.dev",
      "scopes": ["mail:read", "mail:send", "..."],
      "createdAt": "2026-05-18T12:00:00Z"
    }
  ]
}

The user.userType is "HUMAN" for Console-created accounts and "AGENT" for those minted via POST /v0/agent-signup. Up to 100 most-recently-created identities are returned.

Errors

StatuserrorCause
401unauthorizedMissing or invalid Authorization header, or key doesn't start with loid- / lopk-
429rate_limitedMore than 60 whoami auth attempts/min from this IP

On this page