# Subdomains ## Get Subdomain `workers.subdomains.get(SubdomainGetParams**kwargs) -> SubdomainGetResponse` **get** `/accounts/{account_id}/workers/subdomain` Returns a Workers subdomain for an account. ### Parameters - `account_id: str` Identifier. ### Returns - `class SubdomainGetResponse: …` - `subdomain: str` ### 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 ) subdomain = client.workers.subdomains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(subdomain.subdomain) ``` #### 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": { "subdomain": "my-subdomain" }, "success": true } ``` ## Create Subdomain `workers.subdomains.update(SubdomainUpdateParams**kwargs) -> SubdomainUpdateResponse` **put** `/accounts/{account_id}/workers/subdomain` Creates a Workers subdomain for an account. ### Parameters - `account_id: str` Identifier. - `subdomain: str` ### Returns - `class SubdomainUpdateResponse: …` - `subdomain: str` ### 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 ) subdomain = client.workers.subdomains.update( account_id="023e105f4ecef8ad9ca31a8372d0c353", subdomain="my-subdomain", ) print(subdomain.subdomain) ``` #### 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": { "subdomain": "my-subdomain" }, "success": true } ``` ## Delete Subdomain `workers.subdomains.delete(SubdomainDeleteParams**kwargs)` **delete** `/accounts/{account_id}/workers/subdomain` Deletes a Workers subdomain for an account. ### Parameters - `account_id: str` Identifier. ### 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 ) client.workers.subdomains.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) ``` ## Domain Types ### Subdomain Get Response - `class SubdomainGetResponse: …` - `subdomain: str` ### Subdomain Update Response - `class SubdomainUpdateResponse: …` - `subdomain: str`