Authentication

Get the authenticated principal

Changed on

Returns the principal a user access token, a user API key or a service account API key authenticates, and the organization the request acts in.

get/api/cli/whoami

Request

  • Base URL
    https://api.factory.ai
  • Auth
    HTTP bearer

Headers

X-Factory-Whoami-Extended, 'true'

With true, the answer adds inferenceRegion, isEnterprise and principalKind, and premBaseHostV2 unless the credential is an environment repair credential. Without the header, the answer carries none of them.

X-Factory-Session-Attribution, string

A session attribution claim. A claim signed for this principal and organization that has not expired is returned as attribution, unless the signing key cannot be read in time. A claim with a bad signature, signed for another principal or another organization, or expired is ignored.

X-Factory-Org-Id, string

For a user who can access their root organization, a request without the header, or with one naming an organization the user cannot access, acts in the root organization. An API key acts in its own organization and ignores this header.

Response

Response for status 200

GetWhoami200ResponseBody required
userId, string required

For a user access token or a user API key, the user's ID; for a service account API key, the service account's ID.

orgId, string required

For an API key, the key's organization; for a user access token, the organization the request acts in, as X-Factory-Org-Id describes.

region, 'global' | 'eu'
inferenceRegion, 'global' | 'eu' | 'us' | 'in'
isEnterprise, boolean
principalKind, 'human' | 'service'

human for a user access token or a user API key, service for a service account API key.

premBaseHostV2, string
attribution, object

Changes

    • info

      added the optional property attribution/sharedSessionMember to the response with the status

    • warning

      added the new ios enum value to the attribution/source response property for the response status