Endpoints
To invoke a Lists API operation, append the endpoint to the Cloudflare API base URL:
https://api.cloudflare.com/client/v4/
For authentication instructions, refer to Getting Started: Requests in the Cloudflare API documentation.
For help with endpoints and pagination, refer to Getting Started: Endpoints.
The Lists API supports the operations outlined below. Visit the associated links for examples.
Manage lists
Operation | Method & Endpoint | Notes |
---|---|---|
Create a list | POST accounts/<ACCOUNT_ID>/rules/lists | Creates an empty list. |
Get lists | GET accounts/<ACCOUNT_ID>/rules/lists | Fetch all lists for the account. (This request does not fetch the items in the lists.) |
Get a list | GET accounts/<ACCOUNT_ID>/rules/lists/<LIST_ID> | Fetches a list by its id . (This request does not display the
items in the list.) |
Update a list | PUT accounts/<ACCOUNT_ID>/rules/lists/<LIST_ID> | Updates the To update an item in a list, use the Update all list items operation. |
Delete a list | DELETE accounts/<ACCOUNT_ID>/rules/lists/<LIST_ID> | Deletes the list, but only when no filters reference it. |
Manage items in a list
Nearly all the operations for managing items in a list are asynchronous. When you add or delete a large amount of items to or from a list, there may be a delay before the bulk operation is complete.
Asynchronous list operations return an operation_id
, which you can use to monitor the status of an API operation. To monitor the status of an asynchronous operation, use the Get bulk operation status endpoint and specify the ID of the operation you want to monitor.
When you make requests to a list while a bulk operation on that list is in progress, the requests are queued and processed in sequence (first in, first out). Requests for successful asynchronous operations return an HTTP 201
status code.
Operation | Method & Endpoint | Notes |
---|---|---|
Get list items | GET accounts/<ACCOUNT_ID>/rules/lists/<LIST_ID>/items | Fetches all items in a list. Items are sorted in ascending order. In the case of IP Lists, CIDRs are sorted by IP address, then by the subnet mask. |
Get a list item | GET accounts/<ACCOUNT_ID>/rules/lists/<LIST_ID>/items/<ITEM_ID> | Fetches an item from a list by ID. |
Create list items | POST accounts/<ACCOUNT_ID>/rules/lists/<LIST_ID>/items | Appends a new item or items to a list. Replaces entries that already exist in the list, does not delete any items. Overwrites the The response includes an |
Update all list items | PUT accounts/<ACCOUNT_ID>/rules/lists/<LIST_ID>/items | Deletes all current items in the list and replaces them with When The response includes an |
Delete list items | DELETE accounts/<ACCOUNT_ID>/rules/lists/<LIST_ID>/items | Deletes specified list items. The response includes an |