Skip to main content

Deleting an address

How can I delete an address through the API? I have tried using the people/:id endpoint but if I pass an object with something like "home_address": null it doesn't do anything. If I pass an address object with all the components set to null (ie { "address1": null, "address2":null, etc. }) I can see from the main GUI that the components have indeed been blanked but there is still a "delete address" button, which suggests that the address still exists on the system albeit with blank components.

Official response from

When clearing out the address types (home_address, billing_address, registered_address, or mailing_address), you would need to pass empty strings and null with the request.

 

For example, you could use this curl with the PUT request on the People endpoint here:

curl -v -X PUT --header "Content-Type: application/json" --header "Content-Type: application/json" —data '{  "person": {"home_address": {"address1": "","address2": "","address3": "","city": "","county": null,"state": null,"country_code": "","zip": null,"lat": null,"lng": null,"fips": null,"street_number": null,"street_prefix": null,"street_name": null,"street_type": null,"street_suffix": null,"unit_number": null,"zip4": null,"zip5": null,"sort_sequence": null,"delivery_point": null,"lot": null,"carrier_route": null}}}'https://NATIONSLUG.nationbuilder.com/api/v1/people/PERSONID?access_token=TOKEN

 

Make sure to change NATIONSLUG to the slug of your specific nation, PERSONID to the ID of the person you are looking to update in your database and change TOKEN to your API token that you can get through Settings > Developer > API Token.

If you continue to have problems with clearing out the address fields, let us know and we would be happy to help through email at [email protected]

 

NOTE - this is not a solution for redefining a primary address as whilst you will be able to empty the address you will not be able to re-add that address as the “primary” designation remains even once the address no longer has data in it.

Share this post

Showing 3 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.