# Apps ## List Apps `magic_transit.apps.list(AppListParams**kwargs) -> SyncSinglePage[AppListResponse]` **get** `/accounts/{account_id}/magic/apps` Lists Apps associated with an account. ### Parameters - `account_id: str` Identifier ### Returns - `AppListResponse` Collection of Hostnames and/or IP Subnets to associate with traffic decisions. - `class MagicAccountApp: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. - `class MagicManagedApp: …` Managed app defined by Cloudflare. - `managed_app_id: str` Managed app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### 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 ) page = client.magic_transit.apps.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page) ``` #### 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": [ { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" } ], "success": true } ``` ## Create a new App `magic_transit.apps.create(AppCreateParams**kwargs) -> AppCreateResponse` **post** `/accounts/{account_id}/magic/apps` Creates a new App for an account ### Parameters - `account_id: str` Identifier - `name: str` Display name for the app. - `type: str` Category of the app. - `hostnames: Optional[SequenceNotStr[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[SequenceNotStr[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `source_subnets: Optional[SequenceNotStr[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) ### Returns - `class AppCreateResponse: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### 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 ) app = client.magic_transit.apps.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", name="Cloudflare Dashboard", type="Development", ) print(app.account_app_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": { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" }, "success": true } ``` ## Update an App `magic_transit.apps.update(straccount_app_id, AppUpdateParams**kwargs) -> AppUpdateResponse` **put** `/accounts/{account_id}/magic/apps/{account_app_id}` Updates an Account App ### Parameters - `account_id: str` Identifier - `account_app_id: str` Identifier - `hostnames: Optional[SequenceNotStr[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[SequenceNotStr[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[SequenceNotStr[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### Returns - `class AppUpdateResponse: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### 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 ) app = client.magic_transit.apps.update( account_app_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(app.account_app_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": { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" }, "success": true } ``` ## Update an App `magic_transit.apps.edit(straccount_app_id, AppEditParams**kwargs) -> AppEditResponse` **patch** `/accounts/{account_id}/magic/apps/{account_app_id}` Updates an Account App ### Parameters - `account_id: str` Identifier - `account_app_id: str` Identifier - `hostnames: Optional[SequenceNotStr[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[SequenceNotStr[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[SequenceNotStr[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### Returns - `class AppEditResponse: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### 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 ) response = client.magic_transit.apps.edit( account_app_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.account_app_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": { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" }, "success": true } ``` ## Delete Account App `magic_transit.apps.delete(straccount_app_id, AppDeleteParams**kwargs) -> AppDeleteResponse` **delete** `/accounts/{account_id}/magic/apps/{account_app_id}` Deletes specific Account App. ### Parameters - `account_id: str` Identifier - `account_app_id: str` Identifier ### Returns - `class AppDeleteResponse: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### 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 ) app = client.magic_transit.apps.delete( account_app_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(app.account_app_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": { "account_app_id": "ac60d3d0435248289d446cedd870bcf4", "hostnames": [ "auth.cloudflare.com" ], "ip_subnets": [ "192.0.2.0/24" ], "name": "Cloudflare Dashboard", "source_subnets": [ "192.0.2.0/24" ], "type": "Development" }, "success": true } ``` ## Domain Types ### App List Response - `AppListResponse` Collection of Hostnames and/or IP Subnets to associate with traffic decisions. - `class MagicAccountApp: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. - `class MagicManagedApp: …` Managed app defined by Cloudflare. - `managed_app_id: str` Managed app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### App Create Response - `class AppCreateResponse: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### App Update Response - `class AppUpdateResponse: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### App Edit Response - `class AppEditResponse: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app. ### App Delete Response - `class AppDeleteResponse: …` Custom app defined for an account. - `account_app_id: str` Magic account app ID. - `hostnames: Optional[List[str]]` FQDNs to associate with traffic decisions. - `ip_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name: Optional[str]` Display name for the app. - `source_subnets: Optional[List[str]]` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type: Optional[str]` Category of the app.