Authentication API
Inspect the authenticated principal and look up organization IDs.
Get organization IDs from the token or the first WorkOS membership page
Accepts only a WorkOS user access token: a Factory API key, including a service account's, is answered 401, as is a request without a bearer credential or with a token whose signature does not verify. For a token that carries a WorkOS organization, returns that organization alone; otherwise returns organization IDs from only the first page of WorkOS memberships for the token's user (active ones, up to 10, under WorkOS's current defaults), without following or returning a pagination cursor. A 429 passes on WorkOS rate limiting of that list. A 503 means WorkOS could not serve the request: its signing keys could not be fetched to check the token, or the list answered a server error or bad JSON, or was unreachable.
curl 'https://api.factory.ai/api/cli/org' \
-H "Authorization: Bearer $FACTORY_BEARER_TOKEN"Parameters
Ignored: the answer depends only on the bearer token.
Responses
application/json
Array items
string400Response for status 400
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
401Response for status 401
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
402Response for status 402
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
403Response for status 403
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
404Response for status 404
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
409Response for status 409
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
410Response for status 410
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
413Response for status 413
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
422Response for status 422
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
429Response for status 429
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
451Response for status 451
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
500Response for status 500
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
502Response for status 502
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
503Response for status 503
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
Get the authenticated principal
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.
curl 'https://api.factory.ai/api/cli/whoami' \
-H "Authorization: Bearer $FACTORY_BEARER_TOKEN"Parameters
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.
Allowed values
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.
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.
Responses
application/json
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.
Minimum length: 1
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.
Minimum length: 1
Allowed values
Allowed values
`human` for a user access token or a user API key, `service` for a service account API key.
Allowed values
Allowed values
Minimum length: 1
400Response for status 400
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
401Response for status 401
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
402Response for status 402
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
403Response for status 403
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
404Response for status 404
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
451Response for status 451
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
500Response for status 500
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
503Response for status 503
application/json
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users
The same error fields, for clients that only read body.error
Human-readable error message
HTTP status code
HTTP status title
Additional error metadata
Values
objectRequest identifier to include when contacting support
Stable machine-readable error code, when one applies
True when detail is curated copy that is safe to show users