Skip to content
Start here

Get a relay

client.MoQ.Relays.Get(ctx, relayID, query) (*RelayGetResponse, error)
GET/accounts/{account_id}/moq/relays/{relay_id}

Retrieves a single MoQ relay including config and status. Tokens are NOT included.

Security

API Token

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

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
ParametersExpand Collapse
relayID string
query RelayGetParams
AccountID param.Field[string]

Cloudflare account identifier.

ReturnsExpand Collapse
type RelayGetResponse struct{…}

Full relay details (no tokens).

Config RelayGetResponseConfig

origin_fallback and lingering_subscribe are mutually exclusive.

LingeringSubscribe RelayGetResponseConfigLingeringSubscribeOptional
Enabled boolOptional
MaxTimeoutMs int64Optional

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

maximum300000
minimum0
OriginFallback RelayGetResponseConfigOriginFallbackOptional
Enabled boolOptional
Origins []RelayGetResponseConfigOriginFallbackOriginOptional

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 stringOptional

Upstream origin relay URL.

Created Time
formatdate-time
Modified Time
formatdate-time
Name string
UID string
Status RelayGetResponseStatusOptional

“connected” when active, omitted otherwise.

Get a relay

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/moq"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  relay, err := client.MoQ.Relays.Get(
    context.TODO(),
    "a1b2c3d4e5f67890a1b2c3d4e5f67890",
    moq.RelayGetParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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"
  }
}