Skip to main content

Viewer

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 }
}
}
}
union Viewer = AccountViewer | ServiceAccountViewer

Possible types​

Viewer.AccountViewer object​

The authenticated human user (account).

Returned by the viewer query when the request is authenticated with a user session or on behalf of a human account. Contains profile information, organization memberships, linked OAuth identities, and pending group invitations.

Use organizations to build an org switcher, defaultOrganization to set an initial context, and invites to show pending invitations the user can accept.

Viewer.ServiceAccountViewer object​

The authenticated service account (API client).

Returned by the viewer query when the request is authenticated with a service account credential (Basic auth or access token). Contains the service account's identity and the organization it belongs to.

Returned By​

viewer query