---
components:
  responses: {}
  schemas:
    PeerRefreshTokenResponse:
      description: Response containing new peer token
      properties:
        data:
          properties:
            token:
              $ref: "#/components/schemas/AuthToken"
          required:
            - token
          type: object
      required:
        - data
      title: PeerRefreshTokenResponse
      type: object
    PeerOptionsAgent:
      additionalProperties: false
      description: Options specific to the Agent peer
      properties:
        output:
          $ref: "#/components/schemas/AgentOutput"
        subscribeMode:
          $ref: "#/components/schemas/SubscribeMode"
      title: PeerOptionsAgent
      type: object
    RoomDetailsResponse:
      description: Response containing room details
      properties:
        data:
          $ref: "#/components/schemas/Room"
      required:
        - data
      title: RoomDetailsResponse
      type: object
    RoomCreateDetailsResponse:
      description: Response containing room details
      properties:
        data:
          properties:
            room:
              $ref: "#/components/schemas/Room"
          required:
            - room
          type: object
      required:
        - data
      title: RoomCreateDetailsResponse
      type: object
    Room:
      description: State of a room
      properties:
        compositionInfo:
          $ref: "#/components/schemas/CompositionInfo"
        config:
          $ref: "#/components/schemas/RoomConfig"
        id:
          description: Room ID
          example: room-1
          type: string
        peers:
          description: List of all peers
          items:
            $ref: "#/components/schemas/Peer"
          type: array
      required:
        - id
        - config
        - peers
      title: Room
      type: object
    TrackID:
      description: Assigned track id
      example: 8dbd2e6b-a1e7-4670-95a2-0262aa6c6321
      title: TrackID
      type: string
    PeerType:
      description: Peer type
      enum:
        - webrtc
        - agent
        - vapi
      example: webrtc
      title: PeerType
      type: string
    RecordingSource:
      description: The source for the recording
      oneOf:
        - $ref: "#/components/schemas/CompositionSource"
      title: RecordingSource
      type: object
    PeerConfigWebRTC:
      additionalProperties: false
      description: Configuration of a webrtc peer
      properties:
        options:
          $ref: "#/components/schemas/PeerOptionsWebRTC"
        type:
          description: Peer type
          enum:
            - webrtc
          type: string
      required:
        - type
        - options
      title: PeerConfigWebRTC
      type: object
    MoqAccess:
      description: Connection details for a MoQ relay client
      properties:
        connection_url:
          description: Relay connection URL with the JWT embedded as a `?jwt=` query parameter. Pass directly to a MoQ client SDK.
          example: https://relay.fishjam.io/abc123?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
          type: string
        token:
          description: JWT authorizing the MoQ relay connection, also embedded in `connection_url`
          example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb290IjoiZmlzaGphbSIsInB1dCI6WyJteS1zdHJlYW0iXSwiZ2V0IjpbXSwiaWF0IjoxNzEzMzYwMDAwLCJleHAiOjE3MTMzNjM2MDB9.abc123
          type: string
      required:
        - connection_url
        - token
      title: MoqAccess
      type: object
    SubscribeMode:
      default: auto
      description: Configuration of peer's subscribing policy
      enum:
        - auto
        - manual
      nullable: false
      title: SubscribeMode
      type: string
    StreamConfig:
      additionalProperties: false
      description: Stream configuration
      properties:
        audioOnly:
          default: false
          description: Restrics stream to audio only
          nullable: true
          type: boolean
        batchWebhookNotifications:
          default: false
          description: If true, webhook notifications for this stream are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected.
          nullable: false
          type: boolean
        public:
          default: false
          description: True if livestream viewers can omit specifying a token.
          nullable: false
          type: boolean
        webhookUrl:
          deprecated: true
          description: "Deprecated: configure the webhook in the Dashboard instead. Webhook URL for receiving server notifications; overrides the Dashboard-configured webhook URL"
          nullable: true
          pattern: ^https?://[^/]+/.*$
          type: string
      title: StreamConfig
      type: object
    Error:
      description: Error message
      properties:
        errors:
          description: Error details
          example: Token has expired
          type: string
      required:
        - errors
      title: Error
      type: object
    PeerID:
      description: Assigned peer id
      example: 4a1c1164-5fb7-425d-89d7-24cdb8fff1cf
      title: PeerID
      type: string
    PeerDetailsResponse:
      description: Response containing peer details and their token
      properties:
        data:
          properties:
            peer:
              $ref: "#/components/schemas/Peer"
            peer_websocket_url:
              $ref: "#/components/schemas/WebsocketURL"
            token:
              $ref: "#/components/schemas/AuthToken"
          required:
            - peer
            - token
          type: object
      required:
        - data
      title: PeerDetailsResponse
      type: object
    StreamerDetailsResponse:
      description: Response containing streamer details
      properties:
        data:
          $ref: "#/components/schemas/Streamer"
      required:
        - data
      title: StreamerDetailsResponse
      type: object
    AuthToken:
      description: Token for authorizing websocket connection
      example: 5cdac726-57a3-4ecb-b1d5-72a3d62ec242
      title: AuthToken
      type: string
    AudioSampleRate:
      default: 16000
      description: The sample rate of the output audio
      enum:
        - 16000
        - 24000
      example: 16000
      title: AudioSampleRate
      type: integer
    PeerStatus:
      description: Informs about the peer status
      enum:
        - connected
        - disconnected
      example: disconnected
      title: PeerStatus
      type: string
    StreamsListingResponse:
      description: Response containing list of all streams
      properties:
        data:
          items:
            $ref: "#/components/schemas/Stream"
          type: array
      required:
        - data
      title: StreamsListingResponse
      type: object
    CompositionSource:
      description: Recording source coming from composition
      properties:
        compositionURL:
          description: URL of the composition to record
          maxLength: 255
          nullable: false
          pattern: ^https?://[^/]+/.*$
          type: string
        outputId:
          description: Id of the output being recorded
          maxLength: 255
          nullable: false
          type: string
        scaleRatio:
          default: 1
          description: Scale factor for the recording relative to the source output (>0; may upscale or downscale). Defaults to 1.
          exclusiveMinimum: true
          minimum: 0
          type: number
      required:
        - compositionURL
        - outputId
      title: CompositionSource
      type: object
    RecordingStatus:
      description: Lifecycle status of a recording
      enum:
        - active
        - available
        - failed
      title: RecordingStatus
      type: string
    Streamer:
      description: Describes streamer status
      properties:
        id:
          description: Assigned streamer id
          type: string
        status:
          description: Streamer connection status
          enum:
            - connected
            - disconnected
          type: string
        token:
          description: Token streamer should authorize with
          example: 5cdac726-57a3-4ecb-b1d5-72a3d62ec242
          type: string
      required:
        - id
        - status
        - token
      title: Streamer
      type: object
    PeerConfigAgent:
      additionalProperties: false
      description: Configuration of an agent peer
      properties:
        options:
          $ref: "#/components/schemas/PeerOptionsAgent"
        type:
          description: Peer type
          enum:
            - agent
          type: string
      required:
        - type
        - options
      title: PeerConfigAgent
      type: object
    VideoCodec:
      default: h264
      description: Enforces video codec for each peer in the room
      enum:
        - h264
        - vp8
      title: VideoCodec
      type: string
    ViewerDetailsResponse:
      description: Response containing viewer details
      properties:
        data:
          $ref: "#/components/schemas/Viewer"
      required:
        - data
      title: ViewerDetailsResponse
      type: object
    TrackForwardingInfo:
      description: Information about a track forwarding for a specific peer
      properties:
        audioTrackId:
          description: ID of the forwarded audio track
          example: track-audio-1
          nullable: true
          type: string
        inputId:
          description: Input ID used by the composition
          example: input-1
          type: string
        peerId:
          description: Peer ID
          example: peer-1
          type: string
        videoTrackId:
          description: ID of the forwarded video track
          example: track-video-1
          nullable: true
          type: string
      required:
        - peerId
        - inputId
      title: TrackForwardingInfo
      type: object
    RoomType:
      default: conference
      description: The use-case of the room. If not provided, this defaults to conference.
      enum:
        - full_feature
        - audio_only
        - broadcaster
        - livestream
        - conference
        - audio_only_livestream
      nullable: false
      title: RoomType
      type: string
    MoqAccessConfig:
      additionalProperties: false
      description: MoQ access configuration
      properties:
        publishPath:
          description: Path under the root the token grants publish access to
          example: my-stream
          nullable: true
          type: string
        subscribePath:
          description: Path under the root the token grants subscribe access to
          example: my-stream
          nullable: true
          type: string
      title: MoqAccessConfig
      type: object
    PeerConfig:
      description: Peer configuration
      discriminator:
        mapping:
          agent: "#/components/schemas/PeerConfigAgent"
          vapi: "#/components/schemas/PeerConfigVAPI"
          webrtc: "#/components/schemas/PeerConfigWebRTC"
        propertyName: type
      oneOf:
        - $ref: "#/components/schemas/PeerConfigWebRTC"
        - $ref: "#/components/schemas/PeerConfigAgent"
        - $ref: "#/components/schemas/PeerConfigVAPI"
      title: PeerConfig
      type: object
    TrackMetadata:
      description: Metadata attached to the track by the peer
      example:
        source: camera
      nullable: true
      title: TrackMetadata
      type: object
    TrackForwarding:
      additionalProperties: false
      description: Track forwardings for a room
      properties:
        compositionURL:
          description: URL for the composition
          nullable: false
          pattern: ^https?://[^/]+/.*$
          type: string
        selector:
          default: all
          description: Selects tracks that should be forwarded, currently only "all" is supported
          nullable: false
          pattern: ^all$
          type: string
      required:
        - compositionURL
      title: TrackForwarding
      type: object
    PeerConfigVAPI:
      additionalProperties: false
      description: Configuration of a VAPI peer
      properties:
        options:
          $ref: "#/components/schemas/PeerOptionsVapi"
        type:
          description: Peer type
          enum:
            - vapi
          type: string
      required:
        - type
        - options
      title: PeerConfigVAPI
      type: object
    Subscriptions:
      description: Describes peer's subscriptions in manual mode
      properties:
        peers:
          description: List of peer IDs this peer subscribes to
          items:
            $ref: "#/components/schemas/PeerID"
          type: array
        tracks:
          description: List of track IDs this peer subscribes to
          items:
            $ref: "#/components/schemas/TrackID"
          type: array
      required:
        - peers
        - tracks
      title: Subscriptions
      type: object
    RecordingConfig:
      additionalProperties: false
      description: Recording configuration
      properties:
        metadata:
          additionalProperties: true
          description: Free-form, user-supplied metadata used to organize and filter recordings
          nullable: true
          type: object
        source:
          $ref: "#/components/schemas/RecordingSource"
      required:
        - source
      title: RecordingConfig
      type: object
    WebsocketURL:
      description: Websocket URL to which peer has to connect
      example: www.fishjam.org/socket/peer
      title: WebsocketURL
      type: string
    ViewerToken:
      description: Viewer authorization token
      properties:
        token:
          description: Token viewer should authorize with
          example: 5cdac726-57a3-4ecb-b1d5-72a3d62ec242
          type: string
      required:
        - token
      title: ViewerToken
      type: object
    Viewer:
      description: Describes viewer status
      properties:
        id:
          description: Assigned viewer id
          type: string
        token:
          description: Token viewer should authorize with
          example: 5cdac726-57a3-4ecb-b1d5-72a3d62ec242
          type: string
      required:
        - id
        - token
      title: Viewer
      type: object
    WebRTCMetadata:
      additionalProperties: true
      description: Custom peer metadata
      title: WebRTCMetadata
      type: object
    RoomConfig:
      additionalProperties: false
      description: Room configuration
      properties:
        batchWebhookNotifications:
          default: false
          description: If true, webhook notifications for this room are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected.
          nullable: false
          type: boolean
        maxPeers:
          description: Maximum amount of peers allowed into the room
          example: 10
          minimum: 0
          nullable: true
          type: integer
        public:
          default: false
          description: True if livestream viewers can omit specifying a token.
          nullable: false
          type: boolean
        roomType:
          $ref: "#/components/schemas/RoomType"
        videoCodec:
          $ref: "#/components/schemas/VideoCodec"
        webhookUrl:
          deprecated: true
          description: "Deprecated: configure the webhook in the Dashboard instead. URL where Fishjam notifications will be sent; overrides the Dashboard-configured webhook URL"
          example: https://backend.address.com/fishjam-notifications-endpoint
          nullable: true
          pattern: ^https?://[^/]+/.*$
          type: string
      title: RoomConfig
      type: object
    PeerMetadata:
      description: Custom metadata set by the peer
      example:
        name: FishjamUser
      nullable: true
      title: PeerMetadata
      type: object
    Peer:
      description: Describes peer status
      properties:
        id:
          $ref: "#/components/schemas/PeerID"
        metadata:
          $ref: "#/components/schemas/PeerMetadata"
        status:
          $ref: "#/components/schemas/PeerStatus"
        subscribeMode:
          $ref: "#/components/schemas/SubscribeMode"
        subscriptions:
          $ref: "#/components/schemas/Subscriptions"
        tracks:
          description: List of all peer's tracks
          items:
            $ref: "#/components/schemas/Track"
          type: array
        type:
          $ref: "#/components/schemas/PeerType"
      required:
        - id
        - type
        - status
        - tracks
        - metadata
        - subscribeMode
        - subscriptions
      title: Peer
      type: object
    CompositionInfo:
      description: Composition and track forwarding state for the room
      nullable: true
      properties:
        compositionUrl:
          description: URL of the active composition
          example: https://rtc.fishjam.io/api/composition/12asdfxcf
          type: string
        forwardings:
          description: List of active track forwardings
          items:
            $ref: "#/components/schemas/TrackForwardingInfo"
          type: array
      required:
        - compositionUrl
        - forwardings
      title: CompositionInfo
      type: object
    TrackType:
      description: Media type carried by the track
      enum:
        - audio
        - video
      title: TrackType
      type: string
    PeerOptionsVapi:
      additionalProperties: false
      description: Options specific to the VAPI peer
      properties:
        apiKey:
          description: VAPI API key
          type: string
        callId:
          description: VAPI call ID
          pattern: ^[a-zA-Z0-9-]+$
          type: string
        subscribeMode:
          $ref: "#/components/schemas/SubscribeMode"
      required:
        - apiKey
        - callId
      title: PeerOptionsVapi
      type: object
    StreamDetailsResponse:
      description: Response containing stream details
      properties:
        data:
          $ref: "#/components/schemas/Stream"
      required:
        - data
      title: StreamDetailsResponse
      type: object
    PeerOptionsWebRTC:
      additionalProperties: false
      description: Options specific to the WebRTC peer
      properties:
        metadata:
          $ref: "#/components/schemas/WebRTCMetadata"
        subscribeMode:
          $ref: "#/components/schemas/SubscribeMode"
      title: PeerOptionsWebRTC
      type: object
    RoomsListingResponse:
      description: Response containing list of all rooms
      properties:
        data:
          items:
            $ref: "#/components/schemas/Room"
          type: array
      required:
        - data
      title: RoomsListingResponse
      type: object
    Stream:
      description: State of a stream
      properties:
        audioOnly:
          description: True if stream is restricted to audio only
          type: boolean
        id:
          description: Assigned stream id
          type: string
        public:
          description: True if livestream viewers can omit specifying a token.
          type: boolean
        streamers:
          description: List of all streamers
          items:
            $ref: "#/components/schemas/Streamer"
          type: array
        viewers:
          description: List of all viewers
          items:
            $ref: "#/components/schemas/Viewer"
          type: array
      required:
        - id
        - public
        - viewers
        - streamers
      title: Stream
      type: object
    RecordingDetailsResponse:
      description: Response containing recording details
      properties:
        data:
          $ref: "#/components/schemas/Recording"
      required:
        - data
      title: RecordingDetailsResponse
      type: object
    Recording:
      description: A recording and its current lifecycle status
      properties:
        id:
          description: Assigned recording id
          type: string
        metadata:
          additionalProperties: true
          description: Free-form, user-supplied metadata used to organize and filter recordings
          nullable: true
          type: object
        source:
          $ref: "#/components/schemas/RecordingSource"
        status:
          $ref: "#/components/schemas/RecordingStatus"
      required:
        - id
        - source
        - status
      title: Recording
      type: object
    StreamerToken:
      description: Streamer authorization token
      properties:
        token:
          description: Token streamer should authorize with
          example: 5cdac726-57a3-4ecb-b1d5-72a3d62ec242
          type: string
      required:
        - token
      title: StreamerToken
      type: object
    Track:
      description: Media track of a Peer
      properties:
        id:
          $ref: "#/components/schemas/TrackID"
        metadata:
          $ref: "#/components/schemas/TrackMetadata"
        type:
          $ref: "#/components/schemas/TrackType"
      title: Track
      type: object
    AgentOutput:
      additionalProperties: false
      description: Output audio options
      properties:
        audioFormat:
          $ref: "#/components/schemas/AudioFormat"
        audioSampleRate:
          $ref: "#/components/schemas/AudioSampleRate"
      title: AgentOutput
      type: object
    AudioFormat:
      default: pcm16
      description: The format of the output audio
      enum:
        - pcm16
      example: pcm16
      title: AudioFormat
      type: string
    RecordingListResponse:
      description: Response containing list of recordings
      properties:
        data:
          items:
            $ref: "#/components/schemas/Recording"
          type: array
      required:
        - data
      title: RecordingListResponse
      type: object
  securitySchemes:
    management_token:
      scheme: bearer
      type: http
