Skip to content
Start here

Update a relay

client.moq.relays.update(stringrelayId, RelayUpdateParams { account_id, config, name } params, RequestOptionsoptions?): RelayUpdateResponse { config, created, modified, 3 more }
PUT/accounts/{account_id}/moq/relays/{relay_id}

Updates a relay’s name and/or configuration. Partial updates: omitted fields are preserved. Config sub-objects replace as whole objects when present. origin_fallback and lingering_subscribe are mutually exclusive.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
ParametersExpand Collapse
relayId: string
params: RelayUpdateParams { account_id, config, name }
account_id: string

Path param: Cloudflare account identifier.

config?: Config

Body param: origin_fallback and lingering_subscribe are mutually exclusive.

lingering_subscribe?: LingeringSubscribe { enabled, max_timeout_ms }
enabled?: boolean
max_timeout_ms?: number

Relay-level ceiling on lingering subscribe timeout (ms). Default 30000.

maximum300000
minimum0
origin_fallback?: OriginFallback { enabled, origins }
enabled?: boolean
origins?: Array<Origin>

Ordered list of upstream origin relays. Each entry is an object (not a bare string) so per-origin configuration can be added in the future without another breaking change.

url?: string

Upstream origin relay URL.

name?: string

Body param

ReturnsExpand Collapse
RelayUpdateResponse { config, created, modified, 3 more }

Full relay details (no tokens).

config: Config { lingering_subscribe, origin_fallback }

origin_fallback and lingering_subscribe are mutually exclusive.

lingering_subscribe?: LingeringSubscribe { enabled, max_timeout_ms }
enabled?: boolean
max_timeout_ms?: number

Relay-level ceiling on lingering subscribe timeout (ms). Default 30000.

maximum300000
minimum0
origin_fallback?: OriginFallback { enabled, origins }
enabled?: boolean
origins?: Array<Origin>

Ordered list of upstream origin relays. Each entry is an object (not a bare string) so per-origin configuration can be added in the future without another breaking change.

url?: string

Upstream origin relay URL.

created: string
formatdate-time
modified: string
formatdate-time
name: string
uid: string
status?: "connected"

“connected” when active, omitted otherwise.

Update 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.update('a1b2c3d4e5f67890a1b2c3d4e5f67890', {
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
});

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",
    "uid": "a1b2c3d4e5f67890a1b2c3d4e5f67890",
    "status": "connected"
  }
}
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",
    "uid": "a1b2c3d4e5f67890a1b2c3d4e5f67890",
    "status": "connected"
  }
}