import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
restream = client.streaming.restreams.create()
print(restream.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
"github.com/G-Core/gcore-go/streaming"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
restream, err := client.Streaming.Restreams.New(context.TODO(), streaming.RestreamNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", restream.ID)
}
curl --request POST \
--url https://api.gcore.com/streaming/restreams \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"restream": {
"name": "first restream",
"active": true,
"uri": "rtmp://a.rtmp.youtube.com/live/k17a-13s8",
"stream_id": 20,
"client_user_id": 10,
"source": "original",
"no_audio": true,
"no_audio_mode": "silence"
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
restream: {
name: 'first restream',
active: true,
uri: 'rtmp://a.rtmp.youtube.com/live/k17a-13s8',
stream_id: 20,
client_user_id: 10,
source: 'original',
no_audio: true,
no_audio_mode: 'silence'
}
})
};
fetch('https://api.gcore.com/streaming/restreams', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/streaming/restreams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'restream' => [
'name' => 'first restream',
'active' => true,
'uri' => 'rtmp://a.rtmp.youtube.com/live/k17a-13s8',
'stream_id' => 20,
'client_user_id' => 10,
'source' => 'original',
'no_audio' => true,
'no_audio_mode' => 'silence'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/streaming/restreams")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"restream\": {\n \"name\": \"first restream\",\n \"active\": true,\n \"uri\": \"rtmp://a.rtmp.youtube.com/live/k17a-13s8\",\n \"stream_id\": 20,\n \"client_user_id\": 10,\n \"source\": \"original\",\n \"no_audio\": true,\n \"no_audio_mode\": \"silence\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/streaming/restreams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"restream\": {\n \"name\": \"first restream\",\n \"active\": true,\n \"uri\": \"rtmp://a.rtmp.youtube.com/live/k17a-13s8\",\n \"stream_id\": 20,\n \"client_user_id\": 10,\n \"source\": \"original\",\n \"no_audio\": true,\n \"no_audio_mode\": \"silence\"\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "Live Stream to Youtube 2024-06-21",
"active": true,
"uri": "rtmp://a.rtmp.youtube.com/live2/6w4g-9cw7-62dh-c6se-b4hq",
"stream_id": 1439046,
"client_user_id": 1000,
"source": "transcoded",
"no_audio": true,
"no_audio_mode": "silence",
"id": 287834,
"live": false,
"client_id": 102748,
"playlist_id": null,
"quality_id": null
}This response has no body data.Create restream
Creates a new restream for a specified live stream.
Specify the target platform’s URI (RTMP, RTMPS, or SRT) and the ID of the source stream.
Restreaming allows you to broadcast a single live stream to multiple platforms or servers simultaneously (e.g., Facebook, YouTube, or a custom media server).
How it works:
- Get credentials (stream URL/key or SRT URL) from the target platform.
- Create a restream in the Gcore system by specifying the target URI and the source live stream.
- Start your live stream; it will be automatically pushed to the target destination.
+-----------------------+
RTMP/RTMPS | | --------> Facebook (RTMP)
or ------> | Gcore Streaming | --------> YouTube (RTMPS)
SRT | | --------> Media server (SRT)
+-----------------------+ --------> Other RTMP/SRT targets
Supported combinations: RTMP → RTMP, RTMPS → RTMPS, RTMP → SRT, SRT → SRT, SRT → RTMP.
For SRT targets, only mode=caller is supported (Gcore initiates a PUSH connection).
Source stream parameters (bitrate, codecs, resolution) are sent “as is”. Ensure they match the destination requirements.
For SRT restreams, specify &latency=N explicitly in the SRT target URL instead of relying on a default value. It helps size the recovery buffer for round-trip time, jitter, and packet loss on the route to the target site.
Selecting the right latency is crucial for delivering a smooth live stream. It depends on the geographic distance and network conditions between Gcore and your target platform, especially if they located on different continents.
| Network Conditions | Recommended Latency |
|-------------------------|---------------------|
| Cross-region | 1-2 seconds |
| Public internet | 2-5 seconds |
Your target SRT server can accept latency format in seconds, milliseconds, or microseconds. Find out what format your target SRT server accepts in its documentation.
Learn more about SRT latency in product documentation.
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
restream = client.streaming.restreams.create()
print(restream.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
"github.com/G-Core/gcore-go/streaming"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
restream, err := client.Streaming.Restreams.New(context.TODO(), streaming.RestreamNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", restream.ID)
}
curl --request POST \
--url https://api.gcore.com/streaming/restreams \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"restream": {
"name": "first restream",
"active": true,
"uri": "rtmp://a.rtmp.youtube.com/live/k17a-13s8",
"stream_id": 20,
"client_user_id": 10,
"source": "original",
"no_audio": true,
"no_audio_mode": "silence"
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
restream: {
name: 'first restream',
active: true,
uri: 'rtmp://a.rtmp.youtube.com/live/k17a-13s8',
stream_id: 20,
client_user_id: 10,
source: 'original',
no_audio: true,
no_audio_mode: 'silence'
}
})
};
fetch('https://api.gcore.com/streaming/restreams', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/streaming/restreams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'restream' => [
'name' => 'first restream',
'active' => true,
'uri' => 'rtmp://a.rtmp.youtube.com/live/k17a-13s8',
'stream_id' => 20,
'client_user_id' => 10,
'source' => 'original',
'no_audio' => true,
'no_audio_mode' => 'silence'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/streaming/restreams")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"restream\": {\n \"name\": \"first restream\",\n \"active\": true,\n \"uri\": \"rtmp://a.rtmp.youtube.com/live/k17a-13s8\",\n \"stream_id\": 20,\n \"client_user_id\": 10,\n \"source\": \"original\",\n \"no_audio\": true,\n \"no_audio_mode\": \"silence\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/streaming/restreams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"restream\": {\n \"name\": \"first restream\",\n \"active\": true,\n \"uri\": \"rtmp://a.rtmp.youtube.com/live/k17a-13s8\",\n \"stream_id\": 20,\n \"client_user_id\": 10,\n \"source\": \"original\",\n \"no_audio\": true,\n \"no_audio_mode\": \"silence\"\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "Live Stream to Youtube 2024-06-21",
"active": true,
"uri": "rtmp://a.rtmp.youtube.com/live2/6w4g-9cw7-62dh-c6se-b4hq",
"stream_id": 1439046,
"client_user_id": 1000,
"source": "transcoded",
"no_audio": true,
"no_audio_mode": "silence",
"id": 287834,
"live": false,
"client_id": 102748,
"playlist_id": null,
"quality_id": null
}This response has no body data.Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Body
Show child attributes
Show child attributes
{
"name": "first restream",
"active": true,
"uri": "rtmp://a.rtmp.youtube.com/live/k17a-13s8",
"stream_id": 20,
"client_user_id": 10,
"source": "original",
"no_audio": true,
"no_audio_mode": "silence"
}
Response
Successful
Restream name
Indicates that the stream is being published. Has two possible values:
- true — stream is being published
- false — stream isn't published
Enables/Disables restream. Has two possible values:
-
true — restream is enabled and can be started
-
false — restream is disabled.
Default is true
A URL to push the stream to. Supported protocols: rtmp, rtmps, srt. For SRT target URLs, only mode=caller is supported.
"srt://example.com:1234?mode=caller"
ID of the stream to restream
Custom field where you can specify user ID in your system
Removes the source audio track from the restream. Has two possible values:
- false – the source audio track is forwarded to the target as is (default)
- true – the audio track is removed or replaced, depending on
no_audio_mode
Useful to avoid copyright claims on platforms like YouTube when the source stream contains licensed music or other copyrighted audio.
Only strict boolean values (true/false) are accepted; any other value returns a 422 error.
Defines how the audio track is handled when no_audio is true. Ignored when no_audio is false.
Types:
- "drop" – removes the audio track entirely.
- "silence" – replaces the audio track with a silent track instead of removing it.
Note: YouTube rejects incoming streams with no audio track at all. Use
no_audio_mode=silencewhen restreaming to YouTube.
drop, silence Selects which version of the stream is used as the source for the restream.
Types:
- "original" – uses the original ingested stream without any modifications (default).
- "transcoded" – uses the transcoded output, including overlays. Use it when you want to restream the stream with enabled overlays.
Note: For
transcoded, the highest quality available in the stream's quality ladder is used. For example, if the ladder is 480p/720p/1080p, 1080p is used; if the ladder goes up to 4K, 4K is used.
original, transcoded Restream ID
Client ID
ID of the playlist used as source for the restream, if applicable
ID of the specific transcoded quality used as source for the restream, if applicable