> ## 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.

# Authentication methods

> Learn how to authenticate your app with the API.

## Overview

There are three ways to authenticate your app with The Movie Database (TMDB) API. They include the following:

1. Application level authentication (ALA) - Default method.
2. User authentication.
3. Guest sessions.

<Tabs>
  <Tab title="ALA">
    Application level authentication would generally be considered the default way of authenticating yourself on the API.
    You can authenticate with either your `api_key`, or by using your `access_token` as a bearer token.

    ### Access Token

    The default method to authenticate is with your `access_token`. This token is expected to be sent along as an Authorization header.
    A simple cURL example using this method looks like the following:

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

    ### API Key

    The API Key is the second authentication method. Although, it cannot be used for all endpoints.
    Use the `api_key` over the `access_token` only when you really need to. For example, the [Get account details](/api-reference/accounts/get-account-details) endpoint uses an API Key.
    A simple cURL example using the `api_key` looks like the following:

    ```bash Example theme={null}
    curl --request GET \
         --url 'https://api.themoviedb.org/3/movie/changes?api_key=79191836ddaa0da3df76a5ffef6f07ad6ab0c641' 
    ```
  </Tab>

  <Tab title="User authentication">
    You can authenticate TMDB users within your application to extend the TMDB experience within your application. This will let your users (who also have an account with us) do things like rate movies,
    maintain their favourite and watch lists as well as do things like create and edit custom lists, all while staying in sync with their account on TMDB.

    User authentication is controlled with a `session_id` query parameter. Read this [guide](/api-reference/user-authentication) to see how to generate a `session_id`.

    After getting the `session_id`, use it as a query parameter in each endpoint as seen in the code below:

    ```bash Example theme={null}
    curl --request GET \
         --url 'https://api.themoviedb.org/3/movie/11?session_id=79191836ddaa0da3df76a5ffef6f07ad6ab0c641' \
         --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxMDJlNzYzODBkM2NiZGVmMmY2NjQzNzg3ZjkyMzZmYiIsIm5iZiI6MTczMzE3MDMzNi4yNDYsInN1YiI6IjY3NGUxNGEwMGU4M2U0YmUyNTJjZWQyZiIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.ZT61q1NoOlzVMBVMZJQ2sSZZQ7P7KZmtr8Vw19C0Ies'
    ```

    <Note>You should treat this key like a password and keep it secret.</Note>
  </Tab>

  <Tab title="Guest sessions">
    Guest sessions are a second type of user authentication that allows your users to access the API without logging in. However, they have limited permissions as they can only rate a movie, TV show and TV episode.
    Creating a guest session is as simple as calling the [new guest session](/api-reference/authentication/create-guest-session) method.

    Just like a fully authorized user session, guest sessions should be kept private as they tie a session within your application to a single token.
  </Tab>
</Tabs>

## How to get authentication credentials (API key and bearer token)

<Note>
  Please note that the API registration process is not optimized for mobile devices so you should access these pages on a desktop computer and browser.
</Note>

<Steps>
  <Step title="Login to your TMDB dashboard">
    [Create](https://www.themoviedb.org/signup) a TMDB account or [login](https://www.themoviedb.org/login) to access your dashboard
  </Step>

  <Step title="Click your profile icon at the top right corner and select settings">
    <Accordion title="Click to view image">
      <img src="https://mintcdn.com/emiloju/MfS4U38wS5GVTiAi/api-reference/images/tmdb_select_api.jpeg?fit=max&auto=format&n=MfS4U38wS5GVTiAi&q=85&s=58448895f5f3bfbecb162e9fc4e73539" alt="The Movie Database(TMDB) profile icon" width="1366" height="380" data-path="api-reference/images/tmdb_select_api.jpeg" />
    </Accordion>
  </Step>

  <Step title="Select the API tab on the settings page">
    <Accordion title="Click to view image">
      <img src="https://mintcdn.com/emiloju/MfS4U38wS5GVTiAi/api-reference/images/tmdb_api_tab.jpeg?fit=max&auto=format&n=MfS4U38wS5GVTiAi&q=85&s=048ad020e048812eb7d60db6a6762758" alt="The Movie Database(TMDB) API tab" width="592" height="267" data-path="api-reference/images/tmdb_api_tab.jpeg" />
    </Accordion>
  </Step>

  <Step title="Tap 'click here' under 'Request an API Key' ">
    <Accordion title="Click to view image">
      <img src="https://mintcdn.com/emiloju/MfS4U38wS5GVTiAi/api-reference/images/tmdb_request_key.jpeg?fit=max&auto=format&n=MfS4U38wS5GVTiAi&q=85&s=32e8007a73a76c4212001db0765043f2" alt="The Movie Database(TMDB) API request API key" width="820" height="380" data-path="api-reference/images/tmdb_request_key.jpeg" />
    </Accordion>
  </Step>

  <Step title="Select the developer option (suitable for starters or non-profit use)">
    <Accordion title="Click to view image">
      <img src="https://mintcdn.com/emiloju/MfS4U38wS5GVTiAi/api-reference/images/tmdb_sel_dev.jpeg?fit=max&auto=format&n=MfS4U38wS5GVTiAi&q=85&s=62ec429ee07741ac1d9b2f65205d76f7" alt="The Movie Database(TMDB) API plans" width="1083" height="276" data-path="api-reference/images/tmdb_sel_dev.jpeg" />
    </Accordion>
  </Step>

  <Step title="Agree to the Terms of service">
    <Accordion title="Click to view image">
      <img src="https://mintcdn.com/emiloju/MfS4U38wS5GVTiAi/api-reference/images/terms_of_service.png?fit=max&auto=format&n=MfS4U38wS5GVTiAi&q=85&s=6b7193f7220e0206acca9fd30fa4b9db" alt="The Movie Database(TMDB) terms of service" width="1046" height="242" data-path="api-reference/images/terms_of_service.png" />
    </Accordion>
  </Step>

  <Step title="Fill in the application form on the new page (you can use any of your social links as the website URL)" />
</Steps>

After submitting the application, you can access both your API key and Bearer token as seen below:

<Accordion title="Click to view image">
  <img src="https://mintcdn.com/emiloju/MfS4U38wS5GVTiAi/api-reference/images/tmdb_final.jpeg?fit=max&auto=format&n=MfS4U38wS5GVTiAi&q=85&s=1a8d2b47af8962c62853699c444c012d" alt="The Movie Database(TMDB) API application form" width="1031" height="380" data-path="api-reference/images/tmdb_final.jpeg" />
</Accordion>
