# Queues ## List Queues `queues.list(QueueListParams**kwargs) -> SyncSinglePage[Queue]` **get** `/accounts/{account_id}/queues` Returns the queues owned by an account. ### Parameters - `account_id: str` A Resource identifier. ### Returns - `class Queue: …` - `consumers: Optional[List[Consumer]]` - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` - `consumers_total_count: Optional[float]` - `created_on: Optional[str]` - `modified_on: Optional[str]` - `producers: Optional[List[Producer]]` - `class ProducerMqWorkerProducer: …` - `script: Optional[str]` - `type: Optional[Literal["worker"]]` - `"worker"` - `class ProducerMqR2Producer: …` - `bucket_name: Optional[str]` - `type: Optional[Literal["r2_bucket"]]` - `"r2_bucket"` - `producers_total_count: Optional[float]` - `queue_id: Optional[str]` - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.queues.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 `queues.get(strqueue_id, QueueGetParams**kwargs) -> Queue` **get** `/accounts/{account_id}/queues/{queue_id}` Get details about a specific queue. ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. ### Returns - `class Queue: …` - `consumers: Optional[List[Consumer]]` - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` - `consumers_total_count: Optional[float]` - `created_on: Optional[str]` - `modified_on: Optional[str]` - `producers: Optional[List[Producer]]` - `class ProducerMqWorkerProducer: …` - `script: Optional[str]` - `type: Optional[Literal["worker"]]` - `"worker"` - `class ProducerMqR2Producer: …` - `bucket_name: Optional[str]` - `type: Optional[Literal["r2_bucket"]]` - `"r2_bucket"` - `producers_total_count: Optional[float]` - `queue_id: Optional[str]` - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) queue = client.queues.get( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.create(QueueCreateParams**kwargs) -> Queue` **post** `/accounts/{account_id}/queues` Create a new queue ### Parameters - `account_id: str` A Resource identifier. - `queue_name: str` ### Returns - `class Queue: …` - `consumers: Optional[List[Consumer]]` - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` - `consumers_total_count: Optional[float]` - `created_on: Optional[str]` - `modified_on: Optional[str]` - `producers: Optional[List[Producer]]` - `class ProducerMqWorkerProducer: …` - `script: Optional[str]` - `type: Optional[Literal["worker"]]` - `"worker"` - `class ProducerMqR2Producer: …` - `bucket_name: Optional[str]` - `type: Optional[Literal["r2_bucket"]]` - `"r2_bucket"` - `producers_total_count: Optional[float]` - `queue_id: Optional[str]` - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) queue = client.queues.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_name="example-queue", ) print(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 `queues.update(strqueue_id, QueueUpdateParams**kwargs) -> 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 - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Returns - `class Queue: …` - `consumers: Optional[List[Consumer]]` - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` - `consumers_total_count: Optional[float]` - `created_on: Optional[str]` - `modified_on: Optional[str]` - `producers: Optional[List[Producer]]` - `class ProducerMqWorkerProducer: …` - `script: Optional[str]` - `type: Optional[Literal["worker"]]` - `"worker"` - `class ProducerMqR2Producer: …` - `bucket_name: Optional[str]` - `type: Optional[Literal["r2_bucket"]]` - `"r2_bucket"` - `producers_total_count: Optional[float]` - `queue_id: Optional[str]` - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) queue = client.queues.update( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.edit(strqueue_id, QueueEditParams**kwargs) -> Queue` **patch** `/accounts/{account_id}/queues/{queue_id}` Updates a Queue. ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Returns - `class Queue: …` - `consumers: Optional[List[Consumer]]` - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` - `consumers_total_count: Optional[float]` - `created_on: Optional[str]` - `modified_on: Optional[str]` - `producers: Optional[List[Producer]]` - `class ProducerMqWorkerProducer: …` - `script: Optional[str]` - `type: Optional[Literal["worker"]]` - `"worker"` - `class ProducerMqR2Producer: …` - `bucket_name: Optional[str]` - `type: Optional[Literal["r2_bucket"]]` - `"r2_bucket"` - `producers_total_count: Optional[float]` - `queue_id: Optional[str]` - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) queue = client.queues.edit( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.delete(strqueue_id, QueueDeleteParams**kwargs) -> QueueDeleteResponse` **delete** `/accounts/{account_id}/queues/{queue_id}` Deletes a queue ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. ### Returns - `class QueueDeleteResponse: …` - `errors: Optional[List[ResponseInfo]]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[Source]` - `pointer: Optional[str]` - `messages: Optional[List[str]]` - `success: Optional[Literal[true]]` Indicates if the API call was successful or not. - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) queue = client.queues.delete( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 - `class Queue: …` - `consumers: Optional[List[Consumer]]` - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` - `consumers_total_count: Optional[float]` - `created_on: Optional[str]` - `modified_on: Optional[str]` - `producers: Optional[List[Producer]]` - `class ProducerMqWorkerProducer: …` - `script: Optional[str]` - `type: Optional[Literal["worker"]]` - `"worker"` - `class ProducerMqR2Producer: …` - `bucket_name: Optional[str]` - `type: Optional[Literal["r2_bucket"]]` - `"r2_bucket"` - `producers_total_count: Optional[float]` - `queue_id: Optional[str]` - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Queue Delete Response - `class QueueDeleteResponse: …` - `errors: Optional[List[ResponseInfo]]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[Source]` - `pointer: Optional[str]` - `messages: Optional[List[str]]` - `success: Optional[Literal[true]]` Indicates if the API call was successful or not. - `true` # Messages ## Push Message `queues.messages.push(strqueue_id, MessagePushParams**kwargs) -> MessagePushResponse` **post** `/accounts/{account_id}/queues/{queue_id}/messages` Push a message to a Queue ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `body: Optional[str]` - `content_type: Optional[Literal["text"]]` - `"text"` - `delay_seconds: Optional[float]` The number of seconds to wait for attempting to deliver this message to consumers ### Returns - `class MessagePushResponse: …` - `errors: Optional[List[ResponseInfo]]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[Source]` - `pointer: Optional[str]` - `messages: Optional[List[str]]` - `success: Optional[Literal[true]]` Indicates if the API call was successful or not. - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.queues.messages.push( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.messages.ack(strqueue_id, MessageAckParams**kwargs) -> MessageAckResponse` **post** `/accounts/{account_id}/queues/{queue_id}/messages/ack` Acknowledge + Retry messages from a Queue ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `acks: Optional[Iterable[Ack]]` - `lease_id: Optional[str]` 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: Optional[Iterable[Retry]]` - `delay_seconds: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `lease_id: Optional[str]` 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 - `class MessageAckResponse: …` - `ack_count: Optional[float]` The number of messages that were succesfully acknowledged. - `retry_count: Optional[float]` The number of messages that were succesfully retried. - `warnings: Optional[List[str]]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.queues.messages.ack( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.ack_count) ``` #### 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 `queues.messages.pull(strqueue_id, MessagePullParams**kwargs) -> MessagePullResponse` **post** `/accounts/{account_id}/queues/{queue_id}/messages/pull` Pull a batch of messages from a Queue ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. ### Returns - `class MessagePullResponse: …` - `message_backlog_count: Optional[float]` The number of unacknowledged messages in the queue - `messages: Optional[List[Message]]` - `id: Optional[str]` - `attempts: Optional[float]` - `body: Optional[str]` - `lease_id: Optional[str]` 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: Optional[object]` - `timestamp_ms: Optional[float]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.queues.messages.pull( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.messages.bulk_push(strqueue_id, MessageBulkPushParams**kwargs) -> MessageBulkPushResponse` **post** `/accounts/{account_id}/queues/{queue_id}/messages/batch` Push a batch of message to a Queue ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `delay_seconds: Optional[float]` The number of seconds to wait for attempting to deliver this batch to consumers - `messages: Optional[Iterable[Message]]` - `class MessageMqQueueMessageText: …` - `body: Optional[str]` - `content_type: Optional[Literal["text"]]` - `"text"` - `delay_seconds: Optional[float]` The number of seconds to wait for attempting to deliver this message to consumers - `class MessageMqQueueMessageJson: …` - `body: Optional[object]` - `content_type: Optional[Literal["json"]]` - `"json"` - `delay_seconds: Optional[float]` The number of seconds to wait for attempting to deliver this message to consumers ### Returns - `class MessageBulkPushResponse: …` - `errors: Optional[List[ResponseInfo]]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[Source]` - `pointer: Optional[str]` - `messages: Optional[List[str]]` - `success: Optional[Literal[true]]` Indicates if the API call was successful or not. - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.queues.messages.bulk_push( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 - `class MessagePushResponse: …` - `errors: Optional[List[ResponseInfo]]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[Source]` - `pointer: Optional[str]` - `messages: Optional[List[str]]` - `success: Optional[Literal[true]]` Indicates if the API call was successful or not. - `true` ### Message Ack Response - `class MessageAckResponse: …` - `ack_count: Optional[float]` The number of messages that were succesfully acknowledged. - `retry_count: Optional[float]` The number of messages that were succesfully retried. - `warnings: Optional[List[str]]` ### Message Pull Response - `class MessagePullResponse: …` - `message_backlog_count: Optional[float]` The number of unacknowledged messages in the queue - `messages: Optional[List[Message]]` - `id: Optional[str]` - `attempts: Optional[float]` - `body: Optional[str]` - `lease_id: Optional[str]` 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: Optional[object]` - `timestamp_ms: Optional[float]` ### Message Bulk Push Response - `class MessageBulkPushResponse: …` - `errors: Optional[List[ResponseInfo]]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[Source]` - `pointer: Optional[str]` - `messages: Optional[List[str]]` - `success: Optional[Literal[true]]` Indicates if the API call was successful or not. - `true` # Purge ## Get Queue Purge Status `queues.purge.status(strqueue_id, PurgeStatusParams**kwargs) -> PurgeStatusResponse` **get** `/accounts/{account_id}/queues/{queue_id}/purge` Get details about a Queue's purge status. ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. ### Returns - `class PurgeStatusResponse: …` - `completed: Optional[str]` Indicates if the last purge operation completed successfully. - `started_at: Optional[str]` Timestamp when the last purge operation started. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.queues.purge.status( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.purge.start(strqueue_id, PurgeStartParams**kwargs) -> Queue` **post** `/accounts/{account_id}/queues/{queue_id}/purge` Deletes all messages from the Queue. ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `delete_messages_permanently: Optional[bool]` Confimation that all messages will be deleted permanently. ### Returns - `class Queue: …` - `consumers: Optional[List[Consumer]]` - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` - `consumers_total_count: Optional[float]` - `created_on: Optional[str]` - `modified_on: Optional[str]` - `producers: Optional[List[Producer]]` - `class ProducerMqWorkerProducer: …` - `script: Optional[str]` - `type: Optional[Literal["worker"]]` - `"worker"` - `class ProducerMqR2Producer: …` - `bucket_name: Optional[str]` - `type: Optional[Literal["r2_bucket"]]` - `"r2_bucket"` - `producers_total_count: Optional[float]` - `queue_id: Optional[str]` - `queue_name: Optional[str]` - `settings: Optional[Settings]` - `delivery_delay: Optional[float]` Number of seconds to delay delivery of all messages to consumers. - `delivery_paused: Optional[bool]` Indicates if message delivery to consumers is currently paused. - `message_retention_period: Optional[float]` Number of seconds after which an unconsumed message will be delayed. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) queue = client.queues.purge.start( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 - `class PurgeStatusResponse: …` - `completed: Optional[str]` Indicates if the last purge operation completed successfully. - `started_at: Optional[str]` Timestamp when the last purge operation started. # Consumers ## List Queue Consumers `queues.consumers.list(strqueue_id, ConsumerListParams**kwargs) -> SyncSinglePage[Consumer]` **get** `/accounts/{account_id}/queues/{queue_id}/consumers` Returns the consumers for a Queue ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. ### Returns - `Consumer` Response body representing a consumer - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.queues.consumers.list( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page) ``` #### 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 `queues.consumers.get(strconsumer_id, ConsumerGetParams**kwargs) -> Consumer` **get** `/accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}` Fetches the consumer for a queue by consumer id ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `consumer_id: str` A Resource identifier. ### Returns - `Consumer` Response body representing a consumer - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) consumer = client.queues.consumers.get( consumer_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.consumers.create(strqueue_id, ConsumerCreateParams**kwargs) -> Consumer` **post** `/accounts/{account_id}/queues/{queue_id}/consumers` Creates a new consumer for a Queue ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `script_name: str` Name of a Worker - `type: Literal["worker"]` - `"worker"` - `dead_letter_queue: Optional[str]` - `settings: Optional[MqWorkerConsumerRequestSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. ### Returns - `Consumer` Response body representing a consumer - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) consumer = client.queues.consumers.create( queue_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="my-consumer-worker", type="worker", ) print(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 `queues.consumers.update(strconsumer_id, ConsumerUpdateParams**kwargs) -> 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 - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `consumer_id: str` A Resource identifier. - `script_name: str` Name of a Worker - `type: Literal["worker"]` - `"worker"` - `dead_letter_queue: Optional[str]` - `settings: Optional[MqWorkerConsumerRequestSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. ### Returns - `Consumer` Response body representing a consumer - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) consumer = client.queues.consumers.update( consumer_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="my-consumer-worker", type="worker", ) print(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 `queues.consumers.delete(strconsumer_id, ConsumerDeleteParams**kwargs) -> ConsumerDeleteResponse` **delete** `/accounts/{account_id}/queues/{queue_id}/consumers/{consumer_id}` Deletes the consumer for a queue. ### Parameters - `account_id: str` A Resource identifier. - `queue_id: str` A Resource identifier. - `consumer_id: str` A Resource identifier. ### Returns - `class ConsumerDeleteResponse: …` - `errors: Optional[List[ResponseInfo]]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[Source]` - `pointer: Optional[str]` - `messages: Optional[List[str]]` - `success: Optional[Literal[true]]` Indicates if the API call was successful or not. - `true` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) consumer = client.queues.consumers.delete( consumer_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", queue_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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` Response body representing a consumer - `class MqWorkerConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `script_name: Optional[str]` Name of a Worker - `settings: Optional[MqWorkerConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_concurrency: Optional[float]` 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: Optional[float]` The maximum number of retries - `max_wait_time_ms: Optional[float]` The number of milliseconds to wait for a batch to fill up before attempting to deliver it - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `type: Optional[Literal["worker"]]` - `"worker"` - `class MqHTTPConsumerResponse: …` - `consumer_id: Optional[str]` A Resource identifier. - `created_on: Optional[datetime]` - `dead_letter_queue: Optional[str]` Name of the dead letter queue, or empty string if not configured - `queue_name: Optional[str]` - `settings: Optional[MqHTTPConsumerResponseSettings]` - `batch_size: Optional[float]` The maximum number of messages to include in a batch. - `max_retries: Optional[float]` The maximum number of retries - `retry_delay: Optional[float]` The number of seconds to delay before making the message available for another attempt. - `visibility_timeout_ms: Optional[float]` The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt. - `type: Optional[Literal["http_pull"]]` - `"http_pull"` ### Consumer Delete Response - `class ConsumerDeleteResponse: …` - `errors: Optional[List[ResponseInfo]]` - `code: int` - `message: str` - `documentation_url: Optional[str]` - `source: Optional[Source]` - `pointer: Optional[str]` - `messages: Optional[List[str]]` - `success: Optional[Literal[true]]` Indicates if the API call was successful or not. - `true` # Subscriptions ## List Event Subscriptions `queues.subscriptions.list(SubscriptionListParams**kwargs) -> SyncV4PagePaginationArray[SubscriptionListResponse]` **get** `/accounts/{account_id}/event_subscriptions/subscriptions` Get a paginated list of event subscriptions with optional sorting and filtering ### Parameters - `account_id: str` A Resource identifier. - `direction: Optional[Literal["asc", "desc"]]` Sort direction - `"asc"` - `"desc"` - `order: Optional[Literal["created_at", "name", "enabled", "source"]]` Field to sort by - `"created_at"` - `"name"` - `"enabled"` - `"source"` - `page: Optional[int]` Page number for pagination - `per_page: Optional[int]` Number of items per page ### Returns - `class SubscriptionListResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.queues.subscriptions.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 `queues.subscriptions.get(strsubscription_id, SubscriptionGetParams**kwargs) -> SubscriptionGetResponse` **get** `/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}` Get details about an existing event subscription ### Parameters - `account_id: str` A Resource identifier. - `subscription_id: str` A Resource identifier. ### Returns - `class SubscriptionGetResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) subscription = client.queues.subscriptions.get( subscription_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.subscriptions.create(SubscriptionCreateParams**kwargs) -> SubscriptionCreateResponse` **post** `/accounts/{account_id}/event_subscriptions/subscriptions` Create a new event subscription for a queue ### Parameters - `account_id: str` A Resource identifier. - `destination: Optional[Destination]` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: Optional[bool]` Whether the subscription is active - `events: Optional[SequenceNotStr[str]]` List of event types this subscription handles - `name: Optional[str]` Name of the subscription - `source: Optional[Source]` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Returns - `class SubscriptionCreateResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) subscription = client.queues.subscriptions.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.subscriptions.update(strsubscription_id, SubscriptionUpdateParams**kwargs) -> SubscriptionUpdateResponse` **patch** `/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}` Update an existing event subscription ### Parameters - `account_id: str` A Resource identifier. - `subscription_id: str` A Resource identifier. - `destination: Optional[Destination]` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: Optional[bool]` Whether the subscription is active - `events: Optional[SequenceNotStr[str]]` List of event types this subscription handles - `name: Optional[str]` Name of the subscription ### Returns - `class SubscriptionUpdateResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) subscription = client.queues.subscriptions.update( subscription_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `queues.subscriptions.delete(strsubscription_id, SubscriptionDeleteParams**kwargs) -> SubscriptionDeleteResponse` **delete** `/accounts/{account_id}/event_subscriptions/subscriptions/{subscription_id}` Delete an existing event subscription ### Parameters - `account_id: str` A Resource identifier. - `subscription_id: str` A Resource identifier. ### Returns - `class SubscriptionDeleteResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) subscription = client.queues.subscriptions.delete( subscription_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 - `class SubscriptionListResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Subscription Get Response - `class SubscriptionGetResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Subscription Create Response - `class SubscriptionCreateResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Subscription Update Response - `class SubscriptionUpdateResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow ### Subscription Delete Response - `class SubscriptionDeleteResponse: …` - `id: str` Unique identifier for the subscription - `created_at: datetime` When the subscription was created - `destination: Destination` Destination configuration for the subscription - `queue_id: str` ID of the target queue - `type: Literal["queues.queue"]` Type of destination - `"queues.queue"` - `enabled: bool` Whether the subscription is active - `events: List[str]` List of event types this subscription handles - `modified_at: datetime` When the subscription was last modified - `name: str` Name of the subscription - `source: Source` Source configuration for the subscription - `class SourceMqEventSourceImages: …` - `type: Optional[Literal["images"]]` Type of source - `"images"` - `class SourceMqEventSourceKV: …` - `type: Optional[Literal["kv"]]` Type of source - `"kv"` - `class SourceMqEventSourceR2: …` - `type: Optional[Literal["r2"]]` Type of source - `"r2"` - `class SourceMqEventSourceSuperSlurper: …` - `type: Optional[Literal["superSlurper"]]` Type of source - `"superSlurper"` - `class SourceMqEventSourceVectorize: …` - `type: Optional[Literal["vectorize"]]` Type of source - `"vectorize"` - `class SourceMqEventSourceWorkersAIModel: …` - `model_name: Optional[str]` Name of the Workers AI model - `type: Optional[Literal["workersAi.model"]]` Type of source - `"workersAi.model"` - `class SourceMqEventSourceWorkersBuildsWorker: …` - `type: Optional[Literal["workersBuilds.worker"]]` Type of source - `"workersBuilds.worker"` - `worker_name: Optional[str]` Name of the worker - `class SourceMqEventSourceWorkflowsWorkflow: …` - `type: Optional[Literal["workflows.workflow"]]` Type of source - `"workflows.workflow"` - `workflow_name: Optional[str]` Name of the workflow