# Subscriptions ## List Event Subscriptions `client.Queues.Subscriptions.List(ctx, params) (*V4PagePaginationArray[SubscriptionListResponse], error)` **get** `/accounts/{account_id}/event_subscriptions/subscriptions` Get a paginated list of event subscriptions with optional sorting and filtering ### Parameters - `params SubscriptionListParams` - `AccountID param.Field[string]` Path param: A Resource identifier. - `Direction param.Field[SubscriptionListParamsDirection]` Query param: Sort direction - `const SubscriptionListParamsDirectionAsc SubscriptionListParamsDirection = "asc"` - `const SubscriptionListParamsDirectionDesc SubscriptionListParamsDirection = "desc"` - `Order param.Field[SubscriptionListParamsOrder]` Query param: Field to sort by - `const SubscriptionListParamsOrderCreatedAt SubscriptionListParamsOrder = "created_at"` - `const SubscriptionListParamsOrderName SubscriptionListParamsOrder = "name"` - `const SubscriptionListParamsOrderEnabled SubscriptionListParamsOrder = "enabled"` - `const SubscriptionListParamsOrderSource SubscriptionListParamsOrder = "source"` - `Page param.Field[int64]` Query param: Page number for pagination - `PerPage param.Field[int64]` Query param: Number of items per page ### Returns - `type SubscriptionListResponse struct{…}` - `ID string` Unique identifier for the subscription - `CreatedAt Time` When the subscription was created - `Destination SubscriptionListResponseDestination` Destination configuration for the subscription - `QueueID string` ID of the target queue - `Type SubscriptionListResponseDestinationType` Type of destination - `const SubscriptionListResponseDestinationTypeQueuesQueue SubscriptionListResponseDestinationType = "queues.queue"` - `Enabled bool` Whether the subscription is active - `Events []string` List of event types this subscription handles - `ModifiedAt Time` When the subscription was last modified - `Name string` Name of the subscription - `Source SubscriptionListResponseSource` Source configuration for the subscription - `type SubscriptionListResponseSourceMqEventSourceImages struct{…}` - `Type SubscriptionListResponseSourceMqEventSourceImagesType` Type of source - `const SubscriptionListResponseSourceMqEventSourceImagesTypeImages SubscriptionListResponseSourceMqEventSourceImagesType = "images"` - `type SubscriptionListResponseSourceMqEventSourceKV struct{…}` - `Type SubscriptionListResponseSourceMqEventSourceKVType` Type of source - `const SubscriptionListResponseSourceMqEventSourceKVTypeKV SubscriptionListResponseSourceMqEventSourceKVType = "kv"` - `type SubscriptionListResponseSourceMqEventSourceR2 struct{…}` - `Type SubscriptionListResponseSourceMqEventSourceR2Type` Type of source - `const SubscriptionListResponseSourceMqEventSourceR2TypeR2 SubscriptionListResponseSourceMqEventSourceR2Type = "r2"` - `type SubscriptionListResponseSourceMqEventSourceSuperSlurper struct{…}` - `Type SubscriptionListResponseSourceMqEventSourceSuperSlurperType` Type of source - `const SubscriptionListResponseSourceMqEventSourceSuperSlurperTypeSuperSlurper SubscriptionListResponseSourceMqEventSourceSuperSlurperType = "superSlurper"` - `type SubscriptionListResponseSourceMqEventSourceVectorize struct{…}` - `Type SubscriptionListResponseSourceMqEventSourceVectorizeType` Type of source - `const SubscriptionListResponseSourceMqEventSourceVectorizeTypeVectorize SubscriptionListResponseSourceMqEventSourceVectorizeType = "vectorize"` - `type SubscriptionListResponseSourceMqEventSourceWorkersAIModel struct{…}` - `ModelName string` Name of the Workers AI model - `Type SubscriptionListResponseSourceMqEventSourceWorkersAIModelType` Type of source - `const SubscriptionListResponseSourceMqEventSourceWorkersAIModelTypeWorkersAIModel SubscriptionListResponseSourceMqEventSourceWorkersAIModelType = "workersAi.model"` - `type SubscriptionListResponseSourceMqEventSourceWorkersBuildsWorker struct{…}` - `Type SubscriptionListResponseSourceMqEventSourceWorkersBuildsWorkerType` Type of source - `const SubscriptionListResponseSourceMqEventSourceWorkersBuildsWorkerTypeWorkersBuildsWorker SubscriptionListResponseSourceMqEventSourceWorkersBuildsWorkerType = "workersBuilds.worker"` - `WorkerName string` Name of the worker - `type SubscriptionListResponseSourceMqEventSourceWorkflowsWorkflow struct{…}` - `Type SubscriptionListResponseSourceMqEventSourceWorkflowsWorkflowType` Type of source - `const SubscriptionListResponseSourceMqEventSourceWorkflowsWorkflowTypeWorkflowsWorkflow SubscriptionListResponseSourceMqEventSourceWorkflowsWorkflowType = "workflows.workflow"` - `WorkflowName string` Name of the workflow ### Example ```go 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"), ) page, err := client.Queues.Subscriptions.List(context.TODO(), queues.SubscriptionListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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" } } ], "result_info": { "count": 0, "page": 0, "per_page": 0, "total_count": 0, "total_pages": 0 }, "success": true } ``` ## Get Event Subscription `client.Queues.Subscriptions.Get(ctx, subscriptionID, query) (*SubscriptionGetResponse, error)` **get** `/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}` Get details about an existing event subscription ### Parameters - `subscriptionID string` A Resource identifier. - `query SubscriptionGetParams` - `AccountID param.Field[string]` A Resource identifier. ### Returns - `type SubscriptionGetResponse struct{…}` - `ID string` Unique identifier for the subscription - `CreatedAt Time` When the subscription was created - `Destination SubscriptionGetResponseDestination` Destination configuration for the subscription - `QueueID string` ID of the target queue - `Type SubscriptionGetResponseDestinationType` Type of destination - `const SubscriptionGetResponseDestinationTypeQueuesQueue SubscriptionGetResponseDestinationType = "queues.queue"` - `Enabled bool` Whether the subscription is active - `Events []string` List of event types this subscription handles - `ModifiedAt Time` When the subscription was last modified - `Name string` Name of the subscription - `Source SubscriptionGetResponseSource` Source configuration for the subscription - `type SubscriptionGetResponseSourceMqEventSourceImages struct{…}` - `Type SubscriptionGetResponseSourceMqEventSourceImagesType` Type of source - `const SubscriptionGetResponseSourceMqEventSourceImagesTypeImages SubscriptionGetResponseSourceMqEventSourceImagesType = "images"` - `type SubscriptionGetResponseSourceMqEventSourceKV struct{…}` - `Type SubscriptionGetResponseSourceMqEventSourceKVType` Type of source - `const SubscriptionGetResponseSourceMqEventSourceKVTypeKV SubscriptionGetResponseSourceMqEventSourceKVType = "kv"` - `type SubscriptionGetResponseSourceMqEventSourceR2 struct{…}` - `Type SubscriptionGetResponseSourceMqEventSourceR2Type` Type of source - `const SubscriptionGetResponseSourceMqEventSourceR2TypeR2 SubscriptionGetResponseSourceMqEventSourceR2Type = "r2"` - `type SubscriptionGetResponseSourceMqEventSourceSuperSlurper struct{…}` - `Type SubscriptionGetResponseSourceMqEventSourceSuperSlurperType` Type of source - `const SubscriptionGetResponseSourceMqEventSourceSuperSlurperTypeSuperSlurper SubscriptionGetResponseSourceMqEventSourceSuperSlurperType = "superSlurper"` - `type SubscriptionGetResponseSourceMqEventSourceVectorize struct{…}` - `Type SubscriptionGetResponseSourceMqEventSourceVectorizeType` Type of source - `const SubscriptionGetResponseSourceMqEventSourceVectorizeTypeVectorize SubscriptionGetResponseSourceMqEventSourceVectorizeType = "vectorize"` - `type SubscriptionGetResponseSourceMqEventSourceWorkersAIModel struct{…}` - `ModelName string` Name of the Workers AI model - `Type SubscriptionGetResponseSourceMqEventSourceWorkersAIModelType` Type of source - `const SubscriptionGetResponseSourceMqEventSourceWorkersAIModelTypeWorkersAIModel SubscriptionGetResponseSourceMqEventSourceWorkersAIModelType = "workersAi.model"` - `type SubscriptionGetResponseSourceMqEventSourceWorkersBuildsWorker struct{…}` - `Type SubscriptionGetResponseSourceMqEventSourceWorkersBuildsWorkerType` Type of source - `const SubscriptionGetResponseSourceMqEventSourceWorkersBuildsWorkerTypeWorkersBuildsWorker SubscriptionGetResponseSourceMqEventSourceWorkersBuildsWorkerType = "workersBuilds.worker"` - `WorkerName string` Name of the worker - `type SubscriptionGetResponseSourceMqEventSourceWorkflowsWorkflow struct{…}` - `Type SubscriptionGetResponseSourceMqEventSourceWorkflowsWorkflowType` Type of source - `const SubscriptionGetResponseSourceMqEventSourceWorkflowsWorkflowTypeWorkflowsWorkflow SubscriptionGetResponseSourceMqEventSourceWorkflowsWorkflowType = "workflows.workflow"` - `WorkflowName string` Name of the workflow ### Example ```go 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.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", queues.SubscriptionGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", subscription.ID) } ``` #### Response ```json { "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 } ``` ## Create Event Subscription `client.Queues.Subscriptions.New(ctx, params) (*SubscriptionNewResponse, error)` **post** `/accounts/{account_id}/event_subscriptions/subscriptions` Create a new event subscription for a queue ### Parameters - `params SubscriptionNewParams` - `AccountID param.Field[string]` Path param: A Resource identifier. - `Destination param.Field[SubscriptionNewParamsDestination]` Body param: Destination configuration for the subscription - `QueueID string` ID of the target queue - `Type SubscriptionNewParamsDestinationType` Type of destination - `const SubscriptionNewParamsDestinationTypeQueuesQueue SubscriptionNewParamsDestinationType = "queues.queue"` - `Enabled param.Field[bool]` Body param: Whether the subscription is active - `Events param.Field[[]string]` Body param: List of event types this subscription handles - `Name param.Field[string]` Body param: Name of the subscription - `Source param.Field[SubscriptionNewParamsSource]` Body param: Source configuration for the subscription - `type SubscriptionNewParamsSourceMqEventSourceImages struct{…}` - `Type SubscriptionNewParamsSourceMqEventSourceImagesType` Type of source - `const SubscriptionNewParamsSourceMqEventSourceImagesTypeImages SubscriptionNewParamsSourceMqEventSourceImagesType = "images"` - `type SubscriptionNewParamsSourceMqEventSourceKV struct{…}` - `Type SubscriptionNewParamsSourceMqEventSourceKVType` Type of source - `const SubscriptionNewParamsSourceMqEventSourceKVTypeKV SubscriptionNewParamsSourceMqEventSourceKVType = "kv"` - `type SubscriptionNewParamsSourceMqEventSourceR2 struct{…}` - `Type SubscriptionNewParamsSourceMqEventSourceR2Type` Type of source - `const SubscriptionNewParamsSourceMqEventSourceR2TypeR2 SubscriptionNewParamsSourceMqEventSourceR2Type = "r2"` - `type SubscriptionNewParamsSourceMqEventSourceSuperSlurper struct{…}` - `Type SubscriptionNewParamsSourceMqEventSourceSuperSlurperType` Type of source - `const SubscriptionNewParamsSourceMqEventSourceSuperSlurperTypeSuperSlurper SubscriptionNewParamsSourceMqEventSourceSuperSlurperType = "superSlurper"` - `type SubscriptionNewParamsSourceMqEventSourceVectorize struct{…}` - `Type SubscriptionNewParamsSourceMqEventSourceVectorizeType` Type of source - `const SubscriptionNewParamsSourceMqEventSourceVectorizeTypeVectorize SubscriptionNewParamsSourceMqEventSourceVectorizeType = "vectorize"` - `type SubscriptionNewParamsSourceMqEventSourceWorkersAIModel struct{…}` - `ModelName string` Name of the Workers AI model - `Type SubscriptionNewParamsSourceMqEventSourceWorkersAIModelType` Type of source - `const SubscriptionNewParamsSourceMqEventSourceWorkersAIModelTypeWorkersAIModel SubscriptionNewParamsSourceMqEventSourceWorkersAIModelType = "workersAi.model"` - `type SubscriptionNewParamsSourceMqEventSourceWorkersBuildsWorker struct{…}` - `Type SubscriptionNewParamsSourceMqEventSourceWorkersBuildsWorkerType` Type of source - `const SubscriptionNewParamsSourceMqEventSourceWorkersBuildsWorkerTypeWorkersBuildsWorker SubscriptionNewParamsSourceMqEventSourceWorkersBuildsWorkerType = "workersBuilds.worker"` - `WorkerName string` Name of the worker - `type SubscriptionNewParamsSourceMqEventSourceWorkflowsWorkflow struct{…}` - `Type SubscriptionNewParamsSourceMqEventSourceWorkflowsWorkflowType` Type of source - `const SubscriptionNewParamsSourceMqEventSourceWorkflowsWorkflowTypeWorkflowsWorkflow SubscriptionNewParamsSourceMqEventSourceWorkflowsWorkflowType = "workflows.workflow"` - `WorkflowName string` Name of the workflow ### Returns - `type SubscriptionNewResponse struct{…}` - `ID string` Unique identifier for the subscription - `CreatedAt Time` When the subscription was created - `Destination SubscriptionNewResponseDestination` Destination configuration for the subscription - `QueueID string` ID of the target queue - `Type SubscriptionNewResponseDestinationType` Type of destination - `const SubscriptionNewResponseDestinationTypeQueuesQueue SubscriptionNewResponseDestinationType = "queues.queue"` - `Enabled bool` Whether the subscription is active - `Events []string` List of event types this subscription handles - `ModifiedAt Time` When the subscription was last modified - `Name string` Name of the subscription - `Source SubscriptionNewResponseSource` Source configuration for the subscription - `type SubscriptionNewResponseSourceMqEventSourceImages struct{…}` - `Type SubscriptionNewResponseSourceMqEventSourceImagesType` Type of source - `const SubscriptionNewResponseSourceMqEventSourceImagesTypeImages SubscriptionNewResponseSourceMqEventSourceImagesType = "images"` - `type SubscriptionNewResponseSourceMqEventSourceKV struct{…}` - `Type SubscriptionNewResponseSourceMqEventSourceKVType` Type of source - `const SubscriptionNewResponseSourceMqEventSourceKVTypeKV SubscriptionNewResponseSourceMqEventSourceKVType = "kv"` - `type SubscriptionNewResponseSourceMqEventSourceR2 struct{…}` - `Type SubscriptionNewResponseSourceMqEventSourceR2Type` Type of source - `const SubscriptionNewResponseSourceMqEventSourceR2TypeR2 SubscriptionNewResponseSourceMqEventSourceR2Type = "r2"` - `type SubscriptionNewResponseSourceMqEventSourceSuperSlurper struct{…}` - `Type SubscriptionNewResponseSourceMqEventSourceSuperSlurperType` Type of source - `const SubscriptionNewResponseSourceMqEventSourceSuperSlurperTypeSuperSlurper SubscriptionNewResponseSourceMqEventSourceSuperSlurperType = "superSlurper"` - `type SubscriptionNewResponseSourceMqEventSourceVectorize struct{…}` - `Type SubscriptionNewResponseSourceMqEventSourceVectorizeType` Type of source - `const SubscriptionNewResponseSourceMqEventSourceVectorizeTypeVectorize SubscriptionNewResponseSourceMqEventSourceVectorizeType = "vectorize"` - `type SubscriptionNewResponseSourceMqEventSourceWorkersAIModel struct{…}` - `ModelName string` Name of the Workers AI model - `Type SubscriptionNewResponseSourceMqEventSourceWorkersAIModelType` Type of source - `const SubscriptionNewResponseSourceMqEventSourceWorkersAIModelTypeWorkersAIModel SubscriptionNewResponseSourceMqEventSourceWorkersAIModelType = "workersAi.model"` - `type SubscriptionNewResponseSourceMqEventSourceWorkersBuildsWorker struct{…}` - `Type SubscriptionNewResponseSourceMqEventSourceWorkersBuildsWorkerType` Type of source - `const SubscriptionNewResponseSourceMqEventSourceWorkersBuildsWorkerTypeWorkersBuildsWorker SubscriptionNewResponseSourceMqEventSourceWorkersBuildsWorkerType = "workersBuilds.worker"` - `WorkerName string` Name of the worker - `type SubscriptionNewResponseSourceMqEventSourceWorkflowsWorkflow struct{…}` - `Type SubscriptionNewResponseSourceMqEventSourceWorkflowsWorkflowType` Type of source - `const SubscriptionNewResponseSourceMqEventSourceWorkflowsWorkflowTypeWorkflowsWorkflow SubscriptionNewResponseSourceMqEventSourceWorkflowsWorkflowType = "workflows.workflow"` - `WorkflowName string` Name of the workflow ### Example ```go 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.New(context.TODO(), queues.SubscriptionNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", subscription.ID) } ``` #### Response ```json { "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 } ``` ## 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 ### Parameters - `subscriptionID string` A Resource identifier. - `params SubscriptionUpdateParams` - `AccountID param.Field[string]` Path param: A Resource identifier. - `Destination param.Field[SubscriptionUpdateParamsDestination]` Body param: Destination configuration for the subscription - `QueueID string` ID of the target queue - `Type SubscriptionUpdateParamsDestinationType` Type of destination - `const SubscriptionUpdateParamsDestinationTypeQueuesQueue SubscriptionUpdateParamsDestinationType = "queues.queue"` - `Enabled param.Field[bool]` Body param: Whether the subscription is active - `Events param.Field[[]string]` Body param: List of event types this subscription handles - `Name param.Field[string]` Body param: Name of the subscription ### Returns - `type SubscriptionUpdateResponse struct{…}` - `ID string` Unique identifier for the subscription - `CreatedAt Time` When the subscription was created - `Destination SubscriptionUpdateResponseDestination` Destination configuration for the subscription - `QueueID string` ID of the target queue - `Type SubscriptionUpdateResponseDestinationType` Type of destination - `const SubscriptionUpdateResponseDestinationTypeQueuesQueue SubscriptionUpdateResponseDestinationType = "queues.queue"` - `Enabled bool` Whether the subscription is active - `Events []string` List of event types this subscription handles - `ModifiedAt Time` When the subscription was last modified - `Name string` Name of the subscription - `Source SubscriptionUpdateResponseSource` Source configuration for the subscription - `type SubscriptionUpdateResponseSourceMqEventSourceImages struct{…}` - `Type SubscriptionUpdateResponseSourceMqEventSourceImagesType` Type of source - `const SubscriptionUpdateResponseSourceMqEventSourceImagesTypeImages SubscriptionUpdateResponseSourceMqEventSourceImagesType = "images"` - `type SubscriptionUpdateResponseSourceMqEventSourceKV struct{…}` - `Type SubscriptionUpdateResponseSourceMqEventSourceKVType` Type of source - `const SubscriptionUpdateResponseSourceMqEventSourceKVTypeKV SubscriptionUpdateResponseSourceMqEventSourceKVType = "kv"` - `type SubscriptionUpdateResponseSourceMqEventSourceR2 struct{…}` - `Type SubscriptionUpdateResponseSourceMqEventSourceR2Type` Type of source - `const SubscriptionUpdateResponseSourceMqEventSourceR2TypeR2 SubscriptionUpdateResponseSourceMqEventSourceR2Type = "r2"` - `type SubscriptionUpdateResponseSourceMqEventSourceSuperSlurper struct{…}` - `Type SubscriptionUpdateResponseSourceMqEventSourceSuperSlurperType` Type of source - `const SubscriptionUpdateResponseSourceMqEventSourceSuperSlurperTypeSuperSlurper SubscriptionUpdateResponseSourceMqEventSourceSuperSlurperType = "superSlurper"` - `type SubscriptionUpdateResponseSourceMqEventSourceVectorize struct{…}` - `Type SubscriptionUpdateResponseSourceMqEventSourceVectorizeType` Type of source - `const SubscriptionUpdateResponseSourceMqEventSourceVectorizeTypeVectorize SubscriptionUpdateResponseSourceMqEventSourceVectorizeType = "vectorize"` - `type SubscriptionUpdateResponseSourceMqEventSourceWorkersAIModel struct{…}` - `ModelName string` Name of the Workers AI model - `Type SubscriptionUpdateResponseSourceMqEventSourceWorkersAIModelType` Type of source - `const SubscriptionUpdateResponseSourceMqEventSourceWorkersAIModelTypeWorkersAIModel SubscriptionUpdateResponseSourceMqEventSourceWorkersAIModelType = "workersAi.model"` - `type SubscriptionUpdateResponseSourceMqEventSourceWorkersBuildsWorker struct{…}` - `Type SubscriptionUpdateResponseSourceMqEventSourceWorkersBuildsWorkerType` Type of source - `const SubscriptionUpdateResponseSourceMqEventSourceWorkersBuildsWorkerTypeWorkersBuildsWorker SubscriptionUpdateResponseSourceMqEventSourceWorkersBuildsWorkerType = "workersBuilds.worker"` - `WorkerName string` Name of the worker - `type SubscriptionUpdateResponseSourceMqEventSourceWorkflowsWorkflow struct{…}` - `Type SubscriptionUpdateResponseSourceMqEventSourceWorkflowsWorkflowType` Type of source - `const SubscriptionUpdateResponseSourceMqEventSourceWorkflowsWorkflowTypeWorkflowsWorkflow SubscriptionUpdateResponseSourceMqEventSourceWorkflowsWorkflowType = "workflows.workflow"` - `WorkflowName string` Name of the workflow ### Example ```go 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) } ``` #### Response ```json { "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 } ``` ## Delete Event Subscription `client.Queues.Subscriptions.Delete(ctx, subscriptionID, body) (*SubscriptionDeleteResponse, error)` **delete** `/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}` Delete an existing event subscription ### Parameters - `subscriptionID string` A Resource identifier. - `body SubscriptionDeleteParams` - `AccountID param.Field[string]` A Resource identifier. ### Returns - `type SubscriptionDeleteResponse struct{…}` - `ID string` Unique identifier for the subscription - `CreatedAt Time` When the subscription was created - `Destination SubscriptionDeleteResponseDestination` Destination configuration for the subscription - `QueueID string` ID of the target queue - `Type SubscriptionDeleteResponseDestinationType` Type of destination - `const SubscriptionDeleteResponseDestinationTypeQueuesQueue SubscriptionDeleteResponseDestinationType = "queues.queue"` - `Enabled bool` Whether the subscription is active - `Events []string` List of event types this subscription handles - `ModifiedAt Time` When the subscription was last modified - `Name string` Name of the subscription - `Source SubscriptionDeleteResponseSource` Source configuration for the subscription - `type SubscriptionDeleteResponseSourceMqEventSourceImages struct{…}` - `Type SubscriptionDeleteResponseSourceMqEventSourceImagesType` Type of source - `const SubscriptionDeleteResponseSourceMqEventSourceImagesTypeImages SubscriptionDeleteResponseSourceMqEventSourceImagesType = "images"` - `type SubscriptionDeleteResponseSourceMqEventSourceKV struct{…}` - `Type SubscriptionDeleteResponseSourceMqEventSourceKVType` Type of source - `const SubscriptionDeleteResponseSourceMqEventSourceKVTypeKV SubscriptionDeleteResponseSourceMqEventSourceKVType = "kv"` - `type SubscriptionDeleteResponseSourceMqEventSourceR2 struct{…}` - `Type SubscriptionDeleteResponseSourceMqEventSourceR2Type` Type of source - `const SubscriptionDeleteResponseSourceMqEventSourceR2TypeR2 SubscriptionDeleteResponseSourceMqEventSourceR2Type = "r2"` - `type SubscriptionDeleteResponseSourceMqEventSourceSuperSlurper struct{…}` - `Type SubscriptionDeleteResponseSourceMqEventSourceSuperSlurperType` Type of source - `const SubscriptionDeleteResponseSourceMqEventSourceSuperSlurperTypeSuperSlurper SubscriptionDeleteResponseSourceMqEventSourceSuperSlurperType = "superSlurper"` - `type SubscriptionDeleteResponseSourceMqEventSourceVectorize struct{…}` - `Type SubscriptionDeleteResponseSourceMqEventSourceVectorizeType` Type of source - `const SubscriptionDeleteResponseSourceMqEventSourceVectorizeTypeVectorize SubscriptionDeleteResponseSourceMqEventSourceVectorizeType = "vectorize"` - `type SubscriptionDeleteResponseSourceMqEventSourceWorkersAIModel struct{…}` - `ModelName string` Name of the Workers AI model - `Type SubscriptionDeleteResponseSourceMqEventSourceWorkersAIModelType` Type of source - `const SubscriptionDeleteResponseSourceMqEventSourceWorkersAIModelTypeWorkersAIModel SubscriptionDeleteResponseSourceMqEventSourceWorkersAIModelType = "workersAi.model"` - `type SubscriptionDeleteResponseSourceMqEventSourceWorkersBuildsWorker struct{…}` - `Type SubscriptionDeleteResponseSourceMqEventSourceWorkersBuildsWorkerType` Type of source - `const SubscriptionDeleteResponseSourceMqEventSourceWorkersBuildsWorkerTypeWorkersBuildsWorker SubscriptionDeleteResponseSourceMqEventSourceWorkersBuildsWorkerType = "workersBuilds.worker"` - `WorkerName string` Name of the worker - `type SubscriptionDeleteResponseSourceMqEventSourceWorkflowsWorkflow struct{…}` - `Type SubscriptionDeleteResponseSourceMqEventSourceWorkflowsWorkflowType` Type of source - `const SubscriptionDeleteResponseSourceMqEventSourceWorkflowsWorkflowTypeWorkflowsWorkflow SubscriptionDeleteResponseSourceMqEventSourceWorkflowsWorkflowType = "workflows.workflow"` - `WorkflowName string` Name of the workflow ### Example ```go 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.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", queues.SubscriptionDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", subscription.ID) } ``` #### Response ```json { "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 } ```