Skip to main content

viewer

Get information about the currently authenticated entity.

Returns an AccountViewer for human users or a ServiceAccountViewer for API clients. This is the "who am I?" query — use it to bootstrap user profiles, display org switchers, check billing status, or verify which service account is making requests.

Returns an authentication error if the request has no valid credentials.

viewer: Viewer

Type​

Viewer union​

The authenticated entity making this API request.

This is a union type — check __typename to determine whether the viewer is a human user (AccountViewer) or an API client (ServiceAccountViewer), then query the appropriate fields.

Example:

query {
viewer {
__typename
... on AccountViewer {
id
email
firstName
organizations { data { id name } }
}
... on ServiceAccountViewer {
id
name
organization { id name }
}
}
}