Switch channel stream

Prev Next

Available in Classic and VPC

Switch the active streaming between the main stream and backup stream of a live channel. It can be switched only for channels with the PUBLISHING status.

Request

This section describes the request format. The method and URI are as follows:

Method URI
PUT /api/v2/channels/{channelId}/switch-stream

Request headers

For information about the headers common to all Live Station APIs, see Live Station request headers.

Request path parameters

You can use the following path parameters with your request:

Field Type Required Description
channelId String Required Channel ID

Request example

The request example is as follows:

curl --location --request PUT 'https://livestation.apigw.ntruss.com/api/v2/channels/ls-20250814******-zTwK2/switch-stream' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--header 'x-ncp-region_code: KR' \
--header 'Content-Type: application/json'

Response

This section describes the response format.

Response body

The response body includes the following data:

Field Type Required Description
content.channelId String - Channel ID
content.channelName String - Channel name
content.instanceNo Integer - Channel instance number
content.qualitySetId Integer - Image quality configuration ID
content.qualitySetName String - Image quality setting name
content.outputProtocol String - Output protocol
  • HLS
  • DASH
content.channelStatus String - Channel status
  • PUBLISHING, STOPPED, etc.
content.isRecording Boolean - Recording status
  • true: Recording
  • false: Not recording
content.useDVR Boolean - DVR usage
  • true: Enable
  • false: Disable
content.immediateOnAir Boolean - Immediate on-air status
  • true: Immediate
  • false: Manual
content.timemachineMin Integer - Time machine allowance minute
content.cdn Object - CDN information
content.cdn.instanceNo String - CDN Instance No
content.cdn.serviceName String - CDN service name
content.cdn.statusName String - CDN status name
content.cdn.cdnType String - CDN type
  • CDN_PLUS
content.cdn.cdnDomain String - CDN domain
content.streamKey String - Main stream key
content.publishUrl String - Streaming RTMP URL
content.totalPublishSeconds Integer - Total streaming time (second)
content.createdTime Long - Creation time (epoch ms)
content.alertOn Boolean - Notification
  • true / false
content.recentPublishTime Long - Last streaming time (epoch ms)
content.alertOptions Object - Notification option
content.alertOptions.alertChangeStatus Boolean - Status change notification
content.alertOptions.alertVodUploadFail Boolean - VOD upload failure notification
content.alertOptions.alertReStreamFail Boolean - Restreaming failure notification
content.alertOptions.alertStreamFailOver Boolean - Stream failover notification
content.callbackEndpoint String - Callback URL
content.envType String - Environment type
  • STAGE
  • PROD
content.record Object - Set recording
content.record.type String - Recording type
  • NO_RECORD
content.record.bucketName String - Bucket name
content.record.filePath String - File path
content.record.format String - Recording file format
content.record.accessControl String - Access control
content.origin Object - Origin information
content.origin.originDomain String - Origin domain
content.origin.originPath String - Origin path
content.backupStreamKey String - Backup stream key
content.isStreamFailOver Boolean - Failover status
  • true/false
content.snapshot Object - Snapshot information
content.snapshot.snapshotId Long - Snapshot ID
isPublishingBackUp Boolean - Backup streaming source activation
  • true | false
    • true: Backup streaming enabled
    • false: Backup streaming disabled

Response status codes

For information about the HTTP status codes common to all Live Station APIs, see Live Station response status codes.

Response example

The response example is as follows:

{
  "content": {
    "channelId": "ls-20250904******-DZUmt",
    "channelName": "stream_switch_test",
    "instanceNo": 10******9,
    "qualitySetId": 5,
    "qualitySetName": "480p-set",
    "outputProtocol": "HLS,DASH",
    "channelStatus": "PUBLISHING",
    "isRecording": false,
    "useDVR": true,
    "immediateOnAir": false,
    "timemachineMin": 360,
    "cdn": {
      "instanceNo": "4006",
      "serviceName": "cdn-ls-20211109******-1bhF4",
      "statusName": "RUNNING",
      "cdnType": "CDN_PLUS",
      "cdnDomain": "*************.cdn.beta.ntruss.com"
    },
    "streamKey": "ye*****************************7",
    "publishUrl": "rtmp://***********.video.media.ntruss.com:8080/relay",
    "globalPublishUrl": "",
    "totalPublishSeconds": 22936,
    "createdTime": 1756966010000,
    "alertOn": false,
    "recentPublishStartTime": 1764146744000,
    "alertOptions": {
      "alertChangeStatus": false,
      "alertVodUploadFail": false,
      "alertReStreamFail": false,
      "alertStreamFailOver": false
    },
    "callbackEndpoint": "https://www.example.com",
    "envType": "REAL",
    "record": {
      "type": "MANUAL_UPLOAD",
      "accessControl": "PRIVATE"
    },
    "origin": {
      "originDomain": "*****.video.media.ntruss.com",
      "originPath": "6*****3"
    },
    "backupStreamKey": "ye*****************************7?backup=true",
    "isStreamFailOver": true,
    "isPublishingBackUp": true
  }
}