Skip to content
Start here

Get Event Notification Rule

client.r2.buckets.eventNotifications.get(stringbucketName, stringqueueId, EventNotificationGetParams { account_id, jurisdiction } params, RequestOptionsoptions?): EventNotificationGetResponse { queueId, queueName, rules }
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
bucketName: string

Name of the bucket.

maxLength64
minLength3
queueId: string

Queue ID.

maxLength32
params: EventNotificationGetParams { account_id, jurisdiction }
account_id: string

Path param: Account ID.

maxLength32
jurisdiction?: "default" | "eu" | "fedramp"

Header param: The bucket jurisdiction.

One of the following:
"default"
"eu"
"fedramp"
ReturnsExpand Collapse
EventNotificationGetResponse { queueId, queueName, rules }
queueId?: string

Queue ID.

queueName?: string

Name of the queue.

rules?: Array<Rule>
actions: Array<"PutObject" | "CopyObject" | "DeleteObject" | 2 more>

Array of R2 object actions that will trigger notifications.

One of the following:
"PutObject"
"CopyObject"
"DeleteObject"
"CompleteMultipartUpload"
"LifecycleDeletion"
createdAt?: string

Timestamp when the rule was created.

description?: string

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

prefix?: string

Notifications will be sent only for objects with this prefix.

ruleId?: string

Rule ID.

suffix?: string

Notifications will be sent only for objects with this suffix.

Get Event Notification Rule

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const eventNotification = await client.r2.buckets.eventNotifications.get(
  'example-bucket',
  'queue_id',
  { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
);

console.log(eventNotification.queueId);
{
  "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
}