## Update Route `client.Workers.Routes.Update(ctx, routeID, params) (*RouteUpdateResponse, error)` **put** `/zones/{zone_id}/workers/routes/{route_id}` Updates the URL pattern or Worker associated with a route. ### Parameters - `routeID string` Identifier. - `params RouteUpdateParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Pattern param.Field[string]` Body param: Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior). - `Script param.Field[string]` Body param: Name of the script to run if the route matches. ### Returns - `type RouteUpdateResponse struct{…}` - `ID string` Identifier. - `Pattern string` Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior). - `Script string` Name of the script to run if the route matches. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) route, err := client.Workers.Routes.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", workers.RouteUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Pattern: cloudflare.F("example.com/*"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", route.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "pattern": "example.com/*", "script": "my-workers-script" }, "success": true } ```