API
The Ingress API is available within the server SDKs and the CLI:
CreateIngress
WHIP / RTMP example
To provision an ingress with the Ingress service, use the CreateIngress API. It returns an IngressInfo object that describes the created ingress, along with connection settings. These parameters can also be queried at any time using the ListIngress API
Create a file at ingress.json with the following content:
{"input_type": 0 for RTMP, 1 for WHIP"name": "Name of the ingress goes here","room_name": "Name of the room to connect to","participant_identity": "Unique identity for the room participant the Ingress service will connect as","participant_name": "Name displayed in the room for the participant","enable_transcoding": true // Transcode the input stream. Can only be false for WHIP,}
Then create the ingress using lk:
export LIVEKIT_URL=https://my-livekit-hostexport LIVEKIT_API_KEY=livekit-api-keyexport LIVEKIT_API_SECRET=livekit-api-secretlk ingress create ingress.json
import { IngressClient, IngressInfo, IngressInput } from 'livekit-server-sdk';const livekitHost = 'https://my-livekit-host';const ingressClient = new IngressClient(livekitHost, 'api-key', 'secret-key');const ingress = {name: 'my-ingress',roomName: 'my-room',participantIdentity: 'my-participant',participantName: 'My Participant',// Transcode the input stream. Can only be false for WHIP.enableTranscoding: false,};// Use IngressInput.WHIP_INPUT to create a WHIP endpointawait ingressClient.createIngress(IngressInput.RTMP_INPUT, ingress);
ctx := context.Background()ingressClient := lksdk.NewIngressClient("https://my-livekit-host","livekit-api-key","livekit-api-secret",)t := trueingressRequest := &livekit.CreateIngressRequest{InputType: livekit.IngressInput_RTMP_INPUT, // Or livekit.IngressInput_WHIP_INPUTName: "my-ingress",RoomName: "my-room",ParticipantIdentity: "my-participant",ParticipantName: "My Participant",// Transcode the input stream. Can only be false for WHIP.EnableTranscoding: &t,}info, err := ingressClient.CreateIngress(ctx, ingressRequest)ingressID := info.IngressId
ingressClient = LiveKit::IngressServiceClient.new(url, api_key: "yourkey", api_secret: "yoursecret")info = ingressClient.create_ingress(:RTMP_INPUT, # Or WHIP_INPUTname: "my-ingress",room_name: "my-room",participant_identity: "my-participant",participant_name: "My Participant",)puts info.ingress_id
URL Input example
With URL Input, ingress will begin immediately after CreateIngress is called. URL_INPUT ingress can't be reused.
Create a file at ingress.json with the following content:
{"input_type": "URL_INPUT", // or 2"name": "Name of the ingress goes here","room_name": "Name of the room to connect to","participant_identity": "Unique identity for the room participant the Ingress service will connect as","participant_name": "Name displayed in the room for the participant","url": "HTTP(S) or SRT url to the file or stream"}
Then create the ingress using lk:
export LIVEKIT_URL=https://my-livekit-hostexport LIVEKIT_API_KEY=livekit-api-keyexport LIVEKIT_API_SECRET=livekit-api-secretlk ingress create ingress.json
import { IngressClient, IngressInfo, IngressInput } from 'livekit-server-sdk';const livekitHost = 'https://my-livekit-host';const ingressClient = new IngressClient(livekitHost, 'api-key', 'secret-key');const ingress = {name: 'my-ingress',roomName: 'my-room',participantIdentity: 'my-participant',participantName: 'My Participant',url: 'https://domain.com/video.m3u8', // or 'srt://domain.com:7001'};await ingressClient.createIngress(IngressInput.URL_INPUT, ingress);
ctx := context.Background()ingressClient := lksdk.NewIngressClient("https://my-livekit-host","livekit-api-key","livekit-api-secret",)ingressRequest := &livekit.CreateIngressRequest{InputType: livekit.IngressInput_URL_INPUT,Name: "my-ingress",RoomName: "my-room",ParticipantIdentity: "my-participant",ParticipantName: "My Participant",Url: "https://domain.com/video.m3u8", // or 'srt://domain.com:7001'}info, err := ingressClient.CreateIngress(ctx, ingressRequest)ingressID := info.IngressId
ingressClient = LiveKit::IngressServiceClient.new(url, api_key: "yourkey", api_secret: "yoursecret")info = ingressClient.create_ingress(:URL_INPUT,name: "my-ingress",room_name: "my-room",participant_identity: "my-participant",participant_name: "My Participant",url: "https://domain.com/video.m3u8", # or 'srt://domain.com:7001')puts info.ingress_id
ListIngress
lk ingress list
The optional --room option allows to restrict the output to the Ingress associated to a given room. The --id option can check if a specific ingress is active.
await ingressClient.listIngress('my-room');
The roomName parameter can be left empty to list all Ingress.
listRequest := &livekit.ListIngressRequest{RoomName: "my-room", // Optional parameter to restrict the list to only one room. Leave empty to list all Ingress.}infoArray, err := ingressClient.ListIngress(ctx, listRequest)
puts ingressClient.list_ingress(# optionalroom_name: "my-room")
UpdateIngress
The ingress configuration can be updated using the UpdateIngress API. This enables the ability to reuse the same ingress URL to publish to different rooms. Only reusable ingresses, such as RTMP or WHIP, can be updated.
Create a file at ingress.json with the fields to be updated.
{"ingress_id": "Ingress ID of the ingress to update","name": "Name of the ingress goes here","room_name": "Name of the room to connect to","participant_identity": "Unique identity for the room participant the Ingress service will connect as","participant_name": "Name displayed in the room for the participant"}
The only required field is ingress_id. Non-provided fields are left unchanged.
lk ingress update ingress.json
const update = {name: 'my-other-ingress',roomName: 'my-other-room',participantIdentity: 'my-other-participant',participantName: 'My Other Participant',};await ingressClient.updateIngress(ingressID, update);
Parameters left empty in the update object are left unchanged.
updateRequest := &livekit.UpdateIngressRequest{IngressId: "ingressID", // required parameter indicating what Ingress to updateName: "my-other-ingress",RoomName: "my-other-room",ParticipantIdentity: "my-other-participant",ParticipantName: "My Other Participant",}info, err := ingressClient.UpdateIngress(ctx, updateRequest)
Non specified fields are left unchanged.
# only specified fields are updated, all fields are optionalputs ingressClient.update_ingress("ingress-id",name: "ingress-name",room_name: "my-room",participant_identity: "my-participant",participant_name: "My Participant",audio: LiveKit::Proto::IngressAudioOptions.new(...),video: LiveKit::Proto::IngressVideoOptions.new(...),)
DeleteIngress
An ingress can be reused multiple times. When not needed anymore, it can be deleted using the DeleteIngress API:
lk ingress delete <INGRESS_ID>
await ingressClient.deleteIngress('ingress_id');
deleteRequest := &livekit.DeleteIngressRequest{IngressId: "ingress_id",}info, err := ingressClient.DeleteIngress(ctx, deleteRequest)
puts ingressClient.delete_ingress("ingress-id")