ReleaseCloudflare (Workers AI)Cloudflare (Workers AI)published May 21, 2026seen 5d

cloudflare/cloudflare-python v5.2.0

cloudflare/cloudflare-python

Open original ↗

Captured source

source ↗
published May 21, 2026seen 5dcaptured 9hhttp 200method plain

v5.2.0

Repository: cloudflare/cloudflare-python

Tag: v5.2.0

Published: 2026-05-21T22:31:17Z

Prerelease: no

Release notes:

5.2.0 (2026-05-21)

Full Changelog: v5.1.0...v5.2.0

Breaking Changes

Cache - Origin Cloud Regions Reworked

The cache.origin_cloud_regions resource has been significantly reworked. Endpoints changed from /zones/{zone_id}/cache/origin_cloud_regions to /zones/{zone_id}/origin/cloud_regions, several methods were removed or renamed, and return types were consolidated.

Removed methods:

  • create -- replaced by update (PUT single item)
  • edit -- removed (use update instead)
  • bulk_edit -- renamed to bulk_update

Changed return types:

  • list now returns SyncV4PagePaginationArray[OriginCloudRegion] (was Optional[OriginCloudRegionListResponse])
  • get now returns Optional[OriginCloudRegion] (was Optional[OriginCloudRegionGetResponse])

Removed types:

  • OriginCloudRegionCreateResponse
  • OriginCloudRegionListResponse
  • OriginCloudRegionBulkEditResponse
  • OriginCloudRegionEditResponse
  • OriginCloudRegionGetResponse

New types:

from cloudflare.types.cache import (
OriginCloudRegion,
OriginCloudRegionBulkUpdateResponse,
)

API Gateway - Discovery Operation Edit Removed

The api_gateway.discovery.operations.edit method and its associated OperationEditResponse type have been removed. Use bulk_edit instead.

Features

  • ddos_protection: add new DDoS Protection service (87f7e95)
  • ai_security: add new AI Security service (29cb585)
  • ai_gateway: add billing sub-resource with credit balance, invoices, usage history, topup, and spending limit (4923bbb)
  • r2: add bucket objects sub-resource with list, delete, get, and upload (72d2149)
  • zero_trust: add access SAML certificates, identity provider SAML certificate, and resource library (aeff7d5)
  • load_balancers: add monitor group references sub-resource (bb6815d)
  • radar: add BGP IPs top ASes and RPKI ROAs timeseries (fb2f0c4)
  • cache: add purge_environment method and smart_tiered_cache.create method (b7ae845)
  • workers: add secrets.bulk_update method (0bdb685)
  • workers_for_platforms: add secrets.bulk_update method (7bfed3c)
  • secrets_store: stores.delete now accepts optional params (636414f)
  • ai_gateway: dynamic_routing.list now accepts optional params (4923bbb)

DDoS Protection (NEW SERVICE)

New top-level service at client.ddos_protection for managing Advanced TCP Protection configurations including allowlists, prefixes, SYN protection (filters and rules), TCP flow protection (filters and rules), and protection status.

from cloudflare.types.ddos_protection.advanced_tcp_protection import (
AllowlistCreateResponse,
AllowlistListResponse,
PrefixCreateResponse,
PrefixListResponse,
StatusEditResponse,
StatusGetResponse,
)

Key methods:

  • ddos_protection.advanced_tcp_protection.allowlist.create/list/bulk_delete
  • ddos_protection.advanced_tcp_protection.prefixes.create/list/bulk_create/bulk_delete
  • ddos_protection.advanced_tcp_protection.syn_protection.filters.create/list/bulk_delete
  • ddos_protection.advanced_tcp_protection.syn_protection.rules.create/list/bulk_delete
  • ddos_protection.advanced_tcp_protection.tcp_flow_protection.filters.create/list/bulk_delete
  • ddos_protection.advanced_tcp_protection.tcp_flow_protection.rules.create/list/bulk_delete
  • ddos_protection.advanced_tcp_protection.status.edit/get

Each collection also has an .items sub-resource for individual item delete, edit, and get operations.

AI Security (NEW SERVICE)

New top-level service at client.ai_security for managing zone-level AI security settings and custom topics.

from cloudflare.types.ai_security import (
AISecurityUpdateResponse,
AISecurityGetResponse,
CustomTopicUpdateResponse,
CustomTopicGetResponse,
)

Methods:

  • ai_security.update/get -- manage AI security settings for a zone
  • ai_security.custom_topics.update/get -- manage custom topics

AI Gateway - Billing

New client.ai_gateway.billing sub-resource with credit balance, invoice history/preview, usage history, topup management, and spending limits.

from cloudflare.types.ai_gateway import (
BillingCreditBalanceResponse,
BillingInvoiceHistoryResponse,
BillingInvoicePreviewResponse,
BillingUsageHistoryResponse,
)
from cloudflare.types.ai_gateway.billing import (
TopupCreateResponse,
TopupStatusResponse,
SpendingLimitGetResponse,
)
from cloudflare.types.ai_gateway.billing.topup import (
ConfigCreateResponse,
ConfigGetResponse,
)

R2 - Bucket Objects

New client.r2.buckets.objects sub-resource for managing objects within R2 buckets.

from cloudflare.types.r2.buckets import (
ObjectListResponse,
ObjectDeleteResponse,
ObjectUploadResponse,
)

Methods:

  • r2.buckets.objects.list -- list objects in a bucket (cursor-paginated)
  • r2.buckets.objects.delete -- delete an object
  • r2.buckets.objects.get -- download an object (returns BinaryAPIResponse)
  • r2.buckets.objects.upload -- upload an object

Zero Trust - SAML Certificates and Resource Library

New sub-resources:

**Access SAML…

Excerpt shown — open the source for the full document.

Notability

notability 1.0/10

Routine library release, not AI related