> ## Documentation Index
> Fetch the complete documentation index at: https://emiloju.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# User account ID

> Learn how Account ID works and how to retrieve it.

Account ID is a unique identifier for an account on TMDB. It is required to add movies to favorites, wachlist, and perform other actions using the API.

## How to get an Account ID

There are two ways to get an Account ID. You can either get an Account ID directly as an application, or on behalf of a TMDB user in your app.

### As an application

Get your application's `api_key` and `access_token`, then send a `GET` request to [Get account details](/api-reference/accounts/get-account-details) to retrieve your Account ID from the response object.
Below is an example:

```bash Example theme={null}
curl --request GET \
     --url 'https://api.themoviedb.org/3/account?api_key=79191836ddaa0da3df76a5ffef6f07ad6ab0c64' \
     --header 'Authorization: Bearer <your-access-token e.g eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxMDJlNzYzODBkM2NiZGVmMmY2NjQzNzg3ZjkyMzZmYiIsIm5iZiI6MTczMzE3MDMzNi4yNDYsInN1YiI6IjY3NGUxNGEwMGU4M2U0YmUyNTJjZWQyZiIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.ZT61q1NoOlzVMBVMZJQ2sSZZQ7P7KZmtr8Vw19C0Ies>'
```

### On behalf of a TMDB user

Follow the steps below to retrieve the Account ID for a TMDB user within your app:

<Steps>
  <Step title="Generate a `session_id`">
    Generate a unique `session_id` for the user. See how to generate a `session_id` [here]()
  </Step>

  <Step title="Get account details (including the ID)">
    Send a `GET` request to the [Get account details](/api-reference/accounts/get-account-details) endpoint and add the
    `session_id` as a query parameter. Here is an example below:

    ```bash Example theme={null}
    curl --request GET \
         --url 'https://api.themoviedb.org/3/account?session_id=79191836ddaa0da3df76a5ffef6f07ad6ab0c641' \
         --header 'Authorization: Bearer <your-access-token e.g eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxMDJlNzYzODBkM2NiZGVmMmY2NjQzNzg3ZjkyMzZmYiIsIm5iZiI6MTczMzE3MDMzNi4yNDYsInN1YiI6IjY3NGUxNGEwMGU4M2U0YmUyNTJjZWQyZiIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.ZT61q1NoOlzVMBVMZJQ2sSZZQ7P7KZmtr8Vw19C0Ies>'
    ```
  </Step>
</Steps>

The Account ID will be included in the response object as `id`. Below is an example:

```bash Example response theme={null}
{
     "avatar": {
          "gravatar": {
               "hash": "f35e00805bf2085dcc202ea42e3f4ba4"
          },
          "tmdb": {
               "avatar_path": "/xy44UvpbTgzs9kWmp4C3fEaCl5h.png"
          }
     },
     "id": 21666081
     "include_adult": false
     "iso_3166_1": "NG"
     "iso_639_1": "en"
     "name": "John David"
     "username": "Javid"
}
```
