Create a relay
moq.relays.create(RelayCreateParams**kwargs) -> RelayCreateResponse
POST/accounts/{account_id}/moq/relays
Provisions a new MoQ relay instance. Auto-creates a publish+subscribe
token and a subscribe-only token. Token values are included in the
response (shown once). Config is always set to defaults (upstreams
off) and cannot be supplied here — sending a non-empty config is
rejected (21014); null or {} is accepted as absent. Use PUT to
configure the relay after it exists.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
Parameters
Create a relay
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
relay = client.moq.relays.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
name="Production Live Stream",
)
print(relay.uid){
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"success": true,
"result": {
"config": {
"upstreams": {
"enabled": true,
"upstreams": [
{
"url": "https://example.com"
}
]
}
},
"created": "2019-12-27T18:11:19.117Z",
"issuers": [
{
"cloudflare_tokens": [
{
"created": "2019-12-27T18:11:19.117Z",
"expires": "2019-12-27T18:11:19.117Z",
"jti": "f3a1b2c3d4e5f67890a1b2c3d4e5f678",
"operations": [
"publish",
"subscribe"
],
"label": "primary-encoder",
"secret": "eyJhbGciOiJFZDI1NTE5..."
}
],
"issuer": "cloudflare",
"type": "cloudflare_jwt"
}
],
"modified": "2019-12-27T18:11:19.117Z",
"name": "Production Live Stream",
"uid": "a1b2c3d4e5f67890a1b2c3d4e5f67890"
}
}Returns Examples
{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"success": true,
"result": {
"config": {
"upstreams": {
"enabled": true,
"upstreams": [
{
"url": "https://example.com"
}
]
}
},
"created": "2019-12-27T18:11:19.117Z",
"issuers": [
{
"cloudflare_tokens": [
{
"created": "2019-12-27T18:11:19.117Z",
"expires": "2019-12-27T18:11:19.117Z",
"jti": "f3a1b2c3d4e5f67890a1b2c3d4e5f678",
"operations": [
"publish",
"subscribe"
],
"label": "primary-encoder",
"secret": "eyJhbGciOiJFZDI1NTE5..."
}
],
"issuer": "cloudflare",
"type": "cloudflare_jwt"
}
],
"modified": "2019-12-27T18:11:19.117Z",
"name": "Production Live Stream",
"uid": "a1b2c3d4e5f67890a1b2c3d4e5f67890"
}
}