Add items (URL redirects) to the list created in step 1.
Create a Bulk Redirect Rule via API, which enables the list created in step 1.
1. Create a Bulk Redirect List via API
Use the Create a list operation to create a new Bulk Redirect List. The list kind must be redirect.
Take note of the list ID — you will need it in the next step.
For more information on list operations, refer to the Lists API documentation.
2. Add items to the list
Use the Create list items operation to add URL redirect items to the list. Enter the list ID from the previous step in the endpoint URL:
This is an asynchronous operation. The response will contain an operation_id which you will use to check if the operation completed successfully using the Get bulk operation status operation:
Once the operation has completed successfully, the response will be similar to the following:
3. Create a Bulk Redirect Rule via API
Since Bulk Redirect Lists are essentially containers of URL redirects, you have to enable the URL redirects in the list by creating a Bulk Redirect Rule.
Add Bulk Redirect Rules to the entry point ruleset of the http_request_redirect phase at the account level. Refer to the Rulesets API documentation for more information on creating a ruleset and supplying a list of rules for the ruleset.
The following request of the Create an account ruleset operation creates a phase entry point ruleset for the http_request_redirect phase at the account level, and defines a single redirect rule. Use this operation if you have not created a phase entry point ruleset for the http_request_redirect phase yet.
If there is already a phase entry point ruleset for the http_request_redirect phase, use the Update an account ruleset operation instead, like in the following example:
Required API token permissions
The API token used in API requests to manage Bulk Redirects objects (lists, list items, and rules) must have at least the following permissions:
Account > Account Rulesets > Edit
Account > Account Filter Lists > Edit
Was this helpful?
What did you like?
What went wrong?
Thank you for helping improve Cloudflare's documentation!