---
title: Lists
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Rules Lists](https://developers.cloudflare.com/api/go/resources/rules)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Lists

##### [Get lists](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/methods/list)

client.Rules.Lists.List(ctx, query) (\*SinglePage\[[ListsList](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)>)], error)

GET/accounts/{account\_id}/rules/lists

##### [Get a list](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/methods/get)

client.Rules.Lists.Get(ctx, listID, query) (\*[ListGetResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists%20%3E%20(model)%20ListGetResponse%20%3E%20(schema)>), error)

GET/accounts/{account\_id}/rules/lists/{list\_id}

##### [Create a list](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/methods/create)

client.Rules.Lists.New(ctx, params) (\*[ListNewResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists%20%3E%20(model)%20ListNewResponse%20%3E%20(schema)>), error)

POST/accounts/{account\_id}/rules/lists

##### [Update a list](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/methods/update)

client.Rules.Lists.Update(ctx, listID, params) (\*[ListUpdateResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists%20%3E%20(model)%20ListUpdateResponse%20%3E%20(schema)>), error)

PUT/accounts/{account\_id}/rules/lists/{list\_id}

##### [Delete a list](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/methods/delete)

client.Rules.Lists.Delete(ctx, listID, body) (\*[ListDeleteResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists%20%3E%20(model)%20ListDeleteResponse%20%3E%20(schema)>), error)

DELETE/accounts/{account\_id}/rules/lists/{list\_id}

##### ModelsExpand Collapse

<details>

<summary>

type Hostname struct{…}

Hostnames support ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (\*), and the hyphen (-).

</summary>

URLHostname string

<a href="#(resource)%20rules.lists%20%3E%20(model)%20hostname%20%3E%20(schema)%20%3E%20(property)%20url_hostname">Link to this property</a>

ExcludeExactHostname boolOptional

Only applies to wildcard hostnames (e.g., \*.example.com). When true (default), the rule blocks only subdomains. When false, the rule blocks both the root domain and subdomains.

<a href="#(resource)%20rules.lists%20%3E%20(model)%20hostname%20%3E%20(schema)%20%3E%20(property)%20exclude_exact_hostname">Link to this property</a>

</details>

[Link to this property](<#(resource)%20rules.lists%20%3E%20(model)%20hostname%20%3E%20(schema)>)

<details>

<summary>

type ListsList struct{…}

</summary>

ID string

The unique ID of the list.

maxLength32

minLength32

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

CreatedOn string

The RFC 3339 timestamp of when the list was created.

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20created_on">Link to this property</a>

<details>

<summary>

Kind ListsListKind

The type of the list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects).

</summary>

One of the following:

const ListsListKindIP ListsListKind = "ip"

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20kind%20%3E%20(member)%200">Link to this property</a>

const ListsListKindRedirect ListsListKind = "redirect"

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20kind%20%3E%20(member)%201">Link to this property</a>

const ListsListKindHostname ListsListKind = "hostname"

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20kind%20%3E%20(member)%202">Link to this property</a>

const ListsListKindASN ListsListKind = "asn"

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20kind%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20kind">Link to this property</a>

ModifiedOn string

The RFC 3339 timestamp of when the list was last modified.

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20modified_on">Link to this property</a>

Name string

An informative name for the list. Use this name in filter and rule expressions.

maxLength50

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

NumItems float64

The number of items in the list.

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20num_items">Link to this property</a>

NumReferencingFilters float64

The number of <a href="https://developers.cloudflare.com/api/resources/filters/">filters</a> referencing the list.

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20num_referencing_filters">Link to this property</a>

Description stringOptional

An informative summary of the list.

maxLength500

<a href="#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)%20%3E%20(property)%20description">Link to this property</a>

</details>

