## Create a new App `client.MagicTransit.Apps.New(ctx, params) (*AppNewResponse, error)` **post** `/accounts/{account_id}/magic/apps` Creates a new App for an account ### Parameters - `params AppNewParams` - `AccountID param.Field[string]` Path param: Identifier - `Name param.Field[string]` Body param: Display name for the app. - `Type param.Field[string]` Body param: Category of the app. - `Hostnames param.Field[[]string]` Body param: FQDNs to associate with traffic decisions. - `IPSubnets param.Field[[]string]` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `SourceSubnets param.Field[[]string]` Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) ### Returns - `type AppNewResponse struct{…}` Custom app defined for an account. - `AccountAppID string` Magic account app ID. - `Hostnames []string` FQDNs to associate with traffic decisions. - `IPSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Name string` Display name for the app. - `SourceSubnets []string` IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported) - `Type string` Category of the app. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/magic_transit" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) app, err := client.MagicTransit.Apps.New(context.TODO(), magic_transit.AppNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("Cloudflare Dashboard"), Type: cloudflare.F("Development"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", app.AccountAppID) } ``` #### 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 } ```