operating photo projector

Fetching Your Account ID from TMDB

The following instructions only relate to version 3 of TMDB’s API.

Too many hours wasted on something that seemed elementary. How difficult can it be to grab a simple account_id? When failure strikes it usually entails some head banging followed by some modest swearing.

Many of these same questions were asked in their forum, yet nothing but crickets.

There needs to be a good decent existing tutorial on how to retrieve one’s account_id because there are several steps on how to get there. Maybe this is that tutorial?

I’ve tried to outline the steps to the best of my memory…

1. Get your Request Token

Reference:
https://developers.themoviedb.org/3/authentication/create-request-token

Example of the constructed URL you’ll need to plug into Postman as a GET request:

https://api.themoviedb.org/3/authentication/token/new?api_key=blahblahblah

Run it and there should be a Request Token waiting for you.

2. Create a Session ID

Reference:
https://developers.themoviedb.org/3/authentication/create-session

Example of the constructed URL you’ll need to plug into Postman as a POST request:

https://api.themoviedb.org/3/authentication/session/new?api_key=blahblahblah

Before executing the request, within Postman’s Body tab, you need to add your request_token as raw JSON.

It will look something like the following:

{
  "request_token": "xxxxxxxxxxxxxx"
}

After running the request, you should get back your session_id.

3. Retrieve your account details

Reference:
https://developers.themoviedb.org/3/account/get-account-details

Example of the constructed URL you’ll need to plug into Postman as a GET request:

https://api.themoviedb.org/3/account?api_key=blahblahblah&session_id=xxxxxxxxxxx

After execution, this should return some JSON, and within it the id.
PS: This is your account_id.

Example:

{
  "avatar": {
    "gravatar": {
      "hash": "bL33pb0pb00b0p"
    },
    "tmdb": {
      "avatar_path": null
    }
  },
  "id": 1234567,
  "iso_639_1": "en",
  "iso_3166_1": "US",
  "name": "",
  "include_adult": true,
  "username": "memememe"
}

Tally ho!

Article Credits

Photo by Myke Simon on Unsplash