Skip to content

Get caller identity

GET
/oauth/whoami
curl --request GET \
--url https://api-dev.mindflow.io/v1/oauth/whoami \
--header 'Authorization: Bearer <token>'

Returns the signed-in user and the environments and flows this token can use. Send the opaque OAuth access token from POST /oauth/token as Authorization: Bearer <token>. Identity JWTs are not accepted on this route. 401 when the token is missing or rejected. 403 when the token is valid and cannot read the organization.

Identity and grant-scoped environments for the authenticated principal.

Media typeapplication/json
OAuth who-am-i response

Signed-in user and the environments and flows this token can use. Send an access token from the token endpoint, or a bearer token for a user acting through an approval.

object
userId
required

Opaque id of the user this token acts as. Pass it unchanged.

string
>= 1 characters <= 128 characters /^[^\p{C}]+$/
organizationId
required

Opaque id of the organization this grant is pinned to. Pass it unchanged.

string
default: $CURRENT_ORGANIZATION_ID >= 1 characters <= 128 characters /^[^\p{C}]+$/
includeOrganizationAdmin
required

Whether organization-admin elevation is allowed through this grant.

boolean
environments
required

Environment ceiling on the approval that produced this token.

object
scope
required

Whether the grant covers all accessible environments, an explicit list, or none.

string
<= 32 characters
Allowed values: all selected none
maximumRole
required

Environment role ceiling for scope: all, and the summary / fallback ceiling when rolesById omits an id. One of environmentAuditor, environmentOperator, environmentOwner.

string
<= 64 characters /^[^\x00-\x1F\x7F]+$/
environmentIds

Environment ids included when scope is selected. Omitted when scope is all.

Array<string>
<= 256 items
rolesById

Optional map of environment id to environment role ceiling when scope is selected. Ids without an entry use maximumRole.

object
<= 256 properties
key
additional properties

Environment role ceiling for that environment id.

string
<= 64 characters /^[^\x00-\x1F\x7F]+$/
flows
required

Flow ceiling on the approval that produced this token.

object
scope
required

Whether the grant covers all accessible flows, an explicit list, or none.

string
<= 32 characters
Allowed values: all selected none
maximumRole
required

Flow role ceiling for scope: all, and the summary / fallback ceiling when rolesById omits an id. One of flowAuditor, flowEditor, flowOwner.

string
<= 64 characters /^[^\x00-\x1F\x7F]+$/
flowIds

Flow ids included when scope is selected. Omitted when scope is all.

Array<string>
<= 256 items
rolesById

Optional map of flow id to flow role ceiling when scope is selected. Ids without an entry use maximumRole.

object
<= 256 properties
key
additional properties

Flow role ceiling for that flow id.

string
<= 64 characters /^[^\x00-\x1F\x7F]+$/
environmentIds
required

Environment ids from the grant when environments.scope is selected. Empty when scope is all (callers should use environmentsEffective for the resolved set).

Array<string>
<= 256 items
environmentsEffective
required

Resolved environments with effective role after applying the grant ceiling to live permissions.

Array
<= 256 items

One environment this token can use, with the role after the ceiling is applied.

object
environmentId
required

Opaque id of the environment. Pass it unchanged.

string
default: $CURRENT_ENVIRONMENT_ID >= 1 characters <= 128 characters /^[^\p{C}]+$/
role
required

Role this token can use on the environment. It is never higher than maximumRole, and never higher than the role the user holds.

string
<= 64 characters /^[^\x00-\x1F\x7F]+$/
maximumRole
required

Highest environment role the approval allows here. This is the per-environment role when one was chosen, otherwise the approval’s maximumRole.

string
<= 64 characters /^[^\x00-\x1F\x7F]+$/
Example
{
"userId": "USER-57b858ed-ec60-4507-b2ef-ea58244ac742",
"organizationId": "$CURRENT_ORGANIZATION_ID",
"environments": {
"scope": "all",
"environmentIds": [
"$CURRENT_ENVIRONMENT_ID"
]
},
"flows": {
"scope": "all",
"flowIds": [
"PLAY-17a64601-40bb-4304-90f8-08ebf6ae3c19"
]
},
"environmentIds": [
"$CURRENT_ENVIRONMENT_ID"
],
"environmentsEffective": [
{
"environmentId": "$CURRENT_ENVIRONMENT_ID"
}
]
}
X-RateLimit-Limit
integer format: int32
>= 1 <= 1000
Example
1000

Maximum number of requests allowed in the current window. Present when this response is rate limited.

X-RateLimit-Remaining
integer format: int32
<= 1000
Example
42

Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.

X-RateLimit-Reset
string format: date-time
<= 29 characters
Example
2026-03-20T15:31:00.000Z

Time when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.

Retry-After
integer format: int32
>= 1 <= 3600
Example
30

HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.

Access-Control-Allow-Origin
string
Allowed values: *
Example
*

CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.

Authentication failed. The request lacks valid credentials or the provided credentials are invalid.

Ensure you have:

  • A valid API key or token.
  • Proper authentication headers.
  • Required permissions.
Media typeapplication/json
object
type

URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.

string format: uri-reference
default: about:blank <= 2048 characters
title
required

Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).