[Link to this property](<#(resource)%20rules.lists%20%3E%20(model)%20lists_list%20%3E%20(schema)>)

<details>

<summary>

type Redirect struct{…}

The definition of the redirect.

</summary>

SourceURL string

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20source_url">Link to this property</a>

TargetURL string

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20target_url">Link to this property</a>

IncludeSubdomains boolOptional

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20include_subdomains">Link to this property</a>

PreservePathSuffix boolOptional

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20preserve_path_suffix">Link to this property</a>

PreserveQueryString boolOptional

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20preserve_query_string">Link to this property</a>

<details>

<summary>

StatusCode RedirectStatusCodeOptional

</summary>

One of the following:

const RedirectStatusCode301 RedirectStatusCode = 301

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20status_code%20%3E%20(member)%200">Link to this property</a>

const RedirectStatusCode302 RedirectStatusCode = 302

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20status_code%20%3E%20(member)%201">Link to this property</a>

const RedirectStatusCode307 RedirectStatusCode = 307

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20status_code%20%3E%20(member)%202">Link to this property</a>

const RedirectStatusCode308 RedirectStatusCode = 308

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20status_code%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20status_code">Link to this property</a>

SubpathMatching boolOptional

<a href="#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)%20%3E%20(property)%20subpath_matching">Link to this property</a>

</details>

[Link to this property](<#(resource)%20rules.lists%20%3E%20(model)%20redirect%20%3E%20(schema)>)

#### ListsBulk Operations

##### [Get bulk operation status](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/subresources/bulk_operations/methods/get)

client.Rules.Lists.BulkOperations.Get(ctx, operationID, query) (\*[ListBulkOperationGetResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists.bulk_operations%20%3E%20(model)%20ListBulkOperationGetResponse%20%3E%20(schema)>), error)

GET/accounts/{account\_id}/rules/lists/bulk\_operations/{operation\_id}

#### ListsItems

##### [Get list items](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/subresources/items/methods/list)

client.Rules.Lists.Items.List(ctx, listID, params) (\*CursorPaginationAfter\[[ListItemListResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists.items%20%3E%20(model)%20ListItemListResponse%20%3E%20(schema)>)], error)

GET/accounts/{account\_id}/rules/lists/{list\_id}/items

##### [Get a list item](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/subresources/items/methods/get)

client.Rules.Lists.Items.Get(ctx, listID, itemID, query) (\*[ListItemGetResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists.items%20%3E%20(model)%20ListItemGetResponse%20%3E%20(schema)>), error)

GET/accounts/{account\_id}/rules/lists/{list\_id}/items/{item\_id}

##### [Create list items](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/subresources/items/methods/create)

client.Rules.Lists.Items.New(ctx, listID, params) (\*[ListItemNewResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists.items%20%3E%20(model)%20ListItemNewResponse%20%3E%20(schema)>), error)

POST/accounts/{account\_id}/rules/lists/{list\_id}/items

##### [Update all list items](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/subresources/items/methods/update)

client.Rules.Lists.Items.Update(ctx, listID, params) (\*[ListItemUpdateResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists.items%20%3E%20(model)%20ListItemUpdateResponse%20%3E%20(schema)>), error)

PUT/accounts/{account\_id}/rules/lists/{list\_id}/items

##### [Delete list items](https://developers.cloudflare.com/api/go/resources/rules/subresources/lists/subresources/items/methods/delete)

client.Rules.Lists.Items.Delete(ctx, listID, params) (\*[ListItemDeleteResponse](<https://developers.cloudflare.com/api/go/resources/rules#(resource)%20rules.lists.items%20%3E%20(model)%20ListItemDeleteResponse%20%3E%20(schema)>), error)

DELETE/accounts/{account\_id}/rules/lists/{list\_id}/items

##### ModelsExpand Collapse

<details>

<summary>

type ListCursor struct{…}

</summary>

After stringOptional

<a href="#(resource)%20rules.lists.items%20%3E%20(model)%20list_cursor%20%3E%20(schema)%20%3E%20(property)%20after">Link to this property</a>

Before stringOptional

<a href="#(resource)%20rules.lists.items%20%3E%20(model)%20list_cursor%20%3E%20(schema)%20%3E%20(property)%20before">Link to this property</a>

</details>

[Link to this property](<#(resource)%20rules.lists.items%20%3E%20(model)%20list_cursor%20%3E%20(schema)>)

<details>

<summary>

type ListItem struct{…}

</summary>

OperationID string

The unique operation ID of the asynchronous action.

<a href="#(resource)%20rules.lists.items%20%3E%20(model)%20list_item%20%3E%20(schema)%20%3E%20(property)%20operation_id">Link to this property</a>

</details>

[Link to this property](<#(resource)%20rules.lists.items%20%3E%20(model)%20list_item%20%3E%20(schema)>)