---
title: "Create peer"
method: POST
path: "/room/{room_id}/peer"
tags: ["room"]
---

# Create peer

`POST /room/{room_id}/peer`

## Path parameters

- `room_id` string, required

## Request body

- object
  - `options` PeerOptions, required — Options specific to the WebRTC peer
    - `enableSimulcast` boolean — Enables the peer to use simulcast
  - `type` string, required — Peer type

## Response `201`

Peer successfully created

- PeerDetailsResponse — Response containing peer details and their token
  - `data` object, required
    - `peer` Peer, required — Describes peer status
      - `id` string, required — Assigned peer id
      - `metadata` unknown, required
      - `status` 'connected' | 'disconnected', required — Informs about the peer status
      - `tracks` Track[], required — List of all peer's tracks
        - `id` string
        - `metadata` unknown
        - `type` 'audio' | 'video'
      - `type` string, required — Peer type
    - `peer_websocket_url` string — Websocket URL to which peer has to connect
    - `token` string, required — Token for authorizing websocket connection

## Other responses

- `400` — Invalid request body structure
- `401` — Unauthorized
- `404` — Room doesn't exist
- `503` — Service temporarily unavailable

## Changes

- **2024-04-17** `2829165c037d` — 1 info
  - added the optional property `data/peer_websocket_url` to the response with the `201` status
- **2024-02-22** `4f1bea96a0f9` — 1 info
  - the endpoint scheme security `authorization` was added to the API
- **2024-02-07** `0c4bd069911b` — 2 info
  - added the required property `data/peer/metadata` to the response with the `201` status
  - added the required property `data/peer/tracks` to the response with the `201` status
- **2023-09-08** `d9f3c98af29b` — 3 info
  - api operation id `JellyfishWeb.PeerController.create` removed and replaced with `add_peer`
  - api tag `room` added
  - api tag `peer` removed
- **2023-08-11** `dd86a9fe6954` — 1 breaking
  - added the new required request property `options`

[Full history](https://skmtc.dev/fishjam-dev/apis/fishjam-media-server/changes/room/:room_id/peer/post.md)

---

[API](https://skmtc.dev/fishjam-dev/apis/fishjam-media-server.md) · [All operations](https://skmtc.dev/fishjam-dev/apis/fishjam-media-server/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fishjam-dev/fishjam-media-server/revisions/7227c4e436c0/schema)
