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

# Exchange Session SDP

> Exchange WebRTC Session Description Protocol (SDP) to establish a peer connection.

## How It Works

1. Client generates an SDP offer using WebRTC APIs
2. Send the offer to this endpoint
3. Receive the server's SDP answer
4. Use the answer to complete the WebRTC connection

## Request Format

The `client_sdp` object must contain:
- `type`: Must be `"offer"`
- `sdp`: The SDP string from your WebRTC offer

## Example

Select **"ExchangeSessionRequest"** from the **Examples** dropdown to see the request format.




## OpenAPI

````yaml /specs/openapi-interactive.json post /api/v1/session/{session_id}/exchange/
openapi: 3.0.3
info:
  title: Perso Interactive API
  version: 0.0.0
servers:
  - url: https://platform.perso.ai
security: []
tags:
  - name: Embed
paths:
  /api/v1/session/{session_id}/exchange/:
    post:
      tags:
        - Session Lifecycle
      summary: Exchange Session SDP
      description: >
        Exchange WebRTC Session Description Protocol (SDP) to establish a peer
        connection.


        ## How It Works


        1. Client generates an SDP offer using WebRTC APIs

        2. Send the offer to this endpoint

        3. Receive the server's SDP answer

        4. Use the answer to complete the WebRTC connection


        ## Request Format


        The `client_sdp` object must contain:

        - `type`: Must be `"offer"`

        - `sdp`: The SDP string from your WebRTC offer


        ## Example


        Select **"ExchangeSessionRequest"** from the **Examples** dropdown to
        see the request format.
      operationId: v1_session_exchange_create
      parameters:
        - in: path
          name: session_id
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SessionExchangeRequest'
            examples:
              ExchangeSessionRequest:
                value:
                  client_sdp:
                    type: offer
                    sdp: v=0\r\n...
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/SessionExchangeRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/SessionExchangeRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionExchange'
          description: ''
        '400':
          description: Bad Request - Invalid input data or parameters.
        '401':
          description: Unauthorized - Invalid or missing authentication credentials.
        '403':
          description: Forbidden - You do not have permission to perform this action.
        '404':
          description: Not Found - The requested resource could not be found.
        '405':
          description: Method Not Allowed - Invalid HTTP method
        '406':
          description: Not Acceptable - Invalid request accept headers
        '415':
          description: Unsupported Media Type - Invalid content type
        '500':
          description: Internal Server Error - An unexpected error occurred.
      security:
        - {}
components:
  schemas:
    SessionExchangeRequest:
      type: object
      properties:
        client_sdp:
          description: >-
            WebRTC SDP offer produced by the client; the server responds with
            `server_sdp`.
      required:
        - client_sdp
    SessionExchange:
      type: object
      properties:
        client_sdp:
          description: >-
            WebRTC SDP offer produced by the client; the server responds with
            `server_sdp`.
        server_sdp:
          nullable: true
          readOnly: true
      required:
        - client_sdp
        - server_sdp

````