---
title: Messages
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[Queues](https://developers.cloudflare.com/api/python/resources/queues)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Messages

##### [Push Message](https://developers.cloudflare.com/api/python/resources/queues/subresources/messages/methods/push)

queues.messages.push(strqueue\_id, MessagePushParams\*\*kwargs) -> [MessagePushResponse](<https://developers.cloudflare.com/api/python/resources/queues#(resource)%20queues.messages%20%3E%20(model)%20message_push_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/queues/{queue\_id}/messages

##### [Acknowledge + Retry Queue Messages](https://developers.cloudflare.com/api/python/resources/queues/subresources/messages/methods/ack)

queues.messages.ack(strqueue\_id, MessageAckParams\*\*kwargs) -> [MessageAckResponse](<https://developers.cloudflare.com/api/python/resources/queues#(resource)%20queues.messages%20%3E%20(model)%20message_ack_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/queues/{queue\_id}/messages/ack

##### [Pull Queue Messages](https://developers.cloudflare.com/api/python/resources/queues/subresources/messages/methods/pull)

queues.messages.pull(strqueue\_id, MessagePullParams\*\*kwargs) -> [MessagePullResponse](<https://developers.cloudflare.com/api/python/resources/queues#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/queues/{queue\_id}/messages/pull

##### [Push Message Batch](https://developers.cloudflare.com/api/python/resources/queues/subresources/messages/methods/bulk_push)

queues.messages.bulk\_push(strqueue\_id, MessageBulkPushParams\*\*kwargs) -> [MessageBulkPushResponse](<https://developers.cloudflare.com/api/python/resources/queues#(resource)%20queues.messages%20%3E%20(model)%20message_bulk_push_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/queues/{queue\_id}/messages/batch

##### [Peek Queue Messages](https://developers.cloudflare.com/api/python/resources/queues/subresources/messages/methods/peek)

queues.messages.peek(strqueue\_id, MessagePeekParams\*\*kwargs) -> [MessagePeekResponse](<https://developers.cloudflare.com/api/python/resources/queues#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/queues/{queue\_id}/messages/peek

##### [Purge Peeked Queue Messages](https://developers.cloudflare.com/api/python/resources/queues/subresources/messages/methods/purge)

queues.messages.purge(strqueue\_id, MessagePurgeParams\*\*kwargs) -> [MessagePurgeResponse](<https://developers.cloudflare.com/api/python/resources/queues#(resource)%20queues.messages%20%3E%20(model)%20message_purge_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/queues/{queue\_id}/messages/purge

##### ModelsExpand Collapse

<details>

<summary>

class MessagePushResponse: …

</summary>

<details>

<summary>

metadata: Optional\[Metadata]

</summary>

<details>

<summary>

metrics: Optional\[MetadataMetrics]

Best-effort metrics for the queue. Values may be approximate due to the distributed nature of queues.

</summary>

backlog\_bytes: float

The size in bytes of unacknowledged messages in the queue.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20backlog_bytes">Link to this property</a>

backlog\_count: float

The number of unacknowledged messages in the queue.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20backlog_count">Link to this property</a>

oldest\_message\_timestamp\_ms: float

Unix timestamp in milliseconds of the oldest unacknowledged message in the queue. Returns 0 if unknown.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20oldest_message_timestamp_ms">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata">Link to this property</a>

</details>

[Link to this property](<#(resource)%20queues.messages%20%3E%20(model)%20message_push_response%20%3E%20(schema)>)

<details>

<summary>

class MessageAckResponse: …

</summary>

ack\_count: Optional\[float]

The number of messages that were succesfully acknowledged.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_ack_response%20%3E%20(schema)%20%3E%20(property)%20ackCount">Link to this property</a>

retry\_count: Optional\[float]

The number of messages that were succesfully retried.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_ack_response%20%3E%20(schema)%20%3E%20(property)%20retryCount">Link to this property</a>

warnings: Optional\[Dict\[str, str]]

Map of lease IDs to warning messages encountered during acknowledgement.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_ack_response%20%3E%20(schema)%20%3E%20(property)%20warnings">Link to this property</a>

</details>

[Link to this property](<#(resource)%20queues.messages%20%3E%20(model)%20message_ack_response%20%3E%20(schema)>)

<details>

<summary>

class MessagePullResponse: …

</summary>

message\_backlog\_count: Optional\[float]

The number of unacknowledged messages in the queue.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20message_backlog_count">Link to this property</a>

<details>

<summary>

messages: Optional\[List\[Message]]

</summary>

id: Optional\[str]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20id">Link to this property</a>

attempts: Optional\[float]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20attempts">Link to this property</a>

body: Optional\[str]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20body">Link to this property</a>

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.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20lease_id">Link to this property</a>

metadata: Optional\[object]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20metadata">Link to this property</a>

timestamp\_ms: Optional\[float]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20timestamp_ms">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20messages">Link to this property</a>

<details>

<summary>

metadata: Optional\[Metadata]

</summary>

<details>

<summary>

metrics: Optional\[MetadataMetrics]

Best-effort metrics for the queue. Values may be approximate due to the distributed nature of queues.

</summary>

backlog\_bytes: float

The size in bytes of unacknowledged messages in the queue.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20backlog_bytes">Link to this property</a>

backlog\_count: float

The number of unacknowledged messages in the queue.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20backlog_count">Link to this property</a>

oldest\_message\_timestamp\_ms: float

Unix timestamp in milliseconds of the oldest unacknowledged message in the queue. Returns 0 if unknown.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20oldest_message_timestamp_ms">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)%20%3E%20(property)%20metadata">Link to this property</a>

</details>

[Link to this property](<#(resource)%20queues.messages%20%3E%20(model)%20message_pull_response%20%3E%20(schema)>)

<details>

<summary>

class MessageBulkPushResponse: …

</summary>

<details>

<summary>

metadata: Optional\[Metadata]

</summary>

<details>

<summary>

metrics: Optional\[MetadataMetrics]

Best-effort metrics for the queue. Values may be approximate due to the distributed nature of queues.

</summary>

backlog\_bytes: float

The size in bytes of unacknowledged messages in the queue.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_bulk_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20backlog_bytes">Link to this property</a>

backlog\_count: float

The number of unacknowledged messages in the queue.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_bulk_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20backlog_count">Link to this property</a>

oldest\_message\_timestamp\_ms: float

Unix timestamp in milliseconds of the oldest unacknowledged message in the queue. Returns 0 if unknown.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_bulk_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics%20%3E%20(property)%20oldest_message_timestamp_ms">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_bulk_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(property)%20metrics">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_bulk_push_response%20%3E%20(schema)%20%3E%20(property)%20metadata">Link to this property</a>

</details>

[Link to this property](<#(resource)%20queues.messages%20%3E%20(model)%20message_bulk_push_response%20%3E%20(schema)>)

<details>

<summary>

class MessagePeekResponse: …

</summary>

<details>

<summary>

messages: Optional\[List\[Message]]

</summary>

id: Optional\[str]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20id">Link to this property</a>

attempts: Optional\[float]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20attempts">Link to this property</a>

body: Optional\[str]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20body">Link to this property</a>

metadata: Optional\[object]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20metadata">Link to this property</a>

ref: Optional\[str]

An opaque reference to a peeked message. You must hold on to this value and use it to purge the message.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20ref">Link to this property</a>

timestamp\_ms: Optional\[float]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20timestamp_ms">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)%20%3E%20(property)%20messages">Link to this property</a>

</details>

[Link to this property](<#(resource)%20queues.messages%20%3E%20(model)%20message_peek_response%20%3E%20(schema)>)

<details>

<summary>

class MessagePurgeResponse: …

</summary>

<details>

<summary>

errors: Optional\[List\[Error]]

Errors encountered while purging messages.

</summary>

message: Optional\[str]

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_purge_response%20%3E%20(schema)%20%3E%20(property)%20errors%20%3E%20(items)%20%3E%20(property)%20message">Link to this property</a>

</details>

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_purge_response%20%3E%20(schema)%20%3E%20(property)%20errors">Link to this property</a>

warnings: Optional\[Dict\[str, str]]

Map of refs to warning messages encountered during purge.

<a href="#(resource)%20queues.messages%20%3E%20(model)%20message_purge_response%20%3E%20(schema)%20%3E%20(property)%20warnings">Link to this property</a>

</details>

[Link to this property](<#(resource)%20queues.messages%20%3E%20(model)%20message_purge_response%20%3E%20(schema)>)