Skip to content
Start here

Create VOD webhooks

client.Stream.Webhooks.Update(ctx, params) (*WebhookUpdateResponse, error)
PUT/accounts/{account_id}/stream/webhook

Create a webhook for notifications about on-demand video uploads.

Security
API Token

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

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Stream Write
ParametersExpand Collapse
params WebhookUpdateParams
AccountID param.Field[string]

Path param: The account identifier tag.

maxLength32
BodyNotificationURL1 param.Field[string]Optional

Body param: The URL where webhooks will be sent.

formaturi
BodyNotificationURL2 param.Field[string]Optional

Body param: The URL where webhooks will be sent.

formaturi
ReturnsExpand Collapse
type WebhookUpdateResponse struct{…}
Modified TimeOptional

The date and time the webhook was last modified.

formatdate-time
NotificationURL stringOptional

The URL where webhooks will be sent.

formaturi
Secret stringOptional

The secret used to verify webhook signatures.

Create VOD webhooks

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  webhook, err := client.Stream.Webhooks.Update(context.TODO(), stream.WebhookUpdateParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", webhook.Modified)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "modified": "2014-01-02T02:20:00Z",
    "notification_url": "https://example.com",
    "notificationUrl": "https://example.com",
    "secret": "secret"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "modified": "2014-01-02T02:20:00Z",
    "notification_url": "https://example.com",
    "notificationUrl": "https://example.com",
    "secret": "secret"
  }
}