Skip to main content

Identity

Check which organization an Unstract Flow API key belongs to, who it acts as, and what that person may do. Call it first when a request is refused with 403.

Check a key​

GET /api/v1/external/accounts/<organization-id>/whoami
curl "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/whoami" \
-H "X-API-Key: $FLOW_API_KEY"
{
"organization_id": "…",
"key": {
"id": "…", "name": "Review desk", "prefix": "ufk_a1b2c3d4",
"expires_at": "2027-01-24T23:59:59+00:00",
"scopes": ["hitl:assign"]
},
"actor": {"user_id": "…", "email": "maya@example.com", "name": "Maya Lin"},
"permissions": ["hitl:assign"],
"actor_permissions": ["hitl:assign", "hitl:resolve"]
}
FieldTypeMeaning
organization_idstringThe organization the request addressed.
key.id, key.name, key.prefixstringThe key's ID, its name, and its first characters, as the API keys tab shows them.
key.expires_atstring, or nullWhen the key expires, in ISO 8601. null only for a key created before every key had to expire.
key.scopesarray of strings, or nullThe permissions this key was limited to. null for a key with full access — everything its creator can do.
actor.user_id, actor.email, actor.namestringThe person who created the key. Writes to review tickets act as this person.
permissionsarray of stringsWhat this key can do: the actor's current permissions narrowed by the key's scopes. This is what a request will actually be granted, so check it rather than actor_permissions when you want to know whether a call will succeed.
actor_permissionsarray of stringsWhat the person can do in this organization now, not when the key was created. Equal to permissions for a key with full access, and wider for a limited one.

In the example above the key is limited to hitl:assign, so it cannot resolve a ticket even though Maya can.

One exception worth knowing: reading review tickets needs no permission at all, so those routes answer for any valid key whose scopes allow them. That holds even if permissions does not list hitl:read, because the actor's role lacks it.

StatusMessageCause
401Invalid API keyThe key is unknown, revoked, or belongs to another organization.
401API key has expiredThe key's expiry date has passed.
403This API key's creator no longer exists or is deactivated; create a new key.The person who created the key was deleted or deactivated.
403This API key's creator is no longer a member of this organization; create a new key.The person who created the key was removed from the organization.

Authentication explains how a key acts as its creator.