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

# Create a session

> Install the Smart Sessions validator and define a scoped session key.

## Installing the validation

You can install the validator during account deployment:

```ts {6-8} theme={null}
const rhinestoneAccount = await rhinestone.createAccount({
  owners: {
    type: 'ecdsa',
    accounts: [ownerAccount],
  },
  sessions: {
    enabled: true,
  },
})
```

You can also install it when the account is already deployed:

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

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

To uninstall the validator:

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

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

## Creating sessions

To create a session, use `RhinestoneSDK.createSession`:

```ts theme={null}
const session = await rhinestone.createSession({
  chain: base,
  owners: {
    type: 'ecdsa',
    accounts: [sessionOwnerAccount],
  },
})
```

You can also limit the session to specific allowed permissions:

```ts {7-13} theme={null}
const session = await rhinestone.createSession({
  chain: base,
  owners: {
    type: 'ecdsa',
    accounts: [sessionOwnerAccount],
  },
  permissions: [
    {
      abi: erc20Abi,
      address: usdcAddress,
      functions: { transfer: {} },
    },
  ],
})
```

Finally, you can constrain function parameters. The SDK derives the selector and parameter offsets from the ABI, so you reference parameters by name:

```ts {11-20} theme={null}
const session = await rhinestone.createSession({
  chain: base,
  owners: {
    type: 'ecdsa',
    accounts: [sessionOwnerAccount],
  },
  permissions: [
    {
      abi: erc20Abi,
      address: usdcAddress,
      functions: {
        transfer: {
          params: {
            recipient: {
              condition: 'equal',
              value: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
            },
          },
        },
      },
    },
  ],
})
```

See the [Call policy](../policies/call) for the full set of parameter conditions, and [Restrict a session](./restrict-a-session) to make the listed permissions the only calls the session can run.

## Next steps

<CardGroup cols={2}>
  <Card title="Use a session" href="/smart-wallet/smart-sessions/guides/use-a-session">
    Enable the session on-chain and transact with it.
  </Card>

  <Card title="Session signing" href="/smart-wallet/smart-sessions/guides/session-signing">
    Decide what the session key may sign off-chain.
  </Card>
</CardGroup>
