# Queues ## List Queues `client.queues.list(QueueListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/queues` Returns the queues owned by an account. ### Parameters - `params: QueueListParams` - `account_id: string` A Resource identifier. ### Returns - `Queue` - `consumers?: Array` - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` - `consumers_total_count?: number` - `created_on?: string` - `modified_on?: string` - `producers?: Array` - `MqWorkerProducer` - `script?: string` - `type?: "worker"` - `"worker"` - `MqR2Producer` - `bucket_name?: string` - `type?: "r2_bucket"` - `"r2_bucket"` - `producers_total_count?: number` - `queue_id?: string` - `queue_name?: string` - `settings?: Settings` - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const queue of client.queues.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' })) { console.log(queue.queue_id); } ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": [ { "consumers": [ { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" } ], "consumers_total_count": 0, "created_on": "created_on", "modified_on": "modified_on", "producers": [ { "script": "script", "type": "worker" } ], "producers_total_count": 0, "queue_id": "queue_id", "queue_name": "example-queue", "settings": { "delivery_delay": 5, "delivery_paused": true, "message_retention_period": 345600 } } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 }, "success": true } ``` ## Get Queue `client.queues.get(stringqueueId, QueueGetParamsparams, RequestOptionsoptions?): Queue` **get** `/accounts/{account_id}/queues/{queue_id}` Get details about a specific queue. ### Parameters - `queueId: string` A Resource identifier. - `params: QueueGetParams` - `account_id: string` A Resource identifier. ### Returns - `Queue` - `consumers?: Array` - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` - `consumers_total_count?: number` - `created_on?: string` - `modified_on?: string` - `producers?: Array` - `MqWorkerProducer` - `script?: string` - `type?: "worker"` - `"worker"` - `MqR2Producer` - `bucket_name?: string` - `type?: "r2_bucket"` - `"r2_bucket"` - `producers_total_count?: number` - `queue_id?: string` - `queue_name?: string` - `settings?: Settings` - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const queue = await client.queues.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(queue.queue_id); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "consumers": [ { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" } ], "consumers_total_count": 0, "created_on": "created_on", "modified_on": "modified_on", "producers": [ { "script": "script", "type": "worker" } ], "producers_total_count": 0, "queue_id": "queue_id", "queue_name": "example-queue", "settings": { "delivery_delay": 5, "delivery_paused": true, "message_retention_period": 345600 } }, "success": true } ``` ## Create Queue `client.queues.create(QueueCreateParamsparams, RequestOptionsoptions?): Queue` **post** `/accounts/{account_id}/queues` Create a new queue ### Parameters - `params: QueueCreateParams` - `account_id: string` Path param: A Resource identifier. - `queue_name: string` Body param ### Returns - `Queue` - `consumers?: Array` - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` - `consumers_total_count?: number` - `created_on?: string` - `modified_on?: string` - `producers?: Array` - `MqWorkerProducer` - `script?: string` - `type?: "worker"` - `"worker"` - `MqR2Producer` - `bucket_name?: string` - `type?: "r2_bucket"` - `"r2_bucket"` - `producers_total_count?: number` - `queue_id?: string` - `queue_name?: string` - `settings?: Settings` - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const queue = await client.queues.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', queue_name: 'example-queue', }); console.log(queue.queue_id); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "consumers": [ { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" } ], "consumers_total_count": 0, "created_on": "created_on", "modified_on": "modified_on", "producers": [ { "script": "script", "type": "worker" } ], "producers_total_count": 0, "queue_id": "queue_id", "queue_name": "example-queue", "settings": { "delivery_delay": 5, "delivery_paused": true, "message_retention_period": 345600 } }, "success": true } ``` ## Update Queue `client.queues.update(stringqueueId, QueueUpdateParamsparams, RequestOptionsoptions?): Queue` **put** `/accounts/{account_id}/queues/{queue_id}` Updates a Queue. Note that this endpoint does not support partial updates. If successful, the Queue's configuration is overwritten with the supplied configuration. ### Parameters - `queueId: string` A Resource identifier. - `params: QueueUpdateParams` - `account_id: string` Path param: A Resource identifier. - `queue_name?: string` Body param - `settings?: Settings` Body param - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Returns - `Queue` - `consumers?: Array` - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` - `consumers_total_count?: number` - `created_on?: string` - `modified_on?: string` - `producers?: Array` - `MqWorkerProducer` - `script?: string` - `type?: "worker"` - `"worker"` - `MqR2Producer` - `bucket_name?: string` - `type?: "r2_bucket"` - `"r2_bucket"` - `producers_total_count?: number` - `queue_id?: string` - `queue_name?: string` - `settings?: Settings` - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const queue = await client.queues.update('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(queue.queue_id); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "consumers": [ { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" } ], "consumers_total_count": 0, "created_on": "created_on", "modified_on": "modified_on", "producers": [ { "script": "script", "type": "worker" } ], "producers_total_count": 0, "queue_id": "queue_id", "queue_name": "example-queue", "settings": { "delivery_delay": 5, "delivery_paused": true, "message_retention_period": 345600 } }, "success": true } ``` ## Update Queue `client.queues.edit(stringqueueId, QueueEditParamsparams, RequestOptionsoptions?): Queue` **patch** `/accounts/{account_id}/queues/{queue_id}` Updates a Queue. ### Parameters - `queueId: string` A Resource identifier. - `params: QueueEditParams` - `account_id: string` Path param: A Resource identifier. - `queue_name?: string` Body param - `settings?: Settings` Body param - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Returns - `Queue` - `consumers?: Array` - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` - `consumers_total_count?: number` - `created_on?: string` - `modified_on?: string` - `producers?: Array` - `MqWorkerProducer` - `script?: string` - `type?: "worker"` - `"worker"` - `MqR2Producer` - `bucket_name?: string` - `type?: "r2_bucket"` - `"r2_bucket"` - `producers_total_count?: number` - `queue_id?: string` - `queue_name?: string` - `settings?: Settings` - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const queue = await client.queues.edit('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(queue.queue_id); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "consumers": [ { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" } ], "consumers_total_count": 0, "created_on": "created_on", "modified_on": "modified_on", "producers": [ { "script": "script", "type": "worker" } ], "producers_total_count": 0, "queue_id": "queue_id", "queue_name": "example-queue", "settings": { "delivery_delay": 5, "delivery_paused": true, "message_retention_period": 345600 } }, "success": true } ``` ## Delete Queue `client.queues.delete(stringqueueId, QueueDeleteParamsparams, RequestOptionsoptions?): QueueDeleteResponse` **delete** `/accounts/{account_id}/queues/{queue_id}` Deletes a queue ### Parameters - `queueId: string` A Resource identifier. - `params: QueueDeleteParams` - `account_id: string` A Resource identifier. ### Returns - `QueueDeleteResponse` - `errors?: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages?: Array` - `success?: true` Indicates if the API call was successful or not. - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const queue = await client.queues.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(queue.errors); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "success": true } ``` ## Domain Types ### Queue - `Queue` - `consumers?: Array` - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` - `consumers_total_count?: number` - `created_on?: string` - `modified_on?: string` - `producers?: Array` - `MqWorkerProducer` - `script?: string` - `type?: "worker"` - `"worker"` - `MqR2Producer` - `bucket_name?: string` - `type?: "r2_bucket"` - `"r2_bucket"` - `producers_total_count?: number` - `queue_id?: string` - `queue_name?: string` - `settings?: Settings` - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Queue Delete Response - `QueueDeleteResponse` - `errors?: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages?: Array` - `success?: true` Indicates if the API call was successful or not. - `true` # Messages ## Push Message `client.queues.messages.push(stringqueueId, MessagePushParamsparams, RequestOptionsoptions?): MessagePushResponse` **post** `/accounts/{account_id}/queues/{queue_id}/messages` Push a message to a Queue ### Parameters - `queueId: string` A Resource identifier. - `MessagePushParams = MqQueueMessageText | MqQueueMessageJson` - `MessagePushParamsBase` - `MqQueueMessageText extends MessagePushParamsBase` - `MqQueueMessageJson extends MessagePushParamsBase` ### Returns - `MessagePushResponse` - `errors?: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages?: Array` - `success?: true` Indicates if the API call was successful or not. - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.queues.messages.push('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.errors); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "success": true } ``` ## Acknowledge + Retry Queue Messages `client.queues.messages.ack(stringqueueId, MessageAckParamsparams, RequestOptionsoptions?): MessageAckResponse` **post** `/accounts/{account_id}/queues/{queue_id}/messages/ack` Acknowledge + Retry messages from a Queue ### Parameters - `queueId: string` A Resource identifier. - `params: MessageAckParams` - `account_id: string` Path param: A Resource identifier. - `acks?: Array` Body param - `lease_id?: string` An ID that represents an "in-flight" message that has been pulled from a Queue. You must hold on to this ID and use it to acknowledge this message. - `retries?: Array` Body param - `delay_seconds?: number` The number of seconds to delay before making the message available for another attempt. - `lease_id?: string` An ID that represents an "in-flight" message that has been pulled from a Queue. You must hold on to this ID and use it to acknowledge this message. ### Returns - `MessageAckResponse` - `ackCount?: number` The number of messages that were succesfully acknowledged. - `retryCount?: number` The number of messages that were succesfully retried. - `warnings?: Array` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.queues.messages.ack('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.ackCount); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "ackCount": 5, "retryCount": 5, "warnings": [ "string" ] }, "success": true } ``` ## Pull Queue Messages `client.queues.messages.pull(stringqueueId, MessagePullParamsparams, RequestOptionsoptions?): MessagePullResponse` **post** `/accounts/{account_id}/queues/{queue_id}/messages/pull` Pull a batch of messages from a Queue ### Parameters - `queueId: string` A Resource identifier. - `params: MessagePullParams` - `account_id: string` Path param: A Resource identifier. - `batch_size?: number` Body param: The maximum number of messages to include in a batch. - `visibility_timeout_ms?: number` Body param: The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. ### Returns - `MessagePullResponse` - `message_backlog_count?: number` The number of unacknowledged messages in the queue - `messages?: Array` - `id?: string` - `attempts?: number` - `body?: string` - `lease_id?: string` An ID that represents an "in-flight" message that has been pulled from a Queue. You must hold on to this ID and use it to acknowledge this message. - `metadata?: unknown` - `timestamp_ms?: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.queues.messages.pull('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.message_backlog_count); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "message_backlog_count": 5, "messages": [ { "id": "b01b5594f784d0165c2985833f5660dd", "attempts": 1, "body": "hello world", "lease_id": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0..Q8p21d7dceR6vUfwftONdQ.JVqZgAS-Zk7MqmqccYtTHeeMElNHaOMigeWdb8LyMOg.T2_HV99CYzGaQuhTyW8RsgbnpTRZHRM6N7UoSaAKeK0", "metadata": { "CF-Content-Type": "text", "CF-sourceMessageSource": "dash" }, "timestamp_ms": 1710950954154 } ] }, "success": true } ``` ## Push Message Batch `client.queues.messages.bulkPush(stringqueueId, MessageBulkPushParamsparams, RequestOptionsoptions?): MessageBulkPushResponse` **post** `/accounts/{account_id}/queues/{queue_id}/messages/batch` Push a batch of message to a Queue ### Parameters - `queueId: string` A Resource identifier. - `params: MessageBulkPushParams` - `account_id: string` Path param: A Resource identifier. - `delay_seconds?: number` Body param: The number of seconds to wait for attempting to deliver this batch to consumers - `messages?: Array` Body param - `MqQueueMessageText` - `body?: string` - `content_type?: "text"` - `"text"` - `delay_seconds?: number` The number of seconds to wait for attempting to deliver this message to consumers - `MqQueueMessageJson` - `body?: unknown` - `content_type?: "json"` - `"json"` - `delay_seconds?: number` The number of seconds to wait for attempting to deliver this message to consumers ### Returns - `MessageBulkPushResponse` - `errors?: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages?: Array` - `success?: true` Indicates if the API call was successful or not. - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.queues.messages.bulkPush('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.errors); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "success": true } ``` ## Domain Types ### Message Push Response - `MessagePushResponse` - `errors?: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages?: Array` - `success?: true` Indicates if the API call was successful or not. - `true` ### Message Ack Response - `MessageAckResponse` - `ackCount?: number` The number of messages that were succesfully acknowledged. - `retryCount?: number` The number of messages that were succesfully retried. - `warnings?: Array` ### Message Pull Response - `MessagePullResponse` - `message_backlog_count?: number` The number of unacknowledged messages in the queue - `messages?: Array` - `id?: string` - `attempts?: number` - `body?: string` - `lease_id?: string` An ID that represents an "in-flight" message that has been pulled from a Queue. You must hold on to this ID and use it to acknowledge this message. - `metadata?: unknown` - `timestamp_ms?: number` ### Message Bulk Push Response - `MessageBulkPushResponse` - `errors?: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages?: Array` - `success?: true` Indicates if the API call was successful or not. - `true` # Purge ## Get Queue Purge Status `client.queues.purge.status(stringqueueId, PurgeStatusParamsparams, RequestOptionsoptions?): PurgeStatusResponse` **get** `/accounts/{account_id}/queues/{queue_id}/purge` Get details about a Queue's purge status. ### Parameters - `queueId: string` A Resource identifier. - `params: PurgeStatusParams` - `account_id: string` A Resource identifier. ### Returns - `PurgeStatusResponse` - `completed?: string` Indicates if the last purge operation completed successfully. - `started_at?: string` Timestamp when the last purge operation started. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.queues.purge.status('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.completed); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "completed": "completed", "started_at": "started_at" }, "success": true } ``` ## Purge Queue `client.queues.purge.start(stringqueueId, PurgeStartParamsparams, RequestOptionsoptions?): Queue` **post** `/accounts/{account_id}/queues/{queue_id}/purge` Deletes all messages from the Queue. ### Parameters - `queueId: string` A Resource identifier. - `params: PurgeStartParams` - `account_id: string` Path param: A Resource identifier. - `delete_messages_permanently?: boolean` Body param: Confimation that all messages will be deleted permanently. ### Returns - `Queue` - `consumers?: Array` - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` - `consumers_total_count?: number` - `created_on?: string` - `modified_on?: string` - `producers?: Array` - `MqWorkerProducer` - `script?: string` - `type?: "worker"` - `"worker"` - `MqR2Producer` - `bucket_name?: string` - `type?: "r2_bucket"` - `"r2_bucket"` - `producers_total_count?: number` - `queue_id?: string` - `queue_name?: string` - `settings?: Settings` - `delivery_delay?: number` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused?: boolean` Indicates if message delivery to consumers is currently paused. - `message_retention_period?: number` Number of seconds after which an unconsumed message will be delayed. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const queue = await client.queues.purge.start('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(queue.queue_id); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "consumers": [ { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" } ], "consumers_total_count": 0, "created_on": "created_on", "modified_on": "modified_on", "producers": [ { "script": "script", "type": "worker" } ], "producers_total_count": 0, "queue_id": "queue_id", "queue_name": "example-queue", "settings": { "delivery_delay": 5, "delivery_paused": true, "message_retention_period": 345600 } }, "success": true } ``` ## Domain Types ### Purge Status Response - `PurgeStatusResponse` - `completed?: string` Indicates if the last purge operation completed successfully. - `started_at?: string` Timestamp when the last purge operation started. # Consumers ## List Queue Consumers `client.queues.consumers.list(stringqueueId, ConsumerListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/queues/{queue_id}/consumers` Returns the consumers for a Queue ### Parameters - `queueId: string` A Resource identifier. - `params: ConsumerListParams` - `account_id: string` A Resource identifier. ### Returns - `Consumer = MqWorkerConsumerResponse | MqHTTPConsumerResponse` Response body representing a consumer - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const consumer of client.queues.consumers.list('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(consumer); } ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": [ { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" } ], "success": true } ``` ## Get Queue Consumer `client.queues.consumers.get(stringqueueId, stringconsumerId, ConsumerGetParamsparams, RequestOptionsoptions?): Consumer` **get** `/accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}` Fetches the consumer for a queue by consumer id ### Parameters - `queueId: string` A Resource identifier. - `consumerId: string` A Resource identifier. - `params: ConsumerGetParams` - `account_id: string` A Resource identifier. ### Returns - `Consumer = MqWorkerConsumerResponse | MqHTTPConsumerResponse` Response body representing a consumer - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const consumer = await client.queues.consumers.get( '023e105f4ecef8ad9ca31a8372d0c353', '023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(consumer); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" }, "success": true } ``` ## Create a Queue Consumer `client.queues.consumers.create(stringqueueId, ConsumerCreateParamsparams, RequestOptionsoptions?): Consumer` **post** `/accounts/{account_id}/queues/{queue_id}/consumers` Creates a new consumer for a Queue ### Parameters - `queueId: string` A Resource identifier. - `ConsumerCreateParams = MqWorkerConsumerRequest | MqHTTPConsumerRequest` - `ConsumerCreateParamsBase` - `MqWorkerConsumerRequest extends ConsumerCreateParamsBase` - `MqHTTPConsumerRequest extends ConsumerCreateParamsBase` ### Returns - `Consumer = MqWorkerConsumerResponse | MqHTTPConsumerResponse` Response body representing a consumer - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const consumer = await client.queues.consumers.create('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', script_name: 'my-consumer-worker', type: 'worker', }); console.log(consumer); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" }, "success": true } ``` ## Update Queue Consumer `client.queues.consumers.update(stringqueueId, stringconsumerId, ConsumerUpdateParamsparams, RequestOptionsoptions?): Consumer` **put** `/accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}` Updates the consumer for a queue, or creates one if it does not exist. ### Parameters - `queueId: string` A Resource identifier. - `consumerId: string` A Resource identifier. - `ConsumerUpdateParams = MqWorkerConsumerRequest | MqHTTPConsumerRequest` - `ConsumerUpdateParamsBase` - `MqWorkerConsumerRequest extends ConsumerUpdateParamsBase` - `MqHTTPConsumerRequest extends ConsumerUpdateParamsBase` ### Returns - `Consumer = MqWorkerConsumerResponse | MqHTTPConsumerResponse` Response body representing a consumer - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const consumer = await client.queues.consumers.update( '023e105f4ecef8ad9ca31a8372d0c353', '023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', script_name: 'my-consumer-worker', type: 'worker', }, ); console.log(consumer); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": { "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2019-12-27T18:11:19.117Z", "dead_letter_queue": "dead_letter_queue", "queue_name": "example-queue", "script_name": "my-consumer-worker", "settings": { "batch_size": 50, "max_concurrency": 10, "max_retries": 3, "max_wait_time_ms": 5000, "retry_delay": 10 }, "type": "worker" }, "success": true } ``` ## Delete Queue Consumer `client.queues.consumers.delete(stringqueueId, stringconsumerId, ConsumerDeleteParamsparams, RequestOptionsoptions?): ConsumerDeleteResponse` **delete** `/accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}` Deletes the consumer for a queue. ### Parameters - `queueId: string` A Resource identifier. - `consumerId: string` A Resource identifier. - `params: ConsumerDeleteParams` - `account_id: string` A Resource identifier. ### Returns - `ConsumerDeleteResponse` - `errors?: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages?: Array` - `success?: true` Indicates if the API call was successful or not. - `true` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const consumer = await client.queues.consumers.delete( '023e105f4ecef8ad9ca31a8372d0c353', '023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(consumer.errors); ``` #### Response ```json { "errors": [ { "code": 7003, "message": "No route for the URI", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "success": true } ``` ## Domain Types ### Consumer - `Consumer = MqWorkerConsumerResponse | MqHTTPConsumerResponse` Response body representing a consumer - `MqWorkerConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `script_name?: string` Name of a Worker - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_concurrency?: number` Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended). - `max_retries?: number` The maximum number of retries - `max_wait_time_ms?: number` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `type?: "worker"` - `"worker"` - `MqHTTPConsumerResponse` - `consumer_id?: string` A Resource identifier. - `created_on?: string` - `dead_letter_queue?: string` Name of the dead letter queue, or empty string if not configured - `queue_name?: string` - `settings?: Settings` - `batch_size?: number` The maximum number of messages to include in a batch. - `max_retries?: number` The maximum number of retries - `retry_delay?: number` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms?: number` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type?: "http_pull"` - `"http_pull"` ### Consumer Delete Response - `ConsumerDeleteResponse` - `errors?: Array` - `code: number` - `message: string` - `documentation_url?: string` - `source?: Source` - `pointer?: string` - `messages?: Array` - `success?: true` Indicates if the API call was successful or not. - `true` # Subscriptions ## List Event Subscriptions `client.queues.subscriptions.list(SubscriptionListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/event_subscriptions/subscriptions` Get a paginated list of event subscriptions with optional sorting and filtering ### Parameters - `params: SubscriptionListParams` - `account_id: string` Path param: A Resource identifier. - `direction?: "asc" | "desc"` Query param: Sort direction - `"asc"` - `"desc"` - `order?: "created_at" | "name" | "enabled" | "source"` Query param: Field to sort by - `"created_at"` - `"name"` - `"enabled"` - `"source"` - `page?: number` Query param: Page number for pagination - `per_page?: number` Query param: Number of items per page ### Returns - `SubscriptionListResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const subscriptionListResponse of client.queues.subscriptions.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(subscriptionListResponse.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" } } ], "result_info": { "count": 0, "page": 0, "per_page": 0, "total_count": 0, "total_pages": 0 }, "success": true } ``` ## Get Event Subscription `client.queues.subscriptions.get(stringsubscriptionId, SubscriptionGetParamsparams, RequestOptionsoptions?): SubscriptionGetResponse` **get** `/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}` Get details about an existing event subscription ### Parameters - `subscriptionId: string` A Resource identifier. - `params: SubscriptionGetParams` - `account_id: string` A Resource identifier. ### Returns - `SubscriptionGetResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const subscription = await client.queues.subscriptions.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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.create(SubscriptionCreateParamsparams, RequestOptionsoptions?): SubscriptionCreateResponse` **post** `/accounts/{account_id}/event_subscriptions/subscriptions` Create a new event subscription for a queue ### Parameters - `params: SubscriptionCreateParams` - `account_id: string` Path param: A Resource identifier. - `destination?: Destination` Body param: Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled?: boolean` Body param: Whether the subscription is active - `events?: Array` Body param: List of event types this subscription handles - `name?: string` Body param: Name of the subscription - `source?: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Body param: Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Returns - `SubscriptionCreateResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const subscription = await client.queues.subscriptions.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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(stringsubscriptionId, SubscriptionUpdateParamsparams, RequestOptionsoptions?): SubscriptionUpdateResponse` **patch** `/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}` Update an existing event subscription ### Parameters - `subscriptionId: string` A Resource identifier. - `params: SubscriptionUpdateParams` - `account_id: string` Path param: A Resource identifier. - `destination?: Destination` Body param: Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled?: boolean` Body param: Whether the subscription is active - `events?: Array` Body param: List of event types this subscription handles - `name?: string` Body param: Name of the subscription ### Returns - `SubscriptionUpdateResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const subscription = await client.queues.subscriptions.update('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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(stringsubscriptionId, SubscriptionDeleteParamsparams, RequestOptionsoptions?): SubscriptionDeleteResponse` **delete** `/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}` Delete an existing event subscription ### Parameters - `subscriptionId: string` A Resource identifier. - `params: SubscriptionDeleteParams` - `account_id: string` A Resource identifier. ### Returns - `SubscriptionDeleteResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const subscription = await client.queues.subscriptions.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 } ``` ## Domain Types ### Subscription List Response - `SubscriptionListResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Subscription Get Response - `SubscriptionGetResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Subscription Create Response - `SubscriptionCreateResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Subscription Update Response - `SubscriptionUpdateResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow ### Subscription Delete Response - `SubscriptionDeleteResponse` - `id: string` Unique identifier for the subscription - `created_at: string` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: string` ID of the target queue - `type: "queues.queue"` Type of destination - `"queues.queue"` - `enabled: boolean` Whether the subscription is active - `events: Array` List of event types this subscription handles - `modified_at: string` When the subscription was last modified - `name: string` Name of the subscription - `source: MqEventSourceImages | MqEventSourceKV | MqEventSourceR2 | 5 more` Source configuration for the subscription - `MqEventSourceImages` - `type?: "images"` Type of source - `"images"` - `MqEventSourceKV` - `type?: "kv"` Type of source - `"kv"` - `MqEventSourceR2` - `type?: "r2"` Type of source - `"r2"` - `MqEventSourceSuperSlurper` - `type?: "superSlurper"` Type of source - `"superSlurper"` - `MqEventSourceVectorize` - `type?: "vectorize"` Type of source - `"vectorize"` - `MqEventSourceWorkersAIModel` - `model_name?: string` Name of the Workers AI model - `type?: "workersAi.model"` Type of source - `"workersAi.model"` - `MqEventSourceWorkersBuildsWorker` - `type?: "workersBuilds.worker"` Type of source - `"workersBuilds.worker"` - `worker_name?: string` Name of the worker - `MqEventSourceWorkflowsWorkflow` - `type?: "workflows.workflow"` Type of source - `"workflows.workflow"` - `workflow_name?: string` Name of the workflow