Session Managment With Rest

Manage sessions with REST APIs for interactive avatar control. This guide covers session creation, control, and automatic termination.

1. Create Session

To begin a session:

  1. Use Your API Key:

    • Make an API request to create a session using your API key.

    • Response: The API will return a session token, which is essential for managing the session.

Example Request:

codePOST /api/session
Authorization: Bearer YOUR_API_KEY

Example Response:

{
  "sessionToken": "your-session-token"
}

2. Sending the Session Token to Frontend

Once you have the session token:

  • Transmit the Session Token: Send the session token to your frontend application.

  • Integrate with Web SDK: The frontend will use this token with the Web SDK to interact with the session.

3. Sending the Session Token to Frontend

To control the avatar’s speech or actions:

  1. Send Commands via API:

    • Use the session token to issue commands, like making the avatar speak.

    • The avatar will respond only when the session is active.

Example Request:

Example Response:

4. Terminating the session

To end a session:

  1. Automatic Termination:

    • Sessions are automatically terminated after a specified period of inactivity (set by your configuration).

  2. Manual Termination:

    • You can manually terminate a session using the API.

    Example Request:

    Example Response:

Last updated