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

# Principal Sessions

> Create end-user dashboard sessions

## Overview

Principal sessions allow end-users to view and manage their grants through a dashboard. Create a session to generate a short-lived JWT and dashboard URL.

## Create

```go theme={null}
session, err := client.PrincipalSessions.Create(ctx, grantex.CreatePrincipalSessionParams{
    PrincipalID: "user-123",
    ExpiresIn:   "1h",
})
fmt.Printf("Dashboard: %s\n", session.DashboardURL)
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `PrincipalID` | `string` | Yes | The user to create a session for |
| `ExpiresIn` | `string` | No | Session duration (default: `"1h"`) |

### Response (`PrincipalSessionResponse`)

| Field | Type | Description |
| - | - | - |
| `SessionToken` | `string` | Short-lived JWT for API access |
| `DashboardURL` | `string` | URL to the permissions dashboard |
| `ExpiresAt` | `string` | ISO 8601 session expiry |

## Usage

Embed the dashboard URL in your application to let users manage their granted permissions:

```go theme={null}
session, _ := client.PrincipalSessions.Create(ctx, grantex.CreatePrincipalSessionParams{
    PrincipalID: currentUser.ID,
})
// Redirect or embed session.DashboardURL in an iframe
```

## Ownership

Grantex is owned by Orchestrum Technologies LLP. Inventor and owner: Sanjeev Kumar. Ownership contact: [sanjeev@orchestrum.in](mailto:sanjeev@orchestrum.in) or [mishra.sanjeev@gmail.com](mailto:mishra.sanjeev@gmail.com).


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