Skip to main content
POST https://api.humalike.com/v1/turn-taking/actions/whoami
Check that a token is valid and find out which account it belongs to. The call takes no parameters — the account is read from the token itself. Use it as a cheap preflight: call it once at startup to confirm a token still works before sending real traffic, rather than discovering a revoked token on your first billable call. This call is free and never billed. See Credits and billing.

Authorization

Authorization
string
required
Your bearer token: Bearer <token>. See Authentication.

Request body

The request body is an empty object.
Request
{}

Response

user_id
string
The id of the account the token belongs to.
200 OK
{
  "user_id": "user_31kQd7mS2wYpLc8vF0aBnR4tXe"
}

Errors

StatusCodeWhen
401UNAUTHORIZEDThe bearer token is missing, invalid, expired, or revoked.
403forbiddenThe token is valid but not allowed here.
A 200 means the token is good. See Errors for the envelope shape.

Example

curl https://api.humalike.com/v1/turn-taking/actions/whoami \
  -H "Authorization: Bearer $HUMALIKE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
import os
import httpx

resp = httpx.post(
    "https://api.humalike.com/v1/turn-taking/actions/whoami",
    headers={"Authorization": f"Bearer {os.environ['HUMALIKE_TOKEN']}"},
    json={},
)
if resp.status_code == 401:
    raise SystemExit("token is invalid or revoked")
resp.raise_for_status()
print("authenticated as", resp.json()["user_id"])
const res = await fetch("https://api.humalike.com/v1/turn-taking/actions/whoami", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.HUMALIKE_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
if (res.status === 401) throw new Error("token is invalid or revoked");
if (!res.ok) throw new Error(`whoami failed: ${res.status}`);
const { user_id } = await res.json();

Next