# User

## Get the currently authenticated user

Unlike many other queries, the `Viewer` query infers the current user from the access token. This is the simplest way to get the current user.

::: info If you only require the user ID, you can use a JWT library to decode the access token and get the user ID from the `sub` field. :::

[Apollo Studio](https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fgraphql.anilist.co\&explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABMADp6lJFEBqAlggO74nmXXV1htUdICGiHtQC%2BPESBFA)

```graphql
query {
  Viewer {
    id
    name
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://anilist.gitbook.io/anilist-apiv2-docs/docs/guide/graphql/queries/user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
