[youtubei.js](../README.md) / SessionOptions

# Type Alias: SessionOptions

> **SessionOptions**: `object`

## Type declaration

### account\_index?

> `optional` **account\_index**: `number`

The account index to use. This is useful if you have multiple accounts logged in.

**NOTE:** Only works if you are signed in with cookies.

### cache?

> `optional` **cache**: [`ICache`](../namespaces/Types/interfaces/ICache.md)

Used to cache algorithms, session data, and OAuth2 tokens.

### client\_type?

> `optional` **client\_type**: [`ClientType`](../enumerations/ClientType.md)

InnerTube client type.

### cookie?

> `optional` **cookie**: `string`

YouTube cookies.

### device\_category?

> `optional` **device\_category**: [`DeviceCategory`](../namespaces/Utils/type-aliases/DeviceCategory.md)

Platform to use for the session.

### enable\_safety\_mode?

> `optional` **enable\_safety\_mode**: `boolean`

Specifies whether to enable safety mode. This will prevent the session from loading any potentially unsafe content.

### enable\_session\_cache?

> `optional` **enable\_session\_cache**: `boolean`

Specifies whether the session data should be cached.

### fetch?

> `optional` **fetch**: [`FetchFunction`](../namespaces/Types/type-aliases/FetchFunction.md)

Fetch function to use.

### generate\_session\_locally?

> `optional` **generate\_session\_locally**: `boolean`

Specifies whether to generate the session data locally or retrieve it from YouTube.
This can be useful if you need more performance.

**NOTE:** If you are using the cache option and a session has already been generated, this will be ignored.
If you want to force a new session to be generated, you must clear the cache or disable session caching.

### lang?

> `optional` **lang**: `string`

Language.

### location?

> `optional` **location**: `string`

Geolocation.

### on\_behalf\_of\_user?

> `optional` **on\_behalf\_of\_user**: `string`

Specify the Page ID of the YouTube profile/channel to use, if the logged-in account has multiple profiles.

### po\_token?

> `optional` **po\_token**: `string`

Proof of Origin Token. This is an attestation token generated by BotGuard/DroidGuard. It is used to confirm that the request is coming from a genuine client.

### retrieve\_player?

> `optional` **retrieve\_player**: `boolean`

Specifies whether to retrieve the JS player. Disabling this will make session creation faster.

**NOTE:** Deciphering formats is not possible without the JS player.

### timezone?

> `optional` **timezone**: `string`

The time zone.

### visitor\_data?

> `optional` **visitor\_data**: `string`

Setting this to a valid and persistent visitor data string will allow YouTube to give this session tailored content even when not logged in.
A good way to get a valid one is by either grabbing it from a browser or calling InnerTube's `/visitor_id` endpoint.

## Defined in

[src/core/Session.ts:111](https://github.com/LuanRT/YouTube.js/blob/4729016fb98e7045ee4043857be7eef780c01e35/src/core/Session.ts#L111)
