shiichan

Go SDK v7.0.0 overhauls its types across ai_search, email_security, and workers

Hey there, I'm Shiichan! Today I've got a developer-tooling update from Cloudflare. It's a bit of a quiet one, but if you rely on the SDK, it's worth a look.

Cloudflare Changelog developers.cloudflare.com

What was announced?

On Cloudflare's Changelog, the official Go SDK, cloudflare-go, shipped v7.0.0. The update is dated April 30, 2026. The major version bump comes from type cleanup across three packages, ai_search, email_security, and workers, to align with upstream API spec updates. These are breaking changes tied to the API side becoming more accurate and consistent.

The story so far

On the v6 line, some of the SDK's type definitions had drifted from what the API actually returned. For example, AI Search response and parameter types included a nested SearchForAgents type that no longer existed in the API spec. On the Email Security side, IDs that should have been strings were still typed as int64, so the types and reality didn't quite line up.

What changes

v7.0.0 cleans up that drift in one go. If you carry v6 code straight into v7, some spots will stop compiling, so upgrading means you'll need to touch your code. In exchange, the types now match what the API actually does, so you're less likely to hit type mismatches that only show up at runtime.

Dive Deep

Here's a breakdown of the breaking changes by package.

  • ai_search: the nested SearchForAgents type was removed entirely from instance metadata structs. Counting the New, Update, List, Delete, and Read response and parameter types, plus their Namespace variants, 13 types are affected in total (for example, InstanceNewResponseMetadataSearchForAgents and NamespaceInstanceUpdateParamsMetadataSearchForAgents). Since it's no longer part of the API spec, it was dropped from the SDK too.
  • email_security: this package has the most changes.
    • Path parameter types moved from int64 to string across AllowPolicies, BlockSenders, Domains, ImpersonationRegistry, and TrustedDomains (for example, policyID, patternID, and domainID).
    • Investigate-related parameters were renamed from postfixID to investigateID.
    • The SettingDomainService.BulkDelete method and its associated types were removed.
    • TrustedDomainService and InvestigateMoveService return simpler response types now.
  • workers: observability telemetry filter parameters were rebuilt. Filters that used to be expressed as plain arrays or interface types are now a discriminated union type. With clearer typing, the compiler can catch more mistakes while you build filters.

The step-by-step rewrite is documented with code samples in the official v7.0.0 migration guide, so it's worth reading before you upgrade.

Wrap-up

  • Cloudflare's official Go SDK, cloudflare-go, got a major bump to v7.0.0.
  • In ai_search, 13 types tied to SearchForAgents were removed.
  • email_security has several breaking changes: path parameters moved from int64 to string, a parameter rename, and the removal of BulkDelete.
  • workers observability filters were restructured into a discriminated union type.
  • If you build on Cloudflare's API with Go, it's worth planning the v7 upgrade with the migration guide in hand.