The official Python library for the Cloudflare API
Repo cloudflare/cloudflare-python, read from GitHub 1 min ago. cloudflare has not joined Take My Repo.
Full Changelog: v5.9.0...v5.10.0
This release adds the K2 streaming, Monetization, Zero Trust CWS, and Billing
Spend Policies APIs, plus Zero Trust Access user populations and MFA catalog
resources. It also removes the Magic Cloud Networking and Tenant Custom
Nameservers resources and changes several pagination and response types. Review
the breaking changes before upgrading.
See the v5.10.0 Migration Guide for upgrade examples.
client.magic_cloud_networking has been removed entirely, including the catalog_syncsprebuilt_policies), on_ramps (and address_spaces), cloud_integrations, and resources sub-resourcescloudflare.types.magic_cloud_networking exports.client.tenant_custom_nameservers has been removed, along with its create(),delete(), and get() methods and the TenantCustomNameserverCreateResponse, TenantCustomNameserverDeleteResponse,TenantCustomNameserverGetResponse types.client.tenants.get() has been removed, along with the account_types, entitlements, andmemberships sub-resources and the Tenant and TenantAccount types. client.tenants.accounts.list() now returnsSyncV4PagePaginationArray[AccountListResponse] instead of SyncSinglePage[TenantAccount].client.user.tenants.list() now returns SyncSinglePage[TenantListResponse] instead ofSyncSinglePage[Organization], and the Organization type was removed from cloudflare.types.user.client.accounts.pay_bad_debt sub-resource has been removed. client.accounts.subscriptions.bulk.create()BulkCreateResponse instead of Optional[BulkCreateResponse].client.registrar.domains sub-resource has been removed.client.browser_rendering.devtools.browser.connect() and launch() have been removed, alongdevtools.browser.page sub-resource.name to namespace across everyclient.aisearch.namespaces.instances method and its items and jobs sub-resources. Callers passing name= mustnamespace=.client.rulesets.list() is no longer paginated and now returns RulesetListResponse directly (wasSyncCursorPagination[RulesetListResponse]). client.rulesets.versions.list() andclient.rulesets.phases.versions.list() likewise now return VersionListResponse instead ofSyncSinglePage[VersionListResponse].client.zero_trust.resource_library.applications.list() and categories.list() now returnSyncCursorPaginationAfter instead of SyncSinglePage. client.diagnostics.endpoint_healthchecks.list() now returnsSyncSinglePage[EndpointHealthcheckListResponse] instead of Optional[EndpointHealthcheckListResponse].client.vectorize.indexes.get_by_ids() now uses GET and returnsSyncSinglePage[IndexGetByIDsResponse] instead of issuing POST and returning object.client.zero_trust.access.users.last_seen_identity.get() now returnsOptional[LastSeenIdentityGetResponse] and the Identity type was removed.client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete() now returns TagDeleteResponse instead ofobject.LoadBalancerPreview type was removed, along withmagic_transit.WANStaticAddressingParam, organizations.OrganizationProfileParam, andprecursor.EnforcementRuleParam.client.k2 with streams and streams.subscriptions APIsclient.monetization with zone-level monetization rules APIsclient.zero_trust.cws with basic_auth_credentials (and secrets), deployments,domain_acls, policies, policy_sets, rego_metadata, rego_modules, tenant_structures (and nodes), andworkloads APIsclient.billing.spend_policies with create(), update(), list(), delete(), and get(),activity and audit listing sub-resourcesclient.zero_trust.access.user_populations (and its users sub-resource) with full CRUDclient.zero_trust.access.mfa.authenticator_catalog and client.zero_trust.access.logs.jit_requestsmfa_authenticators and passkeys delete sub-resources to client.zero_trust.access.usersclient.zero_trust.casb.posture.asset_schemas; add create(), update(), delete(), andvalidate() to client.zero_trust.casb.posture.finding_typesclient.zero_trust.dlp.validators (and its proximity_words sub-resource)client.zero_trust.gateway.dns_destination_ipsdelete() and get() to client.zero_trust.identity_providers.scim.groups and scim.usersclient.dns.settings.account.nameserver_sets with create(), list(), delete(), and get()client.r2.buckets.jobs with create(), list(), and get()client.aisearch.namespaces.instances.move()client.api_gateway.discovery.operations.edit()client.d1.database.undelete()client.workers.beta.workers.versions.profile()client.zero_trust.access.custom_pages.validate()K2 (client.k2)
streams.create(), streams.update(), streams.list(), streams.delete(), and streams.get()streams.subscriptions.list()Monetization (client.monetization)
rules.update(), rules.delete(), rules.delete_rule(), rules.edit_rule(), rules.get(), and rules.get_rule()Zero Trust CWS (client.zero_trust.cws)
basic_auth_credentials.create(), list(), delete(), get(), and basic_auth_credentials.secrets.*deployments.create(), update(), list(), delete(), and get()domain_acls.create(), update(), list(), delete(), and get()policies.create(), update(), list(), delete(), and get()policy_sets.create(), update(), list(), delete(), and get()rego_metadata.create(), update(), list(), delete(), and get()rego_modules.create(), update(), list(), delete(), and get()tenant_structures.create(), update(), list(), delete(), get(), and tenant_structures.nodes.*workloads.create(), update(), list(), delete(), and get()Billing Spend Policies (client.billing.spend_policies)
create(), update(), list(), delete(), and get()activity.list() and audit.list()Zero Trust Access User Populations (client.zero_trust.access.user_populations)
create(), update(), list(), delete(), and get()users.create(), users.update(), users.list(), users.delete(), users.get(), and users.replace()Full Changelog: v5.8.0...v5.9.0
This release adds the Containers, R2 Data Catalog, and Cloudforce One threat
signals APIs, plus cache invalidation and a registrar transfer-check method.
client.addressing.address_maps.zones.update() and delete() have been removed, along with theZoneUpdateResponse and ZoneDeleteResponse types.client.email_security.phishguard.reports.list() now returns SyncV4PagePaginationArray instead ofSyncSinglePage. Auto-iteration is unchanged; code reading page-level fields may need updating.client.containers with application, instance, rollout, version, image, and registry APIsclient.basin_catalog (R2 Data Catalog) with catalog, credential, namespace, table, and maintenance-config APIsclient.cloudforce_one.threat_signals with article, category, feed, indicator, search, and skill APIsclient.cache.invalidate() and client.cache.invalidate_environment()client.registrar.transfer_check()Full Changelog: v5.7.0...v5.8.0
This release adds Managed Defense vulnerability discovery, Field Extractors, billing and subscription APIs, Magic
Transit BGP filter profiles, registrar transfer APIs, Zero Trust posture policies, and zone observability tracing.
It also includes generated signature and response-model corrections. Review the breaking changes before upgrading.
See the v5.8.0 Migration Guide for upgrade examples.
client.addressing.address_maps.accounts.update() and delete() now takemember_account_id as the positional identifier and address_map_id as a keyword argument.body parameters were removed from token value updates, Address Maps IP and zonejurisdiction was renamed to cf_r2_jurisdiction across bucket, object, domain,fedramp-high.None. The Override,OverrideDeleteResponse, RateLimit, RateLimitDeleteResponse, WAFRule, and RewriteAction exports wereid instead of a body collection, and WAF package retrievalRuleUpdateParams.rules is now required.list(), delete(), and get() now useMTLSCertificate type; create() still returns Optional[MTLSCertificateCreateResponse]. HyperdriveOrigin, Caching, and MTLS helperSyncV4PagePagination and adds page/date filters; GatewaySyncV4PagePaginationArray and add page controls; device override-codeOptional[OverrideCodeListResponse].client.email_routing.dns.delete() now uses DELETE and returns Optional[Settings] insteaddns.get() is now optional and returns List[DNSRecord] rather than an envelope union.Optional[...]; callers must handle None.url or html. Session endpoints such as devtools.browser.create() are unaffected. Nested Viewport,Cookie, and PDFOptions imports moved under generated variant types.SourceField, SourceFieldParam,ListField, ListFieldParam, StructField, and StructFieldParam types.ApplicationCreateParams for Resource Library applications is now a union requiring eitherhostnames or ip_subnets. Access Browser RDP and Infrastructure target_attributes response fields are nowBlockRule to RuleBlockRule,CompressResponseRule to RuleResponseCompressionRule, and SetConfigRule to RuleSetConfigurationRule;type, and Workers domain environment are nowprimarysite_id.SKIPPED, message status no longer includesDISCOVERING, and bulk responses add required cancellation/skip counts.Okta or Workday.created_at, selected billing usage fields, and Workers observabilityrequest_id fields are now optional.date/datetime and intstr and float; session participant per_page is now an int.ResponseInfo entries.stream.Clip, stream.Playback, stream.Watermark, and cache.State were removed, along withclient.managed_defense.vulnerability_discovery with repository, scan, and report APIsclient.field_extractors with update(), delete(), and get() methodsclient.hyperdrive.configs.restart()force to beta worker deletion and pagination/date filters to deployment listingprofile_type filter for custom policy listingobjectHost, Status, and ValidationMethod aliasesstandalone and Idempotency-Key account creation optionstransfer_pending; Waiting Rooms Latvian locale; zone upload limits through 5000; Queues jurisdiction; AI GatewayManaged Defense Vulnerability Discovery (client.managed_defense.vulnerability_discovery)
repositories.create(), repositories.list(), and repositories.get()scans.create(), scans.list(), scans.get(), and scans.get_report()reports.get()Field Extractors (client.field_extractors)
update()delete()get()Magic Transit BGP Filter Profiles (client.magic_transit.bgp_filter_profiles)
create(), update(), list(), delete(), and get()Zero Trust CASB Posture Policies (client.zero_trust.casb.posture.policies)
create(), update(), list(), delete(), and get()Zone Observability Tracing (client.zones.observability.tracing)
settings.update(), settings.delete(), and settings.get()rules.update(), rules.delete(), and rules.get()Full Changelog: v5.6.0...v5.7.0
create_independent_livestream() method has been removed from client.realtime_kit.livestreams. The LivestreamCreateIndependentLivestreamParams and LivestreamCreateIndependentLivestreamResponse types are no longer available.dismiss() method has been removed from client.intel.attack_surface_report.issues. The IssueDismissResponse and IssueDismissParams types are no longer available.Setting type has been removed from cloudflare.types.page_shield. The get() method now returns Optional[PageShieldGetResponse] and the update() method returns PageShieldUpdateResponse. The Connection type has been replaced by ConnectionGetResponse and ConnectionListResponse. The Script type has been replaced by ScriptListResponse. The Policy type has been replaced by per-method response types.schemas.delete() method return type changed from SchemaDeleteResponse to object. The SchemaDeleteResponse type has been removed from cloudflare.types.schema_validation.HealthCheckParam type has been removed from cloudflare.types.magic_transit. The IPSECTunnelPSKGenerateParams type has been removed from cloudflare.types.magic_transit.client.email_security.settings.content_policies resource with create(), list(), delete(), batch(), edit(), and get() methodsclient.email_sending.suppressions resource with create(), list(), delete(), edit(), get(), and import_() methods; add edit() to client.email_sending.subdomainsclient.logpush.transformers resource with create(), update(), list(), delete(), get(), and preview() methods; add client.logpush.transformers.content and client.logpush.transformers.versions sub-resourcesclient.spectrum.protocols resource with list() methodclient.zones.nel resource with edit() and get() methodsclient.ssl.recommendations resource with get() methodclient.user.spectrum_analytics.zones.reports resource with get() methodclient.browser_rendering.devtools.browser.live_view resource with create() methodclient.precursor resource with update() and get() methodsbatch() to client.email_security.settings.allow_policies, client.email_security.settings.block_senders, and client.email_security.settings.trusted_domains; add create(), update(), and batch() to client.email_security.settings.domainsdelete() to client.addressing.prefixes.bgp_prefixesdelete() to client.r2_data_catalogcreate(), update(), and delete() to client.zero_trust.resource_library.applicationsreplace_preset_by_id() to client.realtime_kit.presetsupdate() to client.content_scanning.payloadsedit() to client.token_validation.configuration.credentialsLogpush Transformers (client.logpush.transformers)
create(*, account_id, **params) -> Optional[TransformerCreateResponse]update(transformer_id, *, account_id, **params) -> Optional[TransformerUpdateResponse]list(*, account_id) -> SyncSinglePage[TransformerListResponse]delete(transformer_id, *, account_id) -> Optional[TransformerDeleteResponse]get(transformer_id, *, account_id) -> Optional[TransformerGetResponse]preview(*, account_id, **params) -> SyncSinglePage[TransformerPreviewResponse]New types:
from cloudflare.types.logpush import ( TransformerCreateResponse, TransformerUpdateResponse, TransformerListResponse, TransformerDeleteResponse, TransformerGetResponse, TransformerPreviewResponse, )
Logpush Transformer Content (client.logpush.transformers.content)
get(transformer_id, *, account_id) -> ContentGetResponseLogpush Transformer Versions (client.logpush.transformers.versions)
list(transformer_id, *, account_id, **params) -> SyncSinglePage[VersionListResponse]Email Security Content Policies (client.email_security.settings.content_policies)
create(*, account_id, **params) -> Optional[ContentPolicyCreateResponse]list(*, account_id, **params) -> SyncV4PagePaginationArray[ContentPolicyListResponse]delete(policy_id, *, account_id) -> Optional[ContentPolicyDeleteResponse]batch(*, account_id, **params) -> Optional[ContentPolicyBatchResponse]edit(policy_id, *, account_id, **params) -> Optional[ContentPolicyEditResponse]get(policy_id, *, account_id) -> Optional[ContentPolicyGetResponse]New types:
from cloudflare.types.email_security.settings import ( ContentPolicyCreateResponse, ContentPolicyListResponse, ContentPolicyDeleteResponse, ContentPolicyBatchResponse, ContentPolicyEditResponse, ContentPolicyGetResponse, )
Email Sending Suppressions (client.email_sending.suppressions)
create(*, account_id, **params) -> SuppressionCreateResponselist(*, account_id, **params) -> SyncCursorPagination[SuppressionListResponse]delete(suppression_id, *, account_id) -> SuppressionDeleteResponseedit(suppression_id, *, account_id, **params) -> SuppressionEditResponseget(suppression_id, *, account_id) -> SuppressionGetResponseimport_(*, account_id, **params) -> SuppressionImportResponseNew types:
from cloudflare.types.email_sending import ( SuppressionCreateResponse, SuppressionListResponse, SuppressionDeleteResponse, SuppressionEditResponse, SuppressionGetResponse, SuppressionImportResponse, )
Zones NEL (client.zones.nel)
edit(*, zone_id, **params) -> Settingget(*, zone_id) -> SettingSpectrum Protocols (client.spectrum.protocols)
list(*, zone_id) -> SyncSinglePage[ProtocolListResponse]New types:
from cloudflare.types.spectrum import ProtocolListResponse
SSL Recommendations (client.ssl.recommendations)
get(*, zone_id) -> RecommendationGetResponseNew types:
from cloudflare.types.ssl import RecommendationGetResponse
User Spectrum Analytics Zone Reports (client.user.spectrum_analytics.zones.reports)
get(*, **params) -> ReportGetResponseNew types:
from cloudflare.types.user.spectrum_analytics.zones import ReportGetResponse
Browser Rendering Live View (client.browser_rendering.devtools.browser.live_view)
create(browser_session_id, *, account_id, **params) -> LiveViewCreateResponsePrecursor (client.precursor)
Top-level resource for precursor configuration management.
update(*, account_id, **params) -> Optional[PrecursorConfig]get(*, account_id) -> Optional[PrecursorConfig]New types:
from cloudflare.types.precursor import PrecursorConfig
create() and get() from client.accounts.subscriptionsCertificateAuthority typeHostnameAssociation typeindicator_types sub-resource (moved to indicators.types)Status typeconfigs.list() pagination changed to SyncV4PagePaginationArray/{account_or_zone}/{account_or_zone_id}/ patternrotate() from relays.tokens; replaced with create(), list(), delete()MTLSCertificate replaced with per-method response typesHost, Status, ValidationMethod types; hosts param changed to strsetup_flows from CASB applications; get() endpoint changedSee CHANGELOG.md for full details and new type listings.
Full Changelog: v5.4.0...v5.5.0
recommendations sub-resource has been removed. client.ssl.recommendations.get() and the RecommendationGetResponse type are no longer available.list method has been removed from client.email_routing.rules. Only create, update, delete, and get remain. The RuleListParams type has been removed.UserPolicyCheckGeo type has been removed from cloudflare.types.zero_trust.access.applications. The geo information is now inlined as UserIdentityGeo within UserPolicyCheckListResponse.client.zero_trust.devices.ip_profiles.list() changed from SyncSinglePage to SyncV4PagePaginationArray. Code that relied on single-page iteration semantics may need adjustment.SourceParamsWebCrawlerStoreOptions type and the store_options field on SourceParamsWebCrawler have been removed from instance create/update params and responses. The parse_type enum value "feed-rss" has been removed (only "sitemap" and "crawl" remain). The search_query field on InstanceSearchResponse and NamespaceSearchResponse changed from required str to Optional[str]. A new required query_kind field (Literal["text", "image", "multimodal"]) has been added to search responses.Organization and related params, MfaSSHPivKeyRequirements has been renamed to MfaPivKeyRequirements, the mfa_ssh_piv_key_requirements field has been renamed to mfa_piv_key_requirements, and the allowed_authenticators enum value "ssh_piv_key" has been changed to "piv_key".@cf/qwen/qwen3-vl-embedding-2b embedding model (de12426)WorkerDestination, PreviewWorkerDestination, AllWorkersDestination, AllPreviewWorkersDestination) to Access applications and eager_redirect_cookie_setting field to self-hosted applications (de12426)primary and site_id fields to connector create/edit params (de12426)Vary cache settings with ActionParametersVary, ActionParametersVaryDefault, and ActionParametersVaryHeaders types (de12426)threat_events.datasets.list() now accepts optional params (de12426)expected_disposition param to investigate.move.create() and investigate.move.bulk() (de12426)support_subaddress field to Settings response type (de12426)max_ttl_secs field to GatewayConfigurationSettings and new MaxTTL type to gateway Location for DNS TTL cap control (de12426)GlobalAcceleration type to default and custom device policy settings (de12426)category field to PermissionGroupGetResponse and PermissionGroupListResponse for account and user tokens (de12426)EmailAuth (client.email_auth)
DMARC report management and SPF inspection for email authentication.
DMARCReports (client.email_auth.dmarc_reports)
edit(*, zone_id, **params) -> Optional[DMARCReportEditResponse]get(*, zone_id) -> Optional[DMARCReportGetResponse]New types:
from cloudflare.types.email_auth import DMARCReportEditResponse, DMARCReportGetResponse
SPF Inspect (client.email_auth.spf.inspect)
get(*, zone_id, **params) -> Optional[InspectGetResponse]New types:
from cloudflare.types.email_auth.spf import InspectGetResponse
MoQ (client.moq)
Media over QUIC relay management.
Relays (client.moq.relays)
create(*, account_id, **params) -> Optional[RelayCreateResponse]update(relay_id, *, account_id, **params) -> Optional[RelayUpdateResponse]list(*, account_id, **params) -> SyncSinglePage[RelayListResponse]delete(relay_id, *, account_id) -> objectget(relay_id, *, account_id) -> Optional[RelayGetResponse]New types:
from cloudflare.types.moq import ( RelayCreateResponse, RelayUpdateResponse, RelayListResponse, RelayGetResponse, )
Tokens (client.moq.relays.tokens)
rotate(relay_id, *, account_id, **params) -> Optional[TokenRotateResponse]New types:
from cloudflare.types.moq.relays import TokenRotateResponse
Log Explorer (client.logs.log_explorer)
SQL-based log querying and dataset management.
Query (client.logs.log_explorer.query)
sql(body, *, account_id, zone_id, **params) -> SyncSinglePage[QuerySqlResponse]New types:
from cloudflare.types.logs.log_explorer import QuerySqlResponse
Datasets (client.logs.log_explorer.datasets)
create(*, account_id, zone_id, **params) -> Optional[Dataset]update(dataset_id, *, account_id, zone_id, **params) -> Optional[Dataset]list(*, account_id, zone_id, **params) -> SyncSinglePage[DatasetSummary]get(dataset_id, *, account_id, zone_id) -> Optional[Dataset]Available (client.logs.log_explorer.datasets.available)
list(*, account_id, zone_id) -> SyncSinglePage[AvailableDataset]New types:
from cloudflare.types.logs.log_explorer import ( Dataset, DatasetSummary, CreateRequest, UpdateRequest, ) from cloudflare.types.logs.log_explorer.datasets import AvailableDataset, AvailableList
Email Security Investigate Bulk (client.email_security.investigate.bulk)
Bulk message movement and quarantine release operations.
create(*, account_id, **params) -> BulkCreateResponselist(*, account_id, **params) -> SyncV4PagePaginationArray[BulkListResponse]delete(job_id, *, account_id) -> BulkDeleteResponseget(job_id, *, account_id) -> BulkGetResponseCancel (client.email_security.investigate.bulk.cancel)
create(job_id, *, account_id) -> CancelCreateResponseMessages (client.email_security.investigate.bulk.messages)
list(job_id, *, account_id, **params) -> SyncV4PagePaginationArray[MessageListResponse]New types:
from cloudflare.types.email_security.investigate import ( BulkCreateResponse, BulkListResponse, BulkDeleteResponse, BulkGetResponse, ) from cloudflare.types.email_security.investigate.bulk import ( CancelCreateResponse, MessageListResponse, )