# Custom Pages ## List custom pages `client.ZeroTrust.Access.CustomPages.List(ctx, params) (*V4PagePaginationArray[CustomPageWithoutHTML], error)` **get** `/accounts/{account_id}/access/custom_pages` List custom pages ### Parameters - `params AccessCustomPageListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Page param.Field[int64]` Query param: Page number of results. - `PerPage param.Field[int64]` Query param: Number of results per page. ### Returns - `type CustomPageWithoutHTML struct{…}` - `Name string` Custom page name. - `Type CustomPageWithoutHTMLType` Custom page type. - `const CustomPageWithoutHTMLTypeIdentityDenied CustomPageWithoutHTMLType = "identity_denied"` - `const CustomPageWithoutHTMLTypeForbidden CustomPageWithoutHTMLType = "forbidden"` - `UID string` UUID. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.Access.CustomPages.List(context.TODO(), zero_trust.AccessCustomPageListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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" } } ], "success": true, "result": [ { "name": "name", "type": "identity_denied", "app_count": 0, "created_at": "2014-01-01T05:20:00.12345Z", "uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Get a custom page `client.ZeroTrust.Access.CustomPages.Get(ctx, customPageID, query) (*CustomPage, error)` **get** `/accounts/{account_id}/access/custom_pages/{custom_page_id}` Fetches a custom page and also returns its HTML. ### Parameters - `customPageID string` UUID. - `query AccessCustomPageGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type CustomPage struct{…}` - `CustomHTML string` Custom page HTML. - `Name string` Custom page name. - `Type CustomPageType` Custom page type. - `const CustomPageTypeIdentityDenied CustomPageType = "identity_denied"` - `const CustomPageTypeForbidden CustomPageType = "forbidden"` - `UID string` UUID. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) customPage, err := client.ZeroTrust.Access.CustomPages.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.AccessCustomPageGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", customPage.UID) } ``` #### 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" } } ], "success": true, "result": { "custom_html": "

Access Denied

", "name": "name", "type": "identity_denied", "app_count": 0, "created_at": "2014-01-01T05:20:00.12345Z", "uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Create a custom page `client.ZeroTrust.Access.CustomPages.New(ctx, params) (*CustomPageWithoutHTML, error)` **post** `/accounts/{account_id}/access/custom_pages` Create a custom page ### Parameters - `params AccessCustomPageNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `CustomPage param.Field[CustomPage]` Body param ### Returns - `type CustomPageWithoutHTML struct{…}` - `Name string` Custom page name. - `Type CustomPageWithoutHTMLType` Custom page type. - `const CustomPageWithoutHTMLTypeIdentityDenied CustomPageWithoutHTMLType = "identity_denied"` - `const CustomPageWithoutHTMLTypeForbidden CustomPageWithoutHTMLType = "forbidden"` - `UID string` UUID. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) customPageWithoutHTML, err := client.ZeroTrust.Access.CustomPages.New(context.TODO(), zero_trust.AccessCustomPageNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CustomPage: zero_trust.CustomPageParam{ CustomHTML: cloudflare.F("

Access Denied

"), Name: cloudflare.F("name"), Type: cloudflare.F(zero_trust.CustomPageTypeIdentityDenied), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", customPageWithoutHTML.UID) } ``` #### 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" } } ], "success": true, "result": { "name": "name", "type": "identity_denied", "app_count": 0, "created_at": "2014-01-01T05:20:00.12345Z", "uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Update a custom page `client.ZeroTrust.Access.CustomPages.Update(ctx, customPageID, params) (*CustomPageWithoutHTML, error)` **put** `/accounts/{account_id}/access/custom_pages/{custom_page_id}` Update a custom page ### Parameters - `customPageID string` UUID. - `params AccessCustomPageUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `CustomPage param.Field[CustomPage]` Body param ### Returns - `type CustomPageWithoutHTML struct{…}` - `Name string` Custom page name. - `Type CustomPageWithoutHTMLType` Custom page type. - `const CustomPageWithoutHTMLTypeIdentityDenied CustomPageWithoutHTMLType = "identity_denied"` - `const CustomPageWithoutHTMLTypeForbidden CustomPageWithoutHTMLType = "forbidden"` - `UID string` UUID. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) customPageWithoutHTML, err := client.ZeroTrust.Access.CustomPages.Update( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.AccessCustomPageUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), CustomPage: zero_trust.CustomPageParam{ CustomHTML: cloudflare.F("

Access Denied

"), Name: cloudflare.F("name"), Type: cloudflare.F(zero_trust.CustomPageTypeIdentityDenied), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", customPageWithoutHTML.UID) } ``` #### 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" } } ], "success": true, "result": { "name": "name", "type": "identity_denied", "app_count": 0, "created_at": "2014-01-01T05:20:00.12345Z", "uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete a custom page `client.ZeroTrust.Access.CustomPages.Delete(ctx, customPageID, body) (*AccessCustomPageDeleteResponse, error)` **delete** `/accounts/{account_id}/access/custom_pages/{custom_page_id}` Delete a custom page ### Parameters - `customPageID string` UUID. - `body AccessCustomPageDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type AccessCustomPageDeleteResponse struct{…}` - `ID string` UUID. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) customPage, err := client.ZeroTrust.Access.CustomPages.Delete( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.AccessCustomPageDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", customPage.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" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } } ``` ## Domain Types ### Custom Page - `type CustomPage struct{…}` - `CustomHTML string` Custom page HTML. - `Name string` Custom page name. - `Type CustomPageType` Custom page type. - `const CustomPageTypeIdentityDenied CustomPageType = "identity_denied"` - `const CustomPageTypeForbidden CustomPageType = "forbidden"` - `UID string` UUID. ### Custom Page Without HTML - `type CustomPageWithoutHTML struct{…}` - `Name string` Custom page name. - `Type CustomPageWithoutHTMLType` Custom page type. - `const CustomPageWithoutHTMLTypeIdentityDenied CustomPageWithoutHTMLType = "identity_denied"` - `const CustomPageWithoutHTMLTypeForbidden CustomPageWithoutHTMLType = "forbidden"` - `UID string` UUID.