Identify the calling credential
Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… or SSO access token — see API keys.
Says who the caller is and what kind of credential it used — never any
profile data. Use it to check a key before relying on it: whether it is
read-only, which account it acts for, and — for a credential issued
through NSIN SSO (an access token, or an nsin_ key an app minted with
one) — which domains it may touch.
Works with an API key, an NSIN SSO access token (with or without the
nsin:full scope — this is one of the two endpoints an identity-only
token may call) and a panel session. A credential bound to an SSO
client reports domain_access; when the user has revoked the app,
grant_revoked is true and the selection is empty, which is how a
connected app learns it was disconnected without guessing from 404s.
Responses
200The caller's identity.
Content type: application/json
- user_idintegerrequired
The account the credential acts for.
- authstringrequired
Kind of credential:
keyannsin_API key,ssoan NSIN SSO access token,jwtthe panel's own session.One of:"key""sso""jwt" - read_onlybooleanrequired
trueonly for a read-only API key. SSO tokens are limited by scope and domain selection, not read-limited, so they reportfalse. - adminbooleanrequired
Whether the account is NSIN staff.
- key_idinteger
The API key's id. Present only when
authiskey. - client_idstring
The NSIN SSO client the credential is bound to: the client an SSO token was issued to, or the app that minted this API key. Absent for keys you created yourself in the panel.
- scopestring
Space-separated scopes granted to an SSO token. Present only when
authissso. - domain_accessobject
The domains a client-bound credential may touch. Absent for panel sessions and for keys you created yourself, which carry no domain restriction.
Fields
- allbooleanrequired
- domain_idsarray of integer
- domainsarray of object
Item fields
- idinteger
- namestring
- grant_revokedboolean
Present, and
true, when the user has revoked the SSO grant behind this credential: it can no longer see any domain.
{
"user_id": 42,
"auth": "key",
"read_only": true,
"admin": false,
"key_id": 7
}401Missing, malformed, revoked or expired API key. (A valid key whose
account has been deactivated gets 403 account is inactive instead.)
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "invalid API key"
}429The key exceeded its request budget (300 requests per minute by default).
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "rate limit exceeded"
}Example request
curl -X GET "https://api.nsin.ir/whoami" \
-H "Authorization: Bearer $NSIN_API_KEY"