string
<= 256 characters /^[^\p{C}]+$/
status
required

HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).

integer format: int32
>= 100 <= 599
detail

Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).

string
<= 500 characters
instance

URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).

string format: uri-reference
<= 2048 characters
code

Always MISSING_OR_INVALID_TOKEN on this response. Branch on this value, not on detail.

string
Allowed values: MISSING_OR_INVALID_TOKEN
Example
{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"detail": "The bearer token is missing or invalid.",
"code": "MISSING_OR_INVALID_TOKEN"
}
X-RateLimit-Limit
integer format: int32
>= 1 <= 1000
Example
1000

Maximum number of requests allowed in the current window. Present when this response is rate limited.

X-RateLimit-Remaining
integer format: int32
<= 1000
Example
42

Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.

X-RateLimit-Reset
string format: date-time
<= 29 characters
Example
2026-03-20T15:31:00.000Z

Time when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.

Retry-After
integer format: int32
>= 1 <= 3600
Example
30

HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.

Access-Control-Allow-Origin
string
Allowed values: *
Example
*

CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.

Forbidden. The server understood the request but refuses to authorize it.

For connector APIs, this often indicates insufficient permissions on the remote system (for example SFTP write access denied).

Media typeapplication/json
object
type

URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.

string format: uri-reference
default: about:blank <= 2048 characters
title
required

Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).

string
<= 256 characters /^[^\p{C}]+$/
status
required

HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).

integer format: int32
>= 100 <= 599
detail

Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).

string
<= 500 characters
instance

URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).

string format: uri-reference
<= 2048 characters
code

Always FORBIDDEN on this response. The token was accepted and the action is not allowed.

string
Allowed values: FORBIDDEN
Example
{
"type": "about:blank",
"title": "Forbidden",
"status": 403,
"detail": "You cannot perform this action.",
"code": "FORBIDDEN"
}
X-RateLimit-Limit
integer format: int32
>= 1 <= 1000
Example
1000

Maximum number of requests allowed in the current window. Present when this response is rate limited.

X-RateLimit-Remaining
integer format: int32
<= 1000
Example
42

Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.

X-RateLimit-Reset
string format: date-time
<= 29 characters
Example
2026-03-20T15:31:00.000Z

Time when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.

Retry-After
integer format: int32
>= 1 <= 3600
Example
30

HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.

Access-Control-Allow-Origin
string
Allowed values: *
Example
*

CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.

Too many requests. The request rate limit has been exceeded.

Please wait until the rate limit window resets before making additional requests.

Media typeapplication/json
object
type

URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.

string format: uri-reference
default: about:blank <= 2048 characters
title
required

Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).

string
<= 256 characters /^[^\p{C}]+$/
status
required

HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).

integer format: int32
>= 100 <= 599
detail

Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).

string
<= 500 characters
instance

URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).

string format: uri-reference
<= 2048 characters
code

Always RATE_LIMIT_EXCEEDED on this response. Wait Retry-After seconds before retrying.

string
Allowed values: RATE_LIMIT_EXCEEDED
Example
{
"type": "about:blank",
"title": "Too Many Requests",
"status": 429,
"detail": "The request rate limit has been exceeded.",
"code": "RATE_LIMIT_EXCEEDED"
}
X-RateLimit-Limit
integer format: int32
>= 1 <= 1000
Example
1000

Maximum number of requests allowed in the current window. Present when this response is rate limited.

X-RateLimit-Remaining
integer format: int32
<= 1000
Example
42

Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.

X-RateLimit-Reset
string format: date-time
<= 29 characters
Example
2026-03-20T15:31:00.000Z

Time when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.

Retry-After
integer format: int32
>= 1 <= 3600
Example
30

HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.

Access-Control-Allow-Origin
string
Allowed values: *
Example
*

CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.

Internal server error. The server encountered an unexpected condition that prevented it from fulfilling the request.

Please try again later or contact support if the problem persists.

Media typeapplication/json
object
type

URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.

string format: uri-reference
default: about:blank <= 2048 characters
title
required

Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).

string
<= 256 characters /^[^\p{C}]+$/
status
required

HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).

integer format: int32
>= 100 <= 599
detail

Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).

string
<= 500 characters
instance

URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).

string format: uri-reference
<= 2048 characters
code

Always INTERNAL_ERROR on this response. Retry later. Do not retry a create in a tight loop.

string
Allowed values: INTERNAL_ERROR
Example
{
"type": "about:blank",
"title": "Internal Server Error",
"status": 500,
"detail": "The request could not be completed.",
"code": "INTERNAL_ERROR"
}
X-RateLimit-Limit
integer format: int32
>= 1 <= 1000
Example
1000

Maximum number of requests allowed in the current window. Present when this response is rate limited.

X-RateLimit-Remaining
integer format: int32
<= 1000
Example
42

Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.

X-RateLimit-Reset
string format: date-time
<= 29 characters
Example
2026-03-20T15:31:00.000Z

Time when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.

Retry-After
integer format: int32
>= 1 <= 3600
Example
30

HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.

Access-Control-Allow-Origin
string
Allowed values: *
Example
*

CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.