Skip to content

v5.2.0

Latest

Choose a tag to compare

@stainless-app stainless-app released this 21 May 22:31
8b2b6d3

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 Certificates (client.zero_trust.access.saml_certificates):

  • list, get, get_pem (returns BinaryAPIResponse), rotate

Identity Provider SAML Certificate (client.zero_trust.identity_providers.saml_certificate):

  • create

Resource Library (client.zero_trust.resource_library):

  • applications.list/get -- browse resource library applications
  • categories.list/get -- browse resource library categories

Chores

  • acm: update generated types and methods (8b03b3d)
  • ai: update generated types and methods (2f6bdf7)
  • api_gateway: update generated types and methods (5b79a34)
  • cloudforce_one: update generated types and methods (fc72368)
  • d1: update generated types and methods (6a05b68)
  • email_security: update generated types and methods (c89d1ce)
  • intel: update generated types and methods (b097e5d)
  • logpush: update generated types and methods (f26713b)
  • resource_sharing: update generated types and methods (792bf24)