## Create Route `workers.routes.create(RouteCreateParams**kwargs) -> RouteCreateResponse` **post** `/zones/{zone_id}/workers/routes` Creates a route that maps a URL pattern to a Worker. ### Parameters - `zone_id: str` Identifier. - `pattern: str` Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior). - `script: Optional[str]` Name of the script to run if the route matches. ### Returns - `class RouteCreateResponse: …` - `id: str` Identifier. - `pattern: str` Pattern to match incoming requests against. [Learn more](https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior). - `script: Optional[str]` Name of the script to run if the route matches. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) route = client.workers.routes.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", pattern="example.com/*", ) print(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 } ```