cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk delete customer profiles from CIM

Is there a method for bulk deleting customer profiles? As far as I can tell, we can only delete them one at a time. We have almost 20,000 profiles and are hoping to cull these down by removing profiles with expired payment profiles or no recent history of payment. 

zgoldberg
Member
2 REPLIES 2

Hi @zgoldberg ,

Thank you for reaching out with your question regarding bulk deletion of customer profiles in CIM. Currently, there isn't an API method for bulk deleting customer profiles directly. Profiles can only be deleted one at a time using our existing API.

However, I would recommend signing up for Account Updater (AU), which can help manage expired profiles by updating or deleting them automatically.

For bulk deletion, a possible workaround involves developing a utility to handle this process using the existing API endpoint: Delete Customer Profile API. Although direct bulk deletion isn't supported, you can create a script to iterate through customer profiles and delete them one by one.

Here is a basic example of how you might achieve this using a script in Python:

```python

import requests

api_login_id = 'your_api_login_id'
transaction_key = 'your_transaction_key'
customer_profile_ids = ['profile_id_1', 'profile_id_2', ...] # List of profile IDs to delete

def delete_customer_profile(profile_id):
url = 'https://apitest.authorize.net/xml/v1/request.api'
headers = {'Content-Type': 'application/xml'}
body = f"""
<deleteCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>{api_login_id}</name>
<transactionKey>{transaction_key}</transactionKey>
</merchantAuthentication>
<customerProfileId>{profile_id}</customerProfileId>
</deleteCustomerProfileRequest>
"""
response = requests.post(url, headers=headers, data=body)
return response.status_code, response.text

for profile_id in customer_profile_ids:
status_code, response_text = delete_customer_profile(profile_id)
print(f"Deleted profile {profile_id}: Status Code: {status_code}, Response: {response_text}")

```

Please note that this example is for demonstration purposes. You'll need to handle errors, retries, and possibly rate limits depending on your specific requirements.

If you have any further questions or need more assistance, feel free to reach out.

Best regards,
Authorize.NET Developer Team

pamahesh
New Member

Hi there,

I totally understand how managing 20,000 customer profiles can be a huge task! Unfortunately, as you've noticed, most systems tend to delete profiles one at a time by default. However, some platforms do offer bulk delete features, though they might not be immediately obvious.

Here’s what I’d recommend:

  1. Check for bulk actions in your system: Some platforms allow you to filter profiles (by expiration, payment history, etc.) and perform batch actions like deleting. If this option exists, it might be under advanced search or bulk edit features.
  2. APIs or automation: If your platform has an API, you might be able to automate this process by querying for profiles with expired payment info or no recent activity, and then deleting them in bulk using a script.
  3. Contact support: If you’re not sure, it might be worth reaching out to the platform’s support team. They might have a tool or solution for bulk deletion that’s not immediately obvious in the UI.

Hope this helps, and let me know if you need more info!

chriswilson00
New Member