---
title: "Subscribe the HLS component to the tracks of peers or components"
method: POST
path: "/hls/{room_id}/subscribe"
tags: ["hls"]
---

# Subscribe the HLS component to the tracks of peers or components

`POST /hls/{room_id}/subscribe`

## Path parameters

- `room_id` string, required

## Request body

- SubscriptionConfig — Subscription config
  - `origins` string[] — List of peers and components ids whose tracks the HLS endpoint will subscribe to

## Response `201`

Tracks succesfully added.

## Other responses

- `400` — Invalid request structure
- `401` — Unauthorized
- `404` — Room doesn't exist

## Changes

- **2024-02-22** `4f1bea96a0f9` — 1 info
  - the endpoint scheme security `authorization` was added to the API
- **2024-02-12** `911cbd65995d` — 1 info
  - added the non-success response with the status `401`
- **2023-12-14** `dbadea551432` — 1 warning, 2 info
  - removed the request property `tracks`
  - api operation id `subscribe_tracks` removed and replaced with `subscribe_hls_to`
  - added the new optional request property `origins`
- **2023-11-23** `1cdd25629361` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/fishjam-dev/apis/fishjam-media-server/changes/hls/:room_id/subscribe/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.dev/fishjam-dev/apis/fishjam-media-server/revisions/c9ea5a438831?raw)
