Skip to content
Start here

Get Event Notification Rule

r2.buckets.event_notifications.get(strqueue_id, EventNotificationGetParams**kwargs) -> EventNotificationGetResponse
GET/accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}

Get a single event notification rule.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Accepted Permissions (at least one required)
Workers R2 Storage WriteWorkers R2 Storage Read
ParametersExpand Collapse
account_id: str

Account ID.

maxLength32
bucket_name: str

Name of the bucket.

maxLength64
minLength3
queue_id: str

Queue ID.

maxLength32
jurisdiction: Optional[Literal["default", "eu", "fedramp"]]

The bucket jurisdiction.

One of the following:
"default"
"eu"
"fedramp"
ReturnsExpand Collapse
class EventNotificationGetResponse:
queue_id: Optional[str]

Queue ID.

queue_name: Optional[str]

Name of the queue.

rules: Optional[List[Rule]]
actions: List[Literal["PutObject", "CopyObject", "DeleteObject", 2 more]]

Array of R2 object actions that will trigger notifications.

One of the following:
"PutObject"
"CopyObject"
"DeleteObject"
"CompleteMultipartUpload"
"LifecycleDeletion"
created_at: Optional[str]

Timestamp when the rule was created.

description: Optional[str]

A description that can be used to identify the event notification rule after creation.

prefix: Optional[str]

Notifications will be sent only for objects with this prefix.

rule_id: Optional[str]

Rule ID.

suffix: Optional[str]

Notifications will be sent only for objects with this suffix.

Get Event Notification Rule

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
event_notification = client.r2.buckets.event_notifications.get(
    queue_id="queue_id",
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
    bucket_name="example-bucket",
)
print(event_notification.queue_id)
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "queueId": "11111aa1-11aa-111a-a1a1-a1a111a11a11",
    "queueName": "first-queue",
    "rules": [
      {
        "actions": [
          "PutObject",
          "CopyObject"
        ],
        "createdAt": "2024-09-19T21:54:48.405Z",
        "description": "Notifications from source bucket to queue",
        "prefix": "img/",
        "ruleId": "11111aa1-11aa-111a-a1a1-a1a111a11a11",
        "suffix": ".jpeg"
      }
    ]
  },
  "success": true
}
{
  "errors": [
    {
      "code": 11015,
      "message": "workers.api.error.no_configs_found_for_bucket"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "queueId": "11111aa1-11aa-111a-a1a1-a1a111a11a11",
    "queueName": "first-queue",
    "rules": [
      {
        "actions": [
          "PutObject",
          "CopyObject"
        ],
        "createdAt": "2024-09-19T21:54:48.405Z",
        "description": "Notifications from source bucket to queue",
        "prefix": "img/",
        "ruleId": "11111aa1-11aa-111a-a1a1-a1a111a11a11",
        "suffix": ".jpeg"
      }
    ]
  },
  "success": true
}
{
  "errors": [
    {
      "code": 11015,
      "message": "workers.api.error.no_configs_found_for_bucket"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}