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

# Use a session

> Enable a session on-chain, transact with it, and disable it.

## Installing sessions

To enable a session:

```ts theme={null}
import { enableSession } from '@rhinestone/sdk/actions/smart-sessions'

const sessions = [session]
const sessionDetails =
  await rhinestoneAccount.getSessionDetails(sessions)
const enableSignature =
  await rhinestoneAccount.signEnableSession(sessionDetails)
const sessionIndex = 0

const transaction = await rhinestoneAccount.prepareTransaction({
  chain,
  calls: [
    enableSession(
      session,
      enableSignature,
      sessionDetails.hashesAndChainIds,
      sessionIndex,
    ),
  ],
})
```

You can also enable a session with a signature. See [Multi-chain session](./multi-chain-session) for more details.

## Checking session status

To check if a session is enabled:

```ts theme={null}
const isEnabled = await rhinestoneAccount.isSessionEnabled(session)
```

## Using sessions

To authorize a transaction with a session key you've enabled before:

```ts {13-16} theme={null}
const prepared = await rhinestoneAccount.prepareTransaction({
  chain,
  calls: [
    {
      to: usdcAddress,
      data: encodeFunctionData({
        abi: erc20Abi,
        functionName: 'transfer',
        args: ['0xd8da6bf26964af9d7eed9e03e53415d37aa96045', 1n],
      }),
    },
  ],
  signers: {
    type: 'session',
    session,
  },
})
const signed = await rhinestoneAccount.signTransaction(prepared)
const transactionResult = await rhinestoneAccount.submitTransaction(signed)
```

This will prompt the signature request from the session owner(s) and submit the transaction on their behalf.

<Note>You can also enable and use the smart session in one transaction using the ["enable mode"](./multi-chain-session).</Note>

## Disabling a session

To disable a single enabled session, use `disableSession`. This only removes a single session: to uninstall the validator entirely (and every session with it), use [`disable`](./create-a-session#installing-the-validation) instead.

```ts theme={null}
import { disableSession } from '@rhinestone/sdk/actions/smart-sessions'

const transaction = await rhinestoneAccount.prepareTransaction({
  chain,
  calls: [disableSession(session)],
})
```
