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

# Realtime media session (web)

> Opens a short-lived full-duplex media session on an active call. Body: { mode: "talk" | "listen" } — talk sends YOUR audio and receives the peer's; listen only receives. Returns { wsUrl, token, expiresInSeconds }: connect a WebSocket to wsUrl and exchange RAW binary PCM16 little-endian audio frames (plain WebSocket transport, NOT WebRTC; single-use token, ~2 min). Web numbers ONLY — Meta → 400 FEATURE_NOT_SUPPORTED.

**Requires a number-scoped key.**



## OpenAPI

````yaml openapi.json POST /v1/calls/{callId}/realtime-session
openapi: 3.1.0
info:
  title: Pilot Status API
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    Public REST API for Pilot Status. Authenticate with the `x-api-key: ps_...`
    header (or `x-api-key-id`). Base URL: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/calls/{callId}/realtime-session:
    post:
      tags:
        - Calls
      summary: Realtime media session (web)
      description: >-
        Opens a short-lived full-duplex media session on an active call. Body: {
        mode: "talk" | "listen" } — talk sends YOUR audio and receives the
        peer's; listen only receives. Returns { wsUrl, token, expiresInSeconds
        }: connect a WebSocket to wsUrl and exchange RAW binary PCM16
        little-endian audio frames (plain WebSocket transport, NOT WebRTC;
        single-use token, ~2 min). Web numbers ONLY — Meta → 400
        FEATURE_NOT_SUPPORTED.


        **Requires a number-scoped key.**
      operationId: post_calls_callId_realtime-session
      parameters:
        - name: callId
          in: path
          required: true
          description: Pilot Status id (call_...) or provider call id (CallID).
          schema:
            type: string
          example: call_01HZX...
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                mode:
                  type: string
                  description: talk = send and receive audio; listen = receive only.
                  example: talk
              required:
                - mode
            example:
              mode: talk
      responses:
        '200':
          description: Open realtime session
          content:
            application/json:
              example:
                wsUrl: >-
                  wss://evolution-go.pilotstatus.com.br/call/media/realtime/ws/inst1/1A2B3C4D?token=...
                token: d3f4...
                expiresInSeconds: 120
        '400':
          description: Invalid payload or parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Validation error
        '401':
          description: Missing or invalid `x-api-key` / `x-api-key-id` header
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '403':
          description: Tenant-scoped key used on a number-scoped endpoint
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Tenant-scoped keys cannot call number endpoints
                code: TENANT_SCOPE_NOT_ALLOWED
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Too many requests
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your ps_ API key
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: API key id (alternative to x-api-key)

````