Create a relay
client.moq.relays.create(RelayCreateParams { account_id, name } params, RequestOptionsoptions?): RelayCreateResponse { config, created, modified, 4 more }
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 set to defaults (lingering subscribe enabled, 30s ceiling, origin fallback off). Use PUT to modify.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
Create a relay
import Cloudflare from 'cloudflare';
const client = new Cloudflare({
apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});
const relay = await client.moq.relays.create({
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
name: 'Production Live Stream',
});
console.log(relay.uid);{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"success": true,
"result": {
"config": {
"lingering_subscribe": {
"enabled": true,
"max_timeout_ms": 0
},
"origin_fallback": {
"enabled": true,
"origins": [
{
"url": "url"
}
]
}
},
"created": "2019-12-27T18:11:19.117Z",
"modified": "2019-12-27T18:11:19.117Z",
"name": "Production Live Stream",
"token_publish_subscribe": "eyJhbGciOiJFZDI1NTE5...",
"token_subscribe": "eyJhbGciOiJFZDI1NTE5...",
"uid": "a1b2c3d4e5f67890a1b2c3d4e5f67890"
}
}Returns Examples
{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"success": true,
"result": {
"config": {
"lingering_subscribe": {
"enabled": true,
"max_timeout_ms": 0
},
"origin_fallback": {
"enabled": true,
"origins": [
{
"url": "url"
}
]
}
},
"created": "2019-12-27T18:11:19.117Z",
"modified": "2019-12-27T18:11:19.117Z",
"name": "Production Live Stream",
"token_publish_subscribe": "eyJhbGciOiJFZDI1NTE5...",
"token_subscribe": "eyJhbGciOiJFZDI1NTE5...",
"uid": "a1b2c3d4e5f67890a1b2c3d4e5f67890"
}
}