Delete Customer
Permanently delete a customer record from your Solar Proof account via the API.
https://solarproof.com.au/apidata.php
Description
Permanently removes a customer from your Solar Proof account. This is a destructive operation that cannot be reversed. Before deleting a customer, ensure:
- You have backed up any important customer data
- All related projects have been handled appropriately
- You have the necessary permissions to delete customer records
Request Parameters
?api_key=YOUR_API_KEY
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
api_key |
string | Required | Your Solar Proof API key |
action |
string | Required | Must be set to "deletecustomer" |
Request Body (JSON)
Send a JSON object in the request body with a data
key containing the following fields:
Field | Type | Required | Description |
---|---|---|---|
apikey |
string | Required | Your Solar Proof API key |
action |
string | Required | Must be "deletecustomer" |
pkcustomerid |
integer | Required | The unique ID of the customer to delete |
Response
Success Response (200 OK)
{
"Message": "Customer Deleted Permanently!",
"CustomerId": "79461"
}
Field | Type | Description |
---|---|---|
Message |
string | Confirmation message of successful deletion |
CustomerId |
string | The ID of the deleted customer |
Error Response (4xx/5xx)
{
"code": "CUSTOMER_NOT_FOUND",
"message": "The specified customer does not exist"
}
Error Code | Description |
---|---|
INVALID_API_KEY |
The provided API key is invalid or missing |
INVALID_PARAMETERS |
Required parameter pkcustomerid is missing or invalid |
CUSTOMER_NOT_FOUND |
No customer exists with the specified ID |
PERMISSION_DENIED |
You don't have permission to delete this customer |
DELETION_FAILED |
Customer deletion failed due to a server error |
Example Request
curl -X POST "https://solarproof.com.au/apidata.php?api_key=YOUR_API_KEY&action=deletecustomer" \
-H "Content-Type: application/json" \
-d '{
"data": {
"apikey": "YOUR_API_KEY",
"action": "deletecustomer",
"pkcustomerid": 79461
}
}'
const apiKey = 'YOUR_API_KEY';
const customerId = 79461;
const url = `https://solarproof.com.au/apidata.php?api_key=${apiKey}&action=deletecustomer`;
const requestData = {
data: {
apikey: apiKey,
action: 'deletecustomer',
pkcustomerid: customerId
}
};
// Show confirmation before deleting
if (confirm(`Are you sure you want to permanently delete customer ${customerId}?`)) {
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(requestData)
})
.then(response => response.json())
.then(data => {
console.log('Customer deleted:', data);
})
.catch(error => console.error('Error:', error));
}
<?php
$apiKey = 'YOUR_API_KEY';
$customerId = 79461;
$url = "https://solarproof.com.au/apidata.php?api_key={$apiKey}&action=deletecustomer";
$data = [
'data' => [
'apikey' => $apiKey,
'action' => 'deletecustomer',
'pkcustomerid' => $customerId
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
$result = json_decode($response, true);
echo "Customer deleted: " . $result['CustomerId'];
} else {
echo "Error deleting customer";
}
?>
import requests
import json
api_key = 'YOUR_API_KEY'
customer_id = 79461
url = f'https://solarproof.com.au/apidata.php?api_key={api_key}&action=deletecustomer'
# Prompt for confirmation before deleting
confirm = input(f'Are you sure you want to delete customer {customer_id}? (yes/no): ')
if confirm.lower() == 'yes':
request_data = {
'data': {
'apikey': api_key,
'action': 'deletecustomer',
'pkcustomerid': customer_id
}
}
response = requests.post(
url,
headers={'Content-Type': 'application/json'},
data=json.dumps(request_data)
)
if response.status_code == 200:
result = response.json()
print(f"Customer deleted: {result['CustomerId']}")
else:
print(f"Error: {response.status_code}")
else:
print('Deletion cancelled')
Best Practices
Always Confirm Before Deleting
Implement confirmation dialogs in your application to prevent accidental deletions. Consider requiring users to type the customer ID or name to confirm.
Consider Soft Deletion
Instead of permanently deleting customers, consider marking them as "inactive" or "archived" to preserve historical data and relationships.
Export Data First
Before deleting a customer, use the Get Customer endpoint to retrieve and backup all customer data.
Audit Trail
Log all deletion requests in your application including who requested the deletion, when it occurred, and which customer was deleted.