# Apps ## List Apps `client.magicTransit.apps.list(AppListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/magic/apps` Lists Apps associated with an account. ### Parameters - `params: AppListParams` - `account_id: string` Identifier ### Returns - `AppListResponse = MagicAccountApp | MagicManagedApp` Collection of Hostnames and/or IP Subnets to associate with traffic decisions. - `MagicAccountApp` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. - `MagicManagedApp` Managed app defined by Cloudflare. - `managed_app_id: string` Managed app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const appListResponse of client.magicTransit.apps.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(appListResponse); } ``` #### 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 `client.magicTransit.apps.create(AppCreateParamsparams, RequestOptionsoptions?): AppCreateResponse | null` **post** `/accounts/{account_id}/magic/apps` Creates a new App for an account ### Parameters - `params: AppCreateParams` - `account_id: string` Path param: Identifier - `name: string` Body param: Display name for the app. - `type: string` Body param: Category of the app. - `hostnames?: Array` Body param: FQDNs to associate with traffic decisions. - `ip_subnets?: Array` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `source_subnets?: Array` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) ### Returns - `AppCreateResponse` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### 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 app = await client.magicTransit.apps.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'Cloudflare Dashboard', type: 'Development', }); console.log(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 `client.magicTransit.apps.update(stringaccountAppId, AppUpdateParamsparams, RequestOptionsoptions?): AppUpdateResponse | null` **put** `/accounts/{account_id}/magic/apps/{account_app_id}` Updates an Account App ### Parameters - `accountAppId: string` Identifier - `params: AppUpdateParams` - `account_id: string` Path param: Identifier - `hostnames?: Array` Body param: FQDNs to associate with traffic decisions. - `ip_subnets?: Array` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Body param: Display name for the app. - `source_subnets?: Array` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Body param: Category of the app. ### Returns - `AppUpdateResponse` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### 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 app = await client.magicTransit.apps.update('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 `client.magicTransit.apps.edit(stringaccountAppId, AppEditParamsparams, RequestOptionsoptions?): AppEditResponse | null` **patch** `/accounts/{account_id}/magic/apps/{account_app_id}` Updates an Account App ### Parameters - `accountAppId: string` Identifier - `params: AppEditParams` - `account_id: string` Path param: Identifier - `hostnames?: Array` Body param: FQDNs to associate with traffic decisions. - `ip_subnets?: Array` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Body param: Display name for the app. - `source_subnets?: Array` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Body param: Category of the app. ### Returns - `AppEditResponse` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### 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 response = await client.magicTransit.apps.edit('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 `client.magicTransit.apps.delete(stringaccountAppId, AppDeleteParamsparams, RequestOptionsoptions?): AppDeleteResponse | null` **delete** `/accounts/{account_id}/magic/apps/{account_app_id}` Deletes specific Account App. ### Parameters - `accountAppId: string` Identifier - `params: AppDeleteParams` - `account_id: string` Identifier ### Returns - `AppDeleteResponse` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### 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 app = await client.magicTransit.apps.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 = MagicAccountApp | MagicManagedApp` Collection of Hostnames and/or IP Subnets to associate with traffic decisions. - `MagicAccountApp` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. - `MagicManagedApp` Managed app defined by Cloudflare. - `managed_app_id: string` Managed app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### App Create Response - `AppCreateResponse` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### App Update Response - `AppUpdateResponse` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### App Edit Response - `AppEditResponse` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app. ### App Delete Response - `AppDeleteResponse` Custom app defined for an account. - `account_app_id: string` Magic account app ID. - `hostnames?: Array` FQDNs to associate with traffic decisions. - `ip_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `name?: string` Display name for the app. - `source_subnets?: Array` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `type?: string` Category of the app.