Skip to content
Start here

Update Event Subscription

client.Queues.Subscriptions.Update(ctx, subscriptionID, params) (*SubscriptionUpdateResponse, error)
PATCH/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}

Update an existing event subscription

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)
Queues WriteWorkers Scripts Write
ParametersExpand Collapse
subscriptionID string

A Resource identifier.

maxLength32
params SubscriptionUpdateParams
AccountID param.Field[string]

Path param: A Resource identifier.

maxLength32
Destination param.Field[SubscriptionUpdateParamsDestination]optional

Body param: Destination configuration for the subscription

QueueID string

ID of the target queue

Type SubscriptionUpdateParamsDestinationType

Type of destination

Enabled param.Field[bool]optional

Body param: Whether the subscription is active

Events param.Field[[]string]optional

Body param: List of event types this subscription handles

Name param.Field[string]optional

Body param: Name of the subscription

ReturnsExpand Collapse
type SubscriptionUpdateResponse struct{…}
ID string

Unique identifier for the subscription

CreatedAt Time

When the subscription was created

formatdate-time
Destination SubscriptionUpdateResponseDestination

Destination configuration for the subscription

QueueID string

ID of the target queue

Type SubscriptionUpdateResponseDestinationType

Type of destination

Enabled bool

Whether the subscription is active

Events []string

List of event types this subscription handles

ModifiedAt Time

When the subscription was last modified

formatdate-time
Name string

Name of the subscription

Source SubscriptionUpdateResponseSource

Source configuration for the subscription

One of the following:
type SubscriptionUpdateResponseSourceMqEventSourceImages struct{…}
Type SubscriptionUpdateResponseSourceMqEventSourceImagesTypeoptional

Type of source

type SubscriptionUpdateResponseSourceMqEventSourceKV struct{…}
Type SubscriptionUpdateResponseSourceMqEventSourceKVTypeoptional

Type of source

type SubscriptionUpdateResponseSourceMqEventSourceR2 struct{…}
Type SubscriptionUpdateResponseSourceMqEventSourceR2Typeoptional

Type of source

type SubscriptionUpdateResponseSourceMqEventSourceSuperSlurper struct{…}
Type SubscriptionUpdateResponseSourceMqEventSourceSuperSlurperTypeoptional

Type of source

type SubscriptionUpdateResponseSourceMqEventSourceVectorize struct{…}
Type SubscriptionUpdateResponseSourceMqEventSourceVectorizeTypeoptional

Type of source

type SubscriptionUpdateResponseSourceMqEventSourceWorkersAIModel struct{…}
ModelName stringoptional

Name of the Workers AI model

Type SubscriptionUpdateResponseSourceMqEventSourceWorkersAIModelTypeoptional

Type of source

type SubscriptionUpdateResponseSourceMqEventSourceWorkersBuildsWorker struct{…}
Type SubscriptionUpdateResponseSourceMqEventSourceWorkersBuildsWorkerTypeoptional

Type of source

WorkerName stringoptional

Name of the worker

type SubscriptionUpdateResponseSourceMqEventSourceWorkflowsWorkflow struct{…}
Type SubscriptionUpdateResponseSourceMqEventSourceWorkflowsWorkflowTypeoptional

Type of source

WorkflowName stringoptional

Name of the workflow

Update Event Subscription

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  subscription, err := client.Queues.Subscriptions.Update(
    context.TODO(),
    "023e105f4ecef8ad9ca31a8372d0c353",
    queues.SubscriptionUpdateParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", subscription.ID)
}
{
  "errors": [
    {
      "code": 7003,
      "message": "No route for the URI",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "id": "id",
    "created_at": "2019-12-27T18:11:19.117Z",
    "destination": {
      "queue_id": "queue_id",
      "type": "queues.queue"
    },
    "enabled": true,
    "events": [
      "string"
    ],
    "modified_at": "2019-12-27T18:11:19.117Z",
    "name": "name",
    "source": {
      "type": "images"
    }
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 7003,
      "message": "No route for the URI",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "id": "id",
    "created_at": "2019-12-27T18:11:19.117Z",
    "destination": {
      "queue_id": "queue_id",
      "type": "queues.queue"
    },
    "enabled": true,
    "events": [
      "string"
    ],
    "modified_at": "2019-12-27T18:11:19.117Z",
    "name": "name",
    "source": {
      "type": "images"
    }
  },
  "success": true
}