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

# Create Public Session

> Create a session for a public assistant without authentication

<Note>
  **Beta Feature**: This endpoint is currently in beta. Features and specifications may change.
</Note>

<Info>
  This endpoint does not require authentication and can be called directly from client applications. The assistant must have `public: true` to use this endpoint.
</Info>

<ParamField path="realtimeAssistantId" type="string" required>
  The unique identifier of the public assistant
</ParamField>

<ParamField body="participantName" type="string" required>
  Display name for the user participant
</ParamField>

<ParamField body="roomName" type="string">
  Optional custom room name. If not provided, a unique room name will be generated
</ParamField>

<RequestExample>
  ```bash Example Request theme={null}
  curl -X POST https://api.upliftai.org/v1/realtime-assistants/550e8400-e29b-41d4-a716-446655440000/createPublicSession \
    -H "Content-Type: application/json" \
    -d '{
      "participantName": "Guest User"
    }'
  ```

  ```javascript JavaScript (Frontend) theme={null}
  // Can be called directly from frontend for public assistants
  const assistantId = '550e8400-e29b-41d4-a716-446655440000';

  const response = await fetch(
    `https://api.upliftai.org/v1/realtime-assistants/${assistantId}/createPublicSession`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        participantName: 'Guest User',
      })
    }
  );

  if (!response.ok) {
    if (response.status === 403) {
      throw new Error('This assistant is not public');
    }
    if (response.status === 404) {
      throw new Error('Assistant not found');
    }
    throw new Error('Failed to create session');
  }

  const sessionData = await response.json();
  ```

  ```jsx React Example theme={null}
  import { useState } from 'react';
  import { UpliftAIRoom } from '@upliftai/assistants-react';

  function PublicAssistantDemo() {
    const [sessionData, setSessionData] = useState(null);
    const [loading, setLoading] = useState(false);
    
    const connectToAssistant = async () => {
      setLoading(true);
      try {
        const response = await fetch(
          'https://api.upliftai.org/v1/realtime-assistants/YOUR_PUBLIC_ASSISTANT_ID/createPublicSession',
          {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({
              participantName: 'Demo User'
            })
          }
        );
        
        const data = await response.json();
        setSessionData(data);
      } catch (error) {
        console.error('Failed to connect:', error);
      } finally {
        setLoading(false);
      }
    };
    
    if (!sessionData) {
      return (
        <button onClick={connectToAssistant} disabled={loading}>
          {loading ? 'Connecting...' : 'Connect to Assistant'}
        </button>
      );
    }
    
    return (
      <UpliftAIRoom
        token={sessionData.token}
        serverUrl={sessionData.wsUrl}
        connect={true}
        audio={true}
      >
        <YourAssistantUI />
      </UpliftAIRoom>
    );
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDU0MTAwMDAsImlzcyI6IkFQSWFiY2RlZiIsImp0aSI6Imd1ZXN0XzEyMyIsIm5hbWUiOiJHdWVzdCBVc2VyIiwicm9vbSI6InB1YmxpYy1hYmMxMjMiLCJzdWIiOiJndWVzdF8xMjMiLCJ2aWRlbyI6eyJyb29tIjoiam9pbiIsInJvb21BZG1pbiI6ZmFsc2UsInJvb21DcmVhdGUiOmZhbHNlLCJyb29tSm9pbiI6dHJ1ZSwicm9vbUxpc3QiOmZhbHNlfX0.signature",
    "wsUrl": "wss://upliftai-livekit-url...",
    "roomName": "public-abc123-1705406400"
  }
  ```
</ResponseExample>

## Use Cases

Public sessions are ideal for:

* **Product Demos** - Let users try your assistant without signup
* **Landing Pages** - Showcase capabilities to visitors
* **Kiosks** - Public-facing voice interfaces
* **Testing** - Easy testing during development

## Security Considerations

<Warning>
  Public assistants are accessible to anyone with the assistant ID. Ensure you:

  * Don't include sensitive information in instructions
  * Implement rate limiting if needed
  * Monitor usage for abuse
  * Use secure tool implementations
</Warning>

## Limitations

Public sessions have the following limitations:

* Cannot access private user data
* Limited to publicly safe operations
* May have usage quotas applied
* Session data is not persisted

## Making an Assistant Public

To enable public access for an assistant:

```javascript theme={null}
// Update existing assistant
await fetch(`https://api.upliftai.org/v1/realtime-assistants/${assistantId}`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    public: true
  })
});
```

## Related Endpoints

* [Create Session](/assistants/api-reference/create-session) - For authenticated sessions
* [Create Adhoc Session](/assistants/api-reference/create-adhoc-session) - For temporary configurations
