## Update Route `client.workers.routes.update(stringrouteId, RouteUpdateParamsparams, RequestOptionsoptions?): RouteUpdateResponse` **put** `/zones/{zone_id}/workers/routes/{route_id}` Updates the URL pattern or Worker associated with a route. ### Parameters - `routeId: string` Identifier. - `params: RouteUpdateParams` - `zone_id: string` Path param: Identifier. - `pattern: string` Body param: Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior). - `script?: string` Body param: Name of the script to run if the route matches. ### Returns - `RouteUpdateResponse` - `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 ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const route = await client.workers.routes.update('023e105f4ecef8ad9ca31a8372d0c353', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', pattern: 'example.com/*', }); console.log(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 } ```