## List account or zone rulesets `client.Rulesets.List(ctx, params) (*CursorPagination[RulesetListResponse], error)` **get** `/{accounts_or_zones}/{account_or_zone_id}/rulesets` Fetches all rulesets. ### Parameters - `params RulesetListParams` - `AccountID param.Field[string]` Path param: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - `ZoneID param.Field[string]` Path param: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - `Cursor param.Field[string]` Query param: The cursor to use for the next page. - `PerPage param.Field[int64]` Query param: The number of rulesets to return per page. ### Returns - `type RulesetListResponse struct{…}` A ruleset object. - `ID string` The unique ID of the ruleset. - `Kind Kind` The kind of the ruleset. - `const KindManaged Kind = "managed"` - `const KindCustom Kind = "custom"` - `const KindRoot Kind = "root"` - `const KindZone Kind = "zone"` - `LastUpdated Time` The timestamp of when the ruleset was last modified. - `Name string` The human-readable name of the ruleset. - `Phase Phase` The phase of the ruleset. - `const PhaseDDoSL4 Phase = "ddos_l4"` - `const PhaseDDoSL7 Phase = "ddos_l7"` - `const PhaseHTTPConfigSettings Phase = "http_config_settings"` - `const PhaseHTTPCustomErrors Phase = "http_custom_errors"` - `const PhaseHTTPLogCustomFields Phase = "http_log_custom_fields"` - `const PhaseHTTPRatelimit Phase = "http_ratelimit"` - `const PhaseHTTPRequestCacheSettings Phase = "http_request_cache_settings"` - `const PhaseHTTPRequestDynamicRedirect Phase = "http_request_dynamic_redirect"` - `const PhaseHTTPRequestFirewallCustom Phase = "http_request_firewall_custom"` - `const PhaseHTTPRequestFirewallManaged Phase = "http_request_firewall_managed"` - `const PhaseHTTPRequestLateTransform Phase = "http_request_late_transform"` - `const PhaseHTTPRequestOrigin Phase = "http_request_origin"` - `const PhaseHTTPRequestRedirect Phase = "http_request_redirect"` - `const PhaseHTTPRequestSanitize Phase = "http_request_sanitize"` - `const PhaseHTTPRequestSBFM Phase = "http_request_sbfm"` - `const PhaseHTTPRequestTransform Phase = "http_request_transform"` - `const PhaseHTTPResponseCacheSettings Phase = "http_response_cache_settings"` - `const PhaseHTTPResponseCompression Phase = "http_response_compression"` - `const PhaseHTTPResponseFirewallManaged Phase = "http_response_firewall_managed"` - `const PhaseHTTPResponseHeadersTransform Phase = "http_response_headers_transform"` - `const PhaseMagicTransit Phase = "magic_transit"` - `const PhaseMagicTransitIDsManaged Phase = "magic_transit_ids_managed"` - `const PhaseMagicTransitManaged Phase = "magic_transit_managed"` - `const PhaseMagicTransitRatelimit Phase = "magic_transit_ratelimit"` - `Version string` The version of the ruleset. - `Description string` An informative description of the ruleset. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/rulesets" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Rulesets.List(context.TODO(), rulesets.RulesetListParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "message": "something bad happened", "code": 10000, "source": { "pointer": "/rules/0/action" } } ], "messages": [ { "message": "something bad happened", "code": 10000, "source": { "pointer": "/rules/0/action" } } ], "result": [ { "id": "2f2feab2026849078ba485f918791bdc", "kind": "root", "last_updated": "2000-01-01T00:00:00.000000Z", "name": "My ruleset", "phase": "http_request_firewall_custom", "version": "1", "description": "A description for my ruleset." } ], "success": true, "result_info": { "cursors": { "after": "dGhpc2lzYW5leGFtcGxlCg" } } } ```