info:
  contact:
    email: contact@fishjam.io
    name: Fishjam Support
  description: |
    API for managing Fishjam real-time media resources.

    ## Authentication
    ##
    Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app.
    All requests require HTTP Bearer authorization using the Fishjam Management Token.

    ## Fishjam SDKs
    ##
    For TypeScript and Python users, we provide SDKs that simplify using this API.
    We recommend using them instead of manually consuming the API in these languages.

    You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup)
  title: Fishjam API
  version: 0.29.0
openapi: 3.0.0
paths:
  /livestream:
    get:
      callbacks: {}
      description: List all livestreams.
      operationId: get_all_streams
      parameters: []
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StreamsListingResponse"
          description: Success
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: List all streams
      tags:
        - Streams
    post:
      callbacks: {}
      description: Create a new livestream with the given configuration.
      operationId: create_stream
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StreamConfig"
        required: false
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StreamDetailsResponse"
          description: Stream created successfully
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "402":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Usage quota exceeded for free tier
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create a stream
      tags:
        - Streams
  /livestream/{stream_id}:
    delete:
      callbacks: {}
      description: Delete a stream by id and disconnect all of its streamers and viewers.
      operationId: delete_stream
      parameters:
        - description: Stream ID
          in: path
          name: stream_id
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Successfully deleted stream
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Delete a stream
      tags:
        - Streams
    get:
      callbacks: {}
      description: Get a stream by id.
      operationId: get_stream
      parameters:
        - description: Stream ID
          in: path
          name: stream_id
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StreamDetailsResponse"
          description: Success
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Stream doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Get a stream
      tags:
        - Streams
  /livestream/{stream_id}/streamer:
    post:
      callbacks: {}
      description: Create a streamer for a stream and return its credentials.
      operationId: create_streamer
      parameters:
        - description: Stream id
          in: path
          name: stream_id
          required: true
          schema:
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StreamerDetailsResponse"
          description: Streamer successfully created
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Stream doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create a streamer
      tags:
        - Streamers
  /livestream/{stream_id}/streamer/{streamer_id}:
    delete:
      callbacks: {}
      description: Delete a streamer from a stream and revoke its token.
      operationId: delete_streamer
      parameters:
        - description: Stream id
          in: path
          name: stream_id
          required: true
          schema:
            type: string
        - description: Streamer id
          in: path
          name: streamer_id
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Streamer successfully deleted
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Delete a streamer
      tags:
        - Streamers
  /livestream/{stream_id}/viewer:
    post:
      callbacks: {}
      description: Create a viewer for a stream and return its credentials.
      operationId: create_viewer
      parameters:
        - description: Stream id
          in: path
          name: stream_id
          required: true
          schema:
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ViewerDetailsResponse"
          description: Viewer successfully created
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Stream doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create a viewer
      tags:
        - Viewers
  /livestream/{stream_id}/viewer/{viewer_id}:
    delete:
      callbacks: {}
      description: Delete a viewer from a stream and revoke its token.
      operationId: delete_viewer
      parameters:
        - description: Stream id
          in: path
          name: stream_id
          required: true
          schema:
            type: string
        - description: Viewer id
          in: path
          name: viewer_id
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Viewer successfully deleted
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Delete a viewer
      tags:
        - Viewers
  /moq/access:
    post:
      callbacks: {}
      description: Issue a short-lived JWT for a Media over QUIC client.
      operationId: create_moq_access
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MoqAccessConfig"
        required: false
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MoqAccess"
          description: MoQ access successfully created
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create MoQ access
      tags:
        - MoQ
  /recordings:
    get:
      callbacks: {}
      description: List recordings for the tenant, optionally filtered by metadata.
      operationId: list_recordings
      parameters:
        - description: Filter by metadata, e.g. `metadata[env]=prod` (nested keys allowed). Returns recordings whose metadata contains all the given pairs. Query values are compared as JSON strings, so non-string metadata values (numbers, booleans) cannot be matched.
          explode: true
          in: query
          name: metadata
          required: false
          schema:
            additionalProperties: true
            type: object
          style: deepObject
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RecordingListResponse"
          description: Success
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
      security:
        - management_token: []
      summary: List recordings
      tags:
        - Recordings
    post:
      callbacks: {}
      description: Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
      operationId: create_recording
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RecordingConfig"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RecordingDetailsResponse"
          description: Recording created successfully
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "402":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Usage quota exceeded for free tier
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create a recording
      tags:
        - Recordings
  /recordings/{recording_id}:
    delete:
      callbacks: {}
      description: Delete a recording by id.
      operationId: delete_recording
      parameters:
        - description: Recording ID
          in: path
          name: recording_id
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Successfully deleted recording
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Delete a recording
      tags:
        - Recordings
    get:
      callbacks: {}
      description: Get a recording by id.
      operationId: get_recording
      parameters:
        - description: Recording ID
          in: path
          name: recording_id
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RecordingDetailsResponse"
          description: Success
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Recording doesn't exist
      security:
        - management_token: []
      summary: Get a recording
      tags:
        - Recordings
  /room:
    get:
      callbacks: {}
      description: List all rooms and livestreams.
      operationId: get_all_rooms
      parameters: []
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RoomsListingResponse"
          description: Success
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
      security:
        - management_token: []
      summary: List all rooms
      tags:
        - Rooms
    post:
      callbacks: {}
      description: Create a new room with the given configuration.
      operationId: create_room
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RoomConfig"
        required: false
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RoomCreateDetailsResponse"
          description: Room successfully created
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "402":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Usage quota exceeded for free tier
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create a room
      tags:
        - Rooms
  /room/{room_id}:
    delete:
      callbacks: {}
      description: Delete a room by id and disconnect all of its peers.
      operationId: delete_room
      parameters:
        - description: Room id
          in: path
          name: room_id
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Successfully deleted room
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Delete a room
      tags:
        - Rooms
    get:
      callbacks: {}
      description: Get a room by id.
      operationId: get_room
      parameters:
        - description: Room ID
          in: path
          name: room_id
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RoomDetailsResponse"
          description: Success
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Get a room
      tags:
        - Rooms
  /room/{room_id}/peer:
    post:
      callbacks: {}
      description: Add a peer to a room and return its connection token.
      operationId: add_peer
      parameters:
        - description: Room id
          in: path
          name: room_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PeerConfig"
        required: false
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PeerDetailsResponse"
          description: Peer successfully created
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request body structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "402":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Usage quota exceeded for free tier
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room doesn't exist
        "409":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Request conflict
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create a peer
      tags:
        - Rooms
  /room/{room_id}/peer/{id}:
    delete:
      callbacks: {}
      description: Remove a peer from a room and disconnect it.
      operationId: delete_peer
      parameters:
        - description: Room id
          in: path
          name: room_id
          required: true
          schema:
            type: string
        - description: Peer id
          in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Peer successfully deleted
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request body structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room ID or Peer ID references a resource that doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Delete a peer
      tags:
        - Rooms
  /room/{room_id}/peer/{id}/refresh_token:
    post:
      callbacks: {}
      description: Issue a fresh connection token for an existing peer.
      operationId: refresh_token
      parameters:
        - description: Room id
          in: path
          name: room_id
          required: true
          schema:
            type: string
        - description: Peer id
          in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PeerRefreshTokenResponse"
          description: Token successfully created
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request body structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room ID or Peer ID references a resource that doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Refresh a peer token
      tags:
        - Rooms
  /room/{room_id}/peer/{id}/subscribe_peer:
    post:
      callbacks: {}
      description: Subscribe a peer to all current and future tracks published by another peer in the same room.
      operationId: subscribe_peer
      parameters:
        - description: Room id
          in: path
          name: room_id
          required: true
          schema:
            type: string
        - description: Peer id
          in: path
          name: id
          required: true
          schema:
            type: string
        - description: ID of the peer that produces the track
          in: query
          name: peer_id
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Peer successfully subscribed to another peer's tracks
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request body structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room ID or Peer ID references a resource that doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Subscribe a peer to another peer's tracks
      tags:
        - Rooms
  /room/{room_id}/peer/{id}/subscribe_tracks:
    post:
      callbacks: {}
      description: Subscribe a peer to a specific list of track IDs in the same room.
      operationId: subscribe_tracks
      parameters:
        - description: Room id
          in: path
          name: room_id
          required: true
          schema:
            type: string
        - description: Peer id
          in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                track_ids:
                  description: List of track IDs to subscribe to
                  items:
                    $ref: "#/components/schemas/TrackID"
                  type: array
              required:
                - track_ids
              type: object
        description: Track IDs
        required: false
      responses:
        "200":
          description: Peer successfully subscribed to tracks
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request body structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room ID or Peer ID references a resource that doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Subscribe a peer to specific tracks
      tags:
        - Rooms
  /room/{room_id}/streamer:
    post:
      callbacks: {}
      description: Issue a fresh streamer token.
      operationId: generate_streamer_token
      parameters:
        - description: ID of the stream.
          in: path
          name: room_id
          required: true
          schema:
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StreamerToken"
          description: Token successfully created
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request body structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create a streamer token
      tags:
        - Streamers
  /room/{room_id}/track_forwardings:
    post:
      callbacks: {}
      description: Forward a room's tracks into an external composition.
      operationId: create_track_forwarding
      parameters:
        - description: Room id
          in: path
          name: room_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TrackForwarding"
        required: true
      responses:
        "201":
          description: Track forwardings added successfully
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room doesn't exist
        "409":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Composition is already receiving track forwardings
      security:
        - management_token: []
      summary: Create a track forwarding
      tags:
        - Track Forwardings
  /room/{room_id}/viewer:
    post:
      callbacks: {}
      description: Issue a fresh viewer token.
      operationId: generate_viewer_token
      parameters:
        - description: ID of the stream.
          in: path
          name: room_id
          required: true
          schema:
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ViewerToken"
          description: Token successfully created
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Invalid request body structure
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unauthorized
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Room doesn't exist
        "503":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Service temporarily unavailable
      security:
        - management_token: []
      summary: Create a viewer token
      tags:
        - Viewers
  /validate:
    get:
      callbacks: {}
      description: Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
      operationId: validate_credentials
      parameters: []
      responses:
        "200":
          description: Credentials are valid
        "404":
          description: Credentials are invalid or missing
      security:
        - management_token: []
      summary: Validate Fishjam Management Token
      tags:
        - Credentials
security: []
servers:
  - url: https://fishjam.io/api/v1/connect/{fishjamId}
    variables:
      fishjamId:
        default: ""
        description: Fishjam ID
tags:
  - description: |
      WebRTC rooms for videoconferencing. Each room hosts one or
      more **peers** that exchange media through Fishjam.

      These endpoints cover the room lifecycle and per-room peer management —
      adding and removing peers, refreshing peer tokens, and configuring
      subscription policies between peers. For one-to-many scenarios,
      see **Streams**.
    name: Rooms
  - description: |
      WebRTC livestreams for broadcasting scenarios.
      A stream holds the configuration for a one-to-many session and owns the
      **streamers** that publish to it and the **Viewers** that consume it.
    name: Streams
  - description: |
      A **streamer** represents a single publisher session for a stream and
      carries an ephemeral token that Fishjam verifies before accepting
      media. Use these endpoints to provision a streamer, revoke one, or issue a
      fresh streamer token scoped to a livestream.
    name: Streamers
  - description: |
      A **viewer** represents a single consumer session for a stream, identified
      by an ephemeral token that Fishjam verifies on subscribe. These
      endpoints provision and revoke viewers and issue viewer tokens for a
      livestream room.

      The endpoints in this section are only applicable to private livestreams.
      Public livestreams can be viewed anonymously, without creating a viewer resource.
    name: Viewers
  - description: |
      Forward media tracks from a room's peers into a **composition**.
      Useful for compositing room media into a single output for recording, transcoding,
      or downstream broadcast.

      Only the `"all"` selector is currently supported, which forwards every
      active track in the room.
    name: Track Forwardings
  - description: |
      A **recording** is a saved capture of media output. Creating one synchronously starts
      capturing, so it is born `active`; follow its `status` as media is finalized
      (`active` → `available`, or `failed`). A recording stands on its own, independent of the
      room, stream, or composition it came from, so it stays available after that source ends.

      Set free-form `metadata` when you create a recording; you can then use it to filter
      recordings when fetching them.
    name: Recordings
  - description: |
      Issue short-lived JWT tokens that authorize **Media over QUIC** relay
      clients to publish and/or subscribe under a scoped path.

      A token grants access to its `publishPath` and/or `subscribePath` for one
      hour; clients must request a fresh token after that window.
    name: MoQ
