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

# How to generate Session ID

> These endpoints are used for securing access to TMDB API and user accounts.

To be authenticated, follow these steps:

### 1. Create a new request token

This endpoint is used to generate a request token. It can be used to validate a TMDB user login.

```bash theme={null}
GET https://api.themoviedb.org/3/authentication/token/new?api_key=YOUR_API_KEY

```

> [!NOTE]
>
> * A temporary request token is generated.
> * The token is valid for 60 minutes.
> * This token must be authenticated by the user in the next step.

### 2. Authenticate the request token

Before creating your session, you must authenticate your token.

```url theme={null}
https://www.themoviedb.org/authenticate/your_request_token
```

Or, if you want to redirect the user back to your app after authentication:

```url theme={null}
https://www.themoviedb.org/authenticate/{REQUEST_TOKEN}?redirect_to=http://www.yourapp.com/approved

```

> [!NOTE]
>
> * The user will be asked to approve or deny the token.
> * If approved, the token is now authenticated and can be used to create a session.

### 3. Create a new session id

Once the request token is authenticated, exchange it for a session ID.

```bash theme={null}
POST https://api.themoviedb.org/3/authentication/session/new?api_key=YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"request_token": "YOUR_REQUEST_TOKEN"}'
```

Response

```
{
  "success": true,
  "session_id": "xyz987654321"
}
```

> [!NOTE]
>
> You should treat this key like a password and keep it secret.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.