Skip to content
Start here

Update a list

client.Rules.Lists.Update(ctx, listID, params) (*ListUpdateResponse, error)
PUT/accounts/{account_id}/rules/lists/{list_id}

Updates the description of a list.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Account Filter Lists Edit
ParametersExpand Collapse
listID string

The unique ID of the list.

maxLength32
minLength32
params ListUpdateParams
AccountID param.Field[string]

Path param: The Account ID for this resource.

maxLength32
minLength32
Description param.Field[string]optional

Body param: An informative summary of the list.

maxLength500
ReturnsExpand Collapse
type ListUpdateResponse struct{…}
ID string

The unique ID of the list.

maxLength32
minLength32
CreatedOn string

The RFC 3339 timestamp of when the list was created.

Kind ListUpdateResponseKind

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

One of the following:
const ListUpdateResponseKindIP ListUpdateResponseKind = "ip"
const ListUpdateResponseKindRedirect ListUpdateResponseKind = "redirect"
const ListUpdateResponseKindHostname ListUpdateResponseKind = "hostname"
const ListUpdateResponseKindASN ListUpdateResponseKind = "asn"
ModifiedOn string

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

Name string

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

maxLength50
NumItems float64

The number of items in the list.

NumReferencingFilters float64

The number of filters referencing the list.

Description stringoptional

An informative summary of the list.

maxLength500

Update a list

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/rules"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  list, err := client.Rules.Lists.Update(
    context.TODO(),
    "2c0fc9fa937b11eaa1b71c4d701ab86e",
    rules.ListUpdateParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", list.ID)
}
{
  "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": {
    "id": "2c0fc9fa937b11eaa1b71c4d701ab86e",
    "created_on": "2020-01-01T08:00:00Z",
    "kind": "ip",
    "modified_on": "2020-01-10T14:00:00Z",
    "name": "list1",
    "num_items": 10,
    "num_referencing_filters": 2,
    "description": "This is a note"
  },
  "success": true
}
Returns Examples
{
  "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": {
    "id": "2c0fc9fa937b11eaa1b71c4d701ab86e",
    "created_on": "2020-01-01T08:00:00Z",
    "kind": "ip",
    "modified_on": "2020-01-10T14:00:00Z",
    "name": "list1",
    "num_items": 10,
    "num_referencing_filters": 2,
    "description": "This is a note"
  },
  "success": true
}