Key Takeaways
NationBuilder does not support batch deletion of lists natively, so CallHub built a Python script to let administrators delete many stagnant lists at once.
Prerequisites
- Python is required to run the script, and Mac El Capitan already ships with Python 2.7 installed while Windows users need to install the Python executable separately.
- A NationBuilder access token is required, which can be generated by an administrator under Settings > Developer > API Token by clicking Create Token.
- Users who are not administrators must request access or ask an administrator to generate the token on their behalf.
- The IDs of the lists to be deleted are needed, which can be found in the list’s URL, and a sequential range such as 5:12 can be passed instead of individual IDs.
Running the script
- The script is available for download or cloning from the CallHub GitHub repository, with the relevant files located under callhub-examples-master/utilities.
- Mac users run the script from Terminal using ./deletelist.py followed by the slug, access token, and list ID or IDs.
- Windows users run the script from CMD using py deletelist.py with the same slug, access token, and list ID parameters, or a start:end range.
- The required parameters are the NationBuilder slug, the access token obtained from the developer settings, and the ID, IDs, or range of IDs of the lists to delete.
Additional tools
- CallHub also provides an Add Tag script for tagging a large number of people at once on NationBuilder.
- A corresponding Remove Tag script is available for removing a tag from a large number of people in one operation.
What you need
Python
If you have a Mac, El Capitan comes with Python 2.7 installed. If you have a Windows machine, you can install the Python executable.NationBuilder Access token

Get NationBuilder Access Token
- Go to Settings > Developer > API Token and click on Create Token.
- Copy the token.
List ID
Get the IDs of the list you’d like to delete. If the lists are in sequence, you can even pass a range of IDs to the script. For example, if you want to delete all the lists with ID from 5 to 12 then pass<5:12> to the script as a parameter.
Unsure of how to get the ID for a list? You’ll find the ID in the url of the list.

NationBuilder list id
Download the script
The code is available for download or for cloning from the CallHub GitHub repository. Unzip the files and access the files undercallhub-examples-master/utilities.
[pivot_button text=”Download the script” url=”https://github.com/callhub/callhub-examples”]
Run the script
To run the script, you need access to a terminal / CLI. If you are on a Mac, use Terminal. If you are on a Windows machine launch the Windows command line program CMD. Switch to the directorycallhub-examples-master/utilities, the directory in which the files are placed and then run the following command, depending on your OS.
Mac
./deletelist.py <slug> <access_token> <list_id> <list_id>
Windows
py deletelist.py <slug> <access_token> <list_id> <list_id> OR py deletelist.py <slug> <access_token> <start:end>
Where:
<slug> Is your NationBuilder slug
<access_token> Is the access token you got in the previous step
<list_id> Is the ID or IDs or range of IDs of the lists you want to delete

Bulk Delete NationBuilder lists
That’s all folks!
Yes, it’s that easy. Head over to your nation to find all your errant lists gone. We’ve also thrown in a couple of other scripts that will help speed up your batch operations on NationBuilder.Add Tag
Use this script to tag a large number of people at once.Remove Tag
Use this script to remove a tag from a large number of people at one go.If you’d like to get more tips and content on NationBuilder, subscribe now